Clean the parsers code

This commit is contained in:
Christophe Vilayphiou committed 2012-05-13 19:32:05 +08:00
1 parent 803253ebcf
commit 82fa85def8
6 files changed
+70 -128

No files matched your search

+2 -2
View File
@@ -95,9 +95,9 @@ class ApplicationController < ActionController::Base
end
# Render the page
def render_page(param={})
def render_page
if @item
render :text => process_page(@item, param[:id], param), :layout => 'page_layout'
render :text => parse_page_noko(@item), :layout => 'page_layout'
else
render :text => '404 Not Found'
end
+11 -9
View File
@@ -19,7 +19,7 @@ class PagesController < ApplicationController
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
case @item._type
when 'Page'
render_page(params)
render_page
when 'Link'
redirect_to "http://#{@item[:url]}"
end
@@ -32,17 +32,19 @@ class PagesController < ApplicationController
end
def index_from_link
if params[:page]
redirect_to "/#{@item.path}?page=#{params[:page]}&category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}"
else
redirect_to "/#{@item.path}?category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}"
end
url = "/#{@item.path}"
options = ''
options << "?page=#{params[:page]}" unless params[:page].blank?
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
redirect_to url + options
end
def show_from_link
# debugger
# a=1
redirect_to "/#{@item.path}?id=#{params[:id]}&preview=#{params[:preview]}"
url = "/#{@item.path}?id=#{params[:id]}"
options = ''
options << "&preview=#{params[:preview]}" unless params[:preview].blank?
redirect_to url + options
end
def load_orbit_bar