module NewsHelper

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

get_photo_orientation(photo) click to toggle source
# File app/helpers/news_helper.rb, line 55
def get_photo_orientation(photo)
  size = get_photo_size(photo)
  if size[0] > size[1]
    'landscape'
  else
    'portrait'
  end
end
get_photo_size(photo) click to toggle source
# File app/helpers/news_helper.rb, line 47
def get_photo_size(photo)            
  begin
    size = photo.respond_to?('url') ? Paperclip::Geometry.from_file(photo.path).to_s.split('x') : Paperclip::Geometry.from_file(photo).to_s.split('x')
  rescue
    size = [0,0]  
  end
end
readspeaker_locale() click to toggle source
# File app/helpers/news_helper.rb, line 23
def readspeaker_locale
  case I18n.locale
  when 'es'
    'es_es'
  when 'eu'
    'eu_es'
  when 'en'
    'en_uk'
  end
end
render_rss_enclosure(document) click to toggle source
# File app/helpers/news_helper.rb, line 34
def render_rss_enclosure(document)  
  {"url" => url_to_attachment(document.cover_photo.url), "length" => document.cover_photo_file_size, "type" => document.cover_photo_content_type} 
end
url_to_attachment(attach_path) click to toggle source
# File app/helpers/news_helper.rb, line 38
def url_to_attachment(attach_path)
  request.protocol + request.host_with_port + attach_path.gsub(/.*(\?[0-9]*)/){|a| a.gsub($1, '')}
end