| Module | Admin::DocumentsHelper |
| In: |
app/helpers/admin/documents_helper.rb
|
# File app/helpers/admin/documents_helper.rb, line 10
10: def dept_select(dept_id, options={})
11: txt = ""
12: if options[:include_blank]
13: txt << "<option value=''>#{options[:blank_text] || "#{I18n.t('elige')}..."}</option>"
14: end
15: Department.grouped_options.each do |opt_group|
16: txt << "<optgroup>"
17: 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>"
18: opt_group[1].each do |dept|
19: txt << "<option value='#{dept[1]}' #{"selected" if dept[1].to_i.eql?(dept_id.to_i)}> #{dept[0]}</option>"
20: end
21: txt << "</optgroup>"
22: end
23: txt
24: end
# File app/helpers/admin/documents_helper.rb, line 26
26: def dept_title(doc)
27: doc.organization.is_a?(Department) ? t("shared.Departamento") : t("shared.Organismo")
28: end
# File app/helpers/admin/documents_helper.rb, line 30
30: def dummy_field(txt, obj, method)
31: text = ""
32: if obj.errors.on(method)
33: text += content_tag(:span, txt, :class => 'field_with_errors')
34: text += content_tag(:span, obj.errors.on(method).to_a.join(", ").gsub(/^(\w)/) {|m| m.upcase}, :class => 'error_message')
35: else
36: text = txt
37: end
38: text
39: end
# File app/helpers/admin/documents_helper.rb, line 2 2: def pretty_translated(doc, lang_code) 3: doc.translated_to?(lang_code) ? "Traducido" : "Sin traducir" 4: end
Devuelve el texto que indica dónde está publicado el documento.
# File app/helpers/admin/documents_helper.rb, line 42
42: def published_info(doc)
43: places = []
44: places.push("OpenIrekia") if doc.show_in_irekia?
45: places.push("Agencia") if doc.show_in_agencia?
46:
47: return "#{t('en')} #{places.join(' ' + t('y') + ' ')}"
48: end
Muestra los enlaces para ver el documento en OpenIrekia y/o Agencia dependiendo de dónde estará visible.
# File app/helpers/admin/documents_helper.rb, line 51
51: def show_view_or_preview_links(doc)
52: txt = []
53: view_or_preview = doc.published? ? t('sadmin.news.ver') : t('sadmin.news.preview')
54: if doc.show_in_irekia?
55: txt.push content_tag(:li, link_to("#{view_or_preview} #{t('sadmin.news.en_irekia')}", send("#{doc.type.downcase}_path", doc, :locale => 'es'), :class => "public_link"))
56: end
57:
58: if doc.show_in_agencia?
59: txt.push content_tag(:li, link_to("#{view_or_preview} #{t('sadmin.news.en_agencia')}", send("ma_#{doc.type.downcase}_path", doc, :locale => 'es'), :class => "public_link"))
60: end
61:
62: txt.join(" ")
63: end