diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 573b1914..7bcd90e0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -101,10 +101,10 @@ class ApplicationController < ActionController::Base end # Render the page - def render_page + def render_page(args=nil) if @item respond_to do |format| - format.html { render :text => parse_page_content(@item), :layout => 'page_layout' } + format.html { render :text => parse_page_content(@item,args), :layout => 'page_layout' } format.rss { render_main_rss } format.mobile { redirect_to mobile_path(:app => params[:app]) } end diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb index c8b4eddd..47505dc1 100644 --- a/app/controllers/default_widget_controller.rb +++ b/app/controllers/default_widget_controller.rb @@ -41,7 +41,8 @@ class DefaultWidgetController< OrbitWidgetController def default_widget if !params[:id].blank? - redirect_to eval("#{@page_part.module_app.widget_fields_link_method[:title][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})") + clicked_field_name = params["clicked_field_name"].to_sym + redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})") else @tag_class = nil @default_widget = @page_part.module_app.get_default_widget diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 123922a1..058b1843 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -14,14 +14,18 @@ class PagesController < ApplicationController end end - def show + def show #begin @item = Item.first(:conditions => {:path => params[:page_name]}) if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) impressionist(@item) case @item.class.to_s when 'Page' - render_page unless save_from_no_lang_for_page + if params[:clicked_field_name] + render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page + else + render_page unless save_from_no_lang_for_page + end when 'Link' redirect_to(@item[:url]) unless save_from_no_lang_for_page end @@ -54,6 +58,7 @@ class PagesController < ApplicationController options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank? options << "#{options.blank? ? '?' : '&'}preview=#{params[:preview]}" unless params[:preview].blank? options << "#{options.blank? ? '?' : '&'}controller_action=#{params[:controller_action]}" unless params[:controller_action].blank? + options << "#{options.blank? ? '?' : '&'}clicked_field_name=#{params[:clicked_field_name]}" unless params[:clicked_field_name].blank? redirect_to(url + options) unless save_from_no_lang_for_page end diff --git a/app/helpers/default_widget_helper.rb b/app/helpers/default_widget_helper.rb index c0f55452..32fccb20 100644 --- a/app/helpers/default_widget_helper.rb +++ b/app/helpers/default_widget_helper.rb @@ -6,6 +6,8 @@ module DefaultWidgetHelper def link_to_field(row_data,field, switch, options=nil) method_ary = @page_part.module_app.widget_fields_link_method field = field.to_sym + options = options || {} + options[:clicked_field_name] = field if(method_ary.has_key?(field) and (switch.to_s == "true")) url = case method_ary[field][:args] when nil # no args diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index d2f8b7b2..044f9b9a 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -242,7 +242,7 @@ module ParserCommon categories_str = "{categories_str}" unless categories_str.blank? tags_str = "{tags_str}" unless tags_str.blank? - ret << "?inner=true&page_id=#{page.id}#{categories_str}#{tags_str}&preview=#{params[:preview]}&page_main=#{params[:page_main]}&search_query=#{params[:search_query]}&name=#{params[:name]}&item_type=page" + ret << "?inner=true&page_id=#{page.id}#{categories_str}#{tags_str}&preview=#{params[:preview]}&page_main=#{params[:page_main]}&search_query=#{params[:search_query]}&clicked_field_name=#{params[:clicked_field_name]}&name=#{params[:name]}&item_type=page" ret << "'>" else part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil @@ -270,7 +270,7 @@ module ParserCommon categories_str = "{categories_str}" unless categories_str.blank? tags_str = "{tags_str}" unless tags_str.blank? - options = "&part_id=#{part.id}#{categories_str}#{tags_str}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&item_type=page_part" + options = "&part_id=#{part.id}#{categories_str}#{tags_str}&page=#{params[:page]}&search_query=#{params[:search_query]}&clicked_field_name=#{params[:clicked_field_name]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&item_type=page_part" ret << "
" when 'public_r_tag' ret << "