From 9cf8c2b72b4c9ce1ffb3bb395550867262e7a117 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 19 Mar 2013 20:00:16 +0800 Subject: [PATCH] Revert "Page front end stay in the same page when a link is clicked (category)" This reverts commit 14d856b4d612af9be3c1845b98352b3fa55fc810. --- app/controllers/pages_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 2aeb9a5a..123922a1 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -64,11 +64,9 @@ class PagesController < ApplicationController protected def get_item - if !params[:page_id].blank? + if params[:page_id] @item = Item.find(params[:page_id]) - elsif !params[:orig_page].blank? - @item = Item.find(params[:orig_page]) - elsif !params[:same_page_id].blank? + elsif params[:same_page_id] @item = Item.find(params[:same_page_id]) else 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? @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 + @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: 'default_widget').first unless @item @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item