Revert "Page front end stay in the same page when a link is clicked (category)"

This reverts commit 14d856b4d6.
This commit is contained in:
chris 2013-03-19 20:00:16 +08:00
parent 14d856b4d6
commit 9cf8c2b72b
1 changed files with 3 additions and 4 deletions

View File

@ -64,11 +64,9 @@ class PagesController < ApplicationController
protected protected
def get_item def get_item
if !params[:page_id].blank? if params[:page_id]
@item = Item.find(params[:page_id]) @item = Item.find(params[:page_id])
elsif !params[:orig_page].blank? elsif params[:same_page_id]
@item = Item.find(params[:orig_page])
elsif !params[:same_page_id].blank?
@item = Item.find(params[:same_page_id]) @item = Item.find(params[:same_page_id])
else else
category_ids = params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]] category_ids = params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]
@ -82,6 +80,7 @@ class PagesController < ApplicationController
elsif !tag_ids.blank? elsif !tag_ids.blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :tag.in => tag_ids).any_in(category: [nil, []]).first @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :tag.in => tag_ids).any_in(category: [nil, []]).first
end end
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil, []]},"category" => { "$in" => [nil, []]}).first unless @item @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil, []]},"category" => { "$in" => [nil, []]}).first unless @item
@item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item @item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item