| Class | PagesController |
| In: |
app/controllers/pages_controller.rb
|
| Parent: | ApplicationController |
Listado de páginas
# File app/controllers/pages_controller.rb, line 6
6: def index
7: @title = t('documents.Pages')
8: @pages = Page.published.paginate :page => params[:page], :order => 'published_at DESC'
9: respond_to do |format|
10: format.html
11: format.rss {render :layout => false}
12: end
13: end
Vista de una página
# File app/controllers/pages_controller.rb, line 16
16: def show
17: begin
18: @page = Page.published.find(params[:id])
19: rescue ActiveRecord::RecordNotFound
20: if is_admin?
21: @page = Page.find(params[:id])
22: else
23: raise ActiveRecord::RecordNotFound
24: end
25: end
26:
27: if @category
28: # Comprobar que la categoria y el documento estan relacionados
29: if @page.tags.private.collect(&:name_es) & @category.tags.private.collect(&:name_es) == []
30: logger.info "Categoria y documento no relacionados"
31: raise ActiveRecord::RecordNotFound
32: end
33: end
34: @title = @page.title
35:
36: # Páginas con flash de la categoría qué es irekia
37: if @page.tag_list.include?('_flash')
38: @flash_page = true
39: @title = t('flash.que_es_irekia')
40: end
41: respond_to do |format|
42: format.html { render }
43: format.floki { render }
44: format.ipad { render :action => "show.floki", :layout => "application.floki" }
45: end
46:
47: end