module Admin::DocumentsHelper

OpenIrekia v4.0.0

Copyright 2009-2013 eFaber, S.L. Copyright 2009-2013 Ejie, S.A. Copyrigth 2009-2013 Dirección de Gobierno Abierto y Comunicación en Internet;

Gobernu Irekirako eta Interneteko Komunikaziorako Zuzendaritza; Lehendakaritza.
Gobierno Vasco – Eusko Jaurlaritza

Licencia con arreglo a la EUPL, Versión 1.1 o –en cuanto sean aprobadas por la Comisión Europea– versiones posteriores de la EUPL (la Licencia); Solo podrá usarse esta obra si se respeta la Licencia. Puede obtenerse una copia de la Licencia en: ec.europa.eu/idabc/eupl Salvo cuando lo exija la legislación aplicable o se acuerde por escrito, el programa distribuido con arreglo a la Licencia se distribuye TAL CUAL, SIN GARANTÍAS NI CONDICIONES DE NINGÚN TIPO, ni expresas ni implícitas. Véase la Licencia en el idioma concreto que rige los permisos y limitaciones que establece la Licencia

http://open.irekia.net, openirekia@efaber.net

Public Instance Methods

area_select(area_id, options={}) click to toggle source
# File app/helpers/admin/documents_helper.rb, line 47
def area_select(area_id, options={})
  areas = Area.find(:all, :order => 'position').collect {|a| [a.name, a.id]}
  if options[:include_blank]
    areas = [["#{I18n.t('elige')}...", 0]] + areas
  end
  options_for_select(areas, area_id)
end
can_download_big_photos(document) click to toggle source
# File app/helpers/admin/documents_helper.rb, line 112
def can_download_big_photos(document)
  document.open_in_agencia? || (logged_in? && (User::STAFF + ["Journalist", "Colaborator"]).include?(current_user.class.to_s))
end
debate_info(doc) click to toggle source
# File app/helpers/admin/documents_helper.rb, line 116
def debate_info(doc)
  doc_type = doc.type.to_s.downcase
  content_tag(:span, t("admin.debates.#{doc_type}_info", :debate => link_to(doc.debate.title, admin_debate_path(doc.debate))), :class => "debate_#{doc_type}_notice")
end
dept_select(dept_id, options={}) click to toggle source
# File app/helpers/admin/documents_helper.rb, line 31
def dept_select(dept_id, options={})
  txt = ""
  if options[:include_blank]
    txt << "<option value=''>#{options[:blank_text] || "#{I18n.t('elige')}..."}</option>"
  end
  Department.active.grouped_options.each do |opt_group|
    txt << "<optgroup>"
    txt << "<option value='#{opt_group[0][1]}' #{"selected" if opt_group[0][1].to_i.eql?(dept_id.to_i)}>#{opt_group[0][0]}</option>"
    opt_group[1].each do |dept|
      txt << "<option value='#{dept[1]}' #{"selected" if dept[1].to_i.eql?(dept_id.to_i)}>&nbsp;&nbsp;&nbsp;#{dept[0]}</option>"
    end
    txt << "</optgroup>"
  end
  txt
end
dept_title(doc) click to toggle source
# File app/helpers/admin/documents_helper.rb, line 55
def dept_title(doc)
  doc.organization.is_a?(Department) ? t("organizations.department") : t("organizations.organism")
end
dummy_field(txt, obj, method) click to toggle source
# File app/helpers/admin/documents_helper.rb, line 59
def dummy_field(txt, obj, method)
  text = ""
  if obj.errors.on(method)
    text += content_tag(:span, txt, :class => 'field_with_errors')
    text += content_tag(:span, obj.errors.on(method).to_a.join(", ").gsub(/^(\w)/) {|m| m.upcase}, :class => 'error_message')
  else
    text = txt
  end
  text
end
init_prototype_tooltip() click to toggle source
# File app/helpers/admin/documents_helper.rb, line 104
def init_prototype_tooltip
  content_for :head do
   stylesheet_link_tag('admin/tooltip')+
   javascript_include_tag('prototype/tooltip')+
   javascript_tag("Event.observe(window, 'load', function(evt){var ttip = new ToolTip('a.link_with_tip')});")
  end
end
politicians_and_speakers_text(doc) click to toggle source

Texto para los asistentes: salen los políticos con sus cargos y los demás asistentes Se usa en los views de AM.

# File app/helpers/admin/documents_helper.rb, line 85
def politicians_and_speakers_text(doc)
  txt = [politicians_with_roles(doc), doc.speaker].compact.join(", ")
  txt
end
politicians_with_roles(doc) click to toggle source

Lista de los políticos con sus cargos públicos

# File app/helpers/admin/documents_helper.rb, line 79
def politicians_with_roles(doc)
  doc.politicians.map {|politician| content_tag(:span, politician.public_name, :class => 'politician_name')+" "+content_tag(:span, "(#{politician.public_role})", :class => 'politician_role')}.join(", ")
end
pretty_translated(doc, lang_code) click to toggle source
# File app/helpers/admin/documents_helper.rb, line 23
def pretty_translated(doc, lang_code)
  doc.translated_to?(lang_code) ? "Traducido" : "Sin traducir"
end
published_info(doc) click to toggle source

Devuelve el texto que indica dónde está publicado el documento.

# File app/helpers/admin/documents_helper.rb, line 71
def published_info(doc)
  places = []
  places.push("Irekia") if doc.is_public?
  
  return "#{t('en')} #{places.join(' ' + t('y') + ' ')}"
end
si_o_no(val) click to toggle source
# File app/helpers/admin/documents_helper.rb, line 27
def si_o_no(val)
  val ? t('si') : t('not')
end
tags_with_kind_text(doc) click to toggle source

Lista de los tags con clase que indica el tipo del tag.

# File app/helpers/admin/documents_helper.rb, line 91
def tags_with_kind_text(doc)
  tag = doc.tags.collect { |tag| content_tag(:span, tag.name, :class => "tag #{tag_class(tag)}" )}.join(' ')
  legend = "<br/><span class='tag_legend'><b>Leyenda:</b>
      <span class='tag_departamento'>Departamento</span>
      <span class='tag_area'>Área</span>
      <span class='tag_politico'>Político</span>
      <span class='tag_persona'>Persona</span>
      <span class='tag_entidad'>Entidad</span>
      <span class='tag_oculto'>Oculto</span>
    </span>"
  return tag+legend
end