class Category

Clase para los items de los menús de navegación, tanto de Irekia, como de los canales de la WebTV

Constants

CLOSED_CAPTIONS_TAG
LANGUAGES

Public Instance Methods

albums(finder_opts={}) click to toggle source
# File app/models/category.rb, line 61
def albums(finder_opts={})
  unless @all_albums
    private_tags = self.tags.private.collect {|t| t.name_es}
    @all_albums = Album.published.with_photos.tagged_with(private_tags.length > 0 ? private_tags : ['this album has no video'])
  end
  @all_albums
end
albums_count() click to toggle source
# File app/models/category.rb, line 69
def albums_count
  self.albums.count('distinct albums.id')
end
department() click to toggle source

Si una categoría tiene el tag del departamento, es el “channel” de ese departamento (para webtv y fototeca)

# File app/models/category.rb, line 81
def department
  all_department_tags = Department.tag_names
  common_tags = self.tag_list & all_department_tags
  output = common_tags.length > 0 ? Department.find_by_tag_name(common_tags.first) : nil
  return output
end
pretty_name() click to toggle source

Las categorias que acaban con “+”, no son link en los menús. Ese + no debe salir en los breadcrumbs

# File app/models/category.rb, line 76
def pretty_name
  self.name.sub(/\+$/, '')
end
videos() click to toggle source

Vídeos del área: son los vídeos que tienen el tag del área

# File app/models/category.rb, line 52
def videos
  private_tags = self.tags.private.collect {|t| t.name_es}
  Video.published.translated.tagged_with(private_tags.length > 0 ? private_tags : ['this category has no video'])
end
videos_count() click to toggle source
# File app/models/category.rb, line 57
def videos_count
  self.videos.count('distinct videos.id')
end