class DebatesController

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

compress() click to toggle source

Devuelve un archivo zip con todas las fotos o vídeos del documento

# File app/controllers/debates_controller.rb, line 80
def compress
  @debate = Debate.published.find(params[:id])
  @w = params[:w] || 'photos'  
  if @debate.send("zip_#{@w}")
    send_file(@debate.send("zip_#{@w}_file"))
  else                                   
    flash[:error] = t('documents.error_zip')
    redirect_to debate_url(:id => @debate.id)
  end  
end
department() click to toggle source
# File app/controllers/debates_controller.rb, line 91
def department
  @department = Department.find(params[:id])
  @feed_title = t('debates.feed_title', :name => @department.name)
  organization_ids = [@department.id] + @department.organization_ids
  @debates = Debate.published.translated.find :all, 
    :conditions => "organization_id in (#{organization_ids.join(',')})",
    :order => 'published_at DESC', :limit => 10
  render :action => "index.rss", :layout => false
end
index() click to toggle source
# File app/controllers/debates_controller.rb, line 27
def index
  prepare_debates
  
  respond_to do |format|
    format.html do
      if request.xhr?
        render :partial => '/shared/grid_items', :locals => {:items => @debates}, :layout => false
      else
        render
      end
    end
    format.rss do
      @feed_title = t('debates.feed_title', :name => @context ? @context.name : t('site_name'))
      render :layout => false        
    end
  end
end
show() click to toggle source
# File app/controllers/debates_controller.rb, line 45
def show 
  begin 
    @debate = Debate.published.find(params[:id])
  rescue ActiveRecord::RecordNotFound
    @debate = Debate.find(params[:id])
    if @debate.present? && !(logged_in? && is_admin?)
      raise ActiveRecord::RecordNotFound and return
    end
  end
  
  @title = @debate.title
  
  @stage = if params[:stage]
    @debate.stages.find_by_label(params[:stage]).present? ? @debate.stages.find_by_label(params[:stage]) : @debate.current_stage
  else  
    @debate.current_stage
  end
  if @stage.label.eql?('conclusions') && @debate.news.present? && @debate.news.published?
    @document = @debate.news
    get_news_videos_and_photos(@document)
    @comments = @document.comments.approved.paginate :page => params[:page], :per_page => 25
  elsif @stage.label.eql?('contribution') && @debate.page.present? && @debate.page.published?  
    @page = @debate.page
  elsif @stage.label.eql?('presentation')
    related_news = @debate.related_news
    @leading_news = @debate.featured_news.first
    if @leading_news
      @other_news = related_news - [@leading_news]
    else
      @leading_news, @other_news = related_news[0], related_news[1..-1]
    end
  end
end