Métodos comunes para los contenidos que tie nen acciones: áreas y políticos. Las instancias del modelo que incuye este módulo tienen que tener definido el método tag_name_es
Álbumes de un área: son los álbumes que tienen el tag del área
# File app/models/tools/with_actions.rb, line 59 def albums Album.published.with_photos.tagged_with(self.tag_name_es) end
# File app/models/tools/with_actions.rb, line 63 def albums_count self.albums.count('distinct albums.id') end
# File app/models/tools/with_actions.rb, line 97 def answers Comment.official.approved.tagged_with(self.tag_name_es) end
Propuestas del área: son las propuestas que comparten tags con el área
# File app/models/tools/with_actions.rb, line 77 def approved_and_published_proposals Proposal.approved.published.tagged_with(self.tag_name_es) #translated??? end
# File app/models/tools/with_actions.rb, line 93 def comments Comment.approved.tagged_with(self.tag_name_es) end
# File app/models/tools/with_actions.rb, line 89 def debates Debate.published.translated.tagged_with(self.tag_name_es) end
Eventos del área: son los eventos que comparten tags con el área
# File app/models/tools/with_actions.rb, line 41 def events Event.published.translated.tagged_with(self.tag_name_es) end
# File app/models/tools/with_actions.rb, line 45 def events_count self.events.count('distinct documents.id') end
# File app/models/tools/with_actions.rb, line 36 def featured_news News.published.translated.tagged_with(self.featured_tag_name_es) end
Noticias que comparten tags con el modelo
# File app/models/tools/with_actions.rb, line 28 def news News.published.translated.tagged_with(self.tag_name_es) end
# File app/models/tools/with_actions.rb, line 32 def news_count self.news.count('distinct documents.id') end
Fotos de un área: son las fotos que tienen el tag del área
# File app/models/tools/with_actions.rb, line 68 def photos Photo.published.tagged_with(self.tag_name_es) end
# File app/models/tools/with_actions.rb, line 72 def photos_count self.photos.count('distinct photos.id') end
# File app/models/tools/with_actions.rb, line 85 def proposals_count self.approved_and_published_proposals.count('distinct contributions.id') end
# File app/models/tools/with_actions.rb, line 81 def published_debates Debate.published.tagged_with(self.tag_name_es) #translated??? end
Vídeos del área: son los vídeos que tienen el tag del área
# File app/models/tools/with_actions.rb, line 50 def videos Video.published.translated.tagged_with(self.tag_name_es) end
# File app/models/tools/with_actions.rb, line 54 def videos_count self.videos.count('distinct videos.id') end