category click, event click and more button fix
This commit is contained in:
parent
17dbc747ba
commit
369bbe4d72
|
@ -70,8 +70,8 @@ class DefaultWidgetController< OrbitWidgetController
|
||||||
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:click]
|
if params[:filter_category_id] and !params[:filter_category_id].blank?
|
||||||
@data = get_more_btn_data.page(params[:page_main]).per(@data_limit)
|
@data = get_filter_data.page(params[:page_main]).per(@data_limit)
|
||||||
|
|
||||||
elsif @paginate || @search
|
elsif @paginate || @search
|
||||||
if @search
|
if @search
|
||||||
|
@ -98,10 +98,13 @@ class DefaultWidgetController< OrbitWidgetController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_more_btn_data
|
def get_filter_data
|
||||||
filterids = PagePart.find(params[:part_id]).category
|
|
||||||
model = eval(@default_widget["query"])
|
model = eval(@default_widget["query"])
|
||||||
data = model.where(:category_id.in => filterids)
|
if params[:filter_category_id].is_a? Array
|
||||||
|
data = model.where(:category_id.in => params[:filter_category_id])
|
||||||
|
elsif params[:filter_category_id].is_a? String
|
||||||
|
data = model.where(:category_id => params[:filter_category_id])
|
||||||
|
end
|
||||||
data.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
|
data.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -65,24 +65,24 @@ class PagesController < ApplicationController
|
||||||
options = ''
|
options = ''
|
||||||
options << "#{options.blank? ? '?' : '&'}page_main=#{params[:page_main]}" unless params[:page_main].blank?
|
options << "#{options.blank? ? '?' : '&'}page_main=#{params[:page_main]}" unless params[:page_main].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}click=#{params[:click]}" unless params[:click].blank?
|
options << "#{options.blank? ? '?' : '&'}click=#{params[:click]}" unless params[:click].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}part_id=#{params[:page_part_id]}" unless params[:page_part_id].blank?
|
# options << "#{options.blank? ? '?' : '&'}part_id=#{params[:page_part_id]}" unless params[:page_part_id].blank?
|
||||||
|
|
||||||
if params[:category_id].is_a? Array
|
if params[:category_id].is_a? Array
|
||||||
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('category_id',params[:category_id])}" unless params[:category_id].blank?
|
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('filter_category_id',params[:category_id])}" unless params[:category_id].blank?
|
||||||
elsif params[:category_id].is_a? String
|
elsif params[:category_id].is_a? String
|
||||||
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
options << "#{options.blank? ? '?' : '&'}filter_category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:tag_id].is_a? Array
|
if params[:tag_id].is_a? Array
|
||||||
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id',params[:tag_id])}" unless params[:tag_id].blank?
|
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('filter_tag_id',params[:tag_id])}" unless params[:tag_id].blank?
|
||||||
elsif params[:category_id].is_a? String
|
elsif params[:category_id].is_a? String
|
||||||
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
options << "#{options.blank? ? '?' : '&'}filter_tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
|
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
|
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
|
||||||
uri = URI::escape(url + options)
|
# uri = URI::escape(url + options)
|
||||||
|
uri = url + options
|
||||||
#uri = URI::escape("#{url}?" + params.collect{|k,v| "#{k}=#{v}"}.join('&'))
|
#uri = URI::escape("#{url}?" + params.collect{|k,v| "#{k}=#{v}"}.join('&'))
|
||||||
redirect_to(uri)unless save_from_no_lang_for_page
|
redirect_to(uri)unless save_from_no_lang_for_page
|
||||||
end
|
end
|
||||||
|
@ -168,17 +168,33 @@ class PagesController < ApplicationController
|
||||||
# end
|
# end
|
||||||
# @item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
# @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.root.children.where(:module_app_id => module_app.id).first
|
||||||
# @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
|
||||||
# end
|
# end
|
||||||
# raise PageError,'Missing Frontend Page' if @item.nil?
|
# raise PageError,'Missing Frontend Page' if @item.nil?
|
||||||
|
|
||||||
if params[:page_id]
|
if params[:page_id]
|
||||||
@item = Item.find(params[:page_id])
|
@item = Item.find(params[:page_id])
|
||||||
elsif params[:same_page_id]
|
elsif params[:same_page_id]
|
||||||
@item = Item.find(params[:same_page_id])
|
@item = Item.find(params[:same_page_id])
|
||||||
else
|
else
|
||||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||||
@item = Item.root.children.where(:module_app_id => module_app.id).first
|
category_ids = params[:category_id] ? (params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]) : []
|
||||||
|
tag_ids = params[:tag_id].is_a?(Array) ? params[:tag_id] : [params[:tag_id]]
|
||||||
|
|
||||||
|
if !category_ids.blank?
|
||||||
|
@item = Item.where(:category => category_ids).first
|
||||||
|
else
|
||||||
|
if params[:action] && params[:action] == "show_from_link"
|
||||||
|
default_widget = module_app.get_default_widget
|
||||||
|
model = eval(default_widget["query"])
|
||||||
|
item = model.find(params[:id])
|
||||||
|
@item = Item.where(:category => [item.category_id.to_s]).first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@item = Item.root.children.where(:module_app_id => module_app.id).first unless @item
|
||||||
end
|
end
|
||||||
raise PageError,'Missing Frontend Page' if @item.nil?
|
raise PageError,'Missing Frontend Page' if @item.nil?
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,6 @@ module DefaultWidgetTagHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
params_str = params_str + (params_str.eql?("?") ? params.to_param : "&#{params.to_param}" )
|
params_str = params_str + (params_str.eql?("?") ? params.to_param : "&#{params.to_param}" )
|
||||||
params_str = params_str + "&click=more_btn&page_part_id=#{@params[:part_id]}"
|
|
||||||
content_tag :div,:class=> 'more' do
|
content_tag :div,:class=> 'more' do
|
||||||
link_to I18n.t(@more_link[:label_i18n]),[eval("#{@more_link[:path_method]}"),params_str].join()
|
link_to I18n.t(@more_link[:label_i18n]),[eval("#{@more_link[:path_method]}"),params_str].join()
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,6 @@ module ParserFrontEnd
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_page_content(page,args={})
|
def parse_page_content(page,args={})
|
||||||
|
|
||||||
args["category_id"] = args["category_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if !args["category_id"].blank? and args["category_id"].is_a?(String)
|
args["category_id"] = args["category_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if !args["category_id"].blank? and args["category_id"].is_a?(String)
|
||||||
args["tag_id"] = args["tag_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if !args["tag_id"].blank? and args["tag_id"].is_a? String
|
args["tag_id"] = args["tag_id"].gsub(/\"|\[|\]/,'').split(",").each(&:strip!) if !args["tag_id"].blank? and args["tag_id"].is_a? String
|
||||||
# tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
# tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
||||||
|
@ -48,7 +47,9 @@ module ParserFrontEnd
|
||||||
ret = ''
|
ret = ''
|
||||||
part = PagePart.find(front['part_id']) if front['part_id']
|
part = PagePart.find(front['part_id']) if front['part_id']
|
||||||
ret << eval("\"#{front['path']}\"") rescue ''
|
ret << eval("\"#{front['path']}\"") rescue ''
|
||||||
ret << (ret.include?("?") ? "&#{args.to_param}" : "?#{args.to_param}") if args.present?
|
ar = args.to_param
|
||||||
|
ar = URI.unescape(ar)
|
||||||
|
ret << (ret.include?("?") ? "&#{ar}" : "?#{ar}") if args.present?
|
||||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
||||||
end
|
end
|
||||||
front.swap(fragment)
|
front.swap(fragment)
|
||||||
|
|
|
@ -23,8 +23,8 @@ class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
|
|
||||||
# @web_link_categorys = get_categories_for_index
|
# @web_link_categorys = get_categories_for_index
|
||||||
if !params[:category_id].blank?
|
if !params[:filter_category_id].blank?
|
||||||
@web_link_categorys = @module_app.categories.enabled.any_in(:_id => params[:category_id])
|
@web_link_categorys = @module_app.categories.enabled.any_in(:_id => params[:filter_category_id])
|
||||||
else
|
else
|
||||||
@web_link_categorys = @module_app.categories.enabled
|
@web_link_categorys = @module_app.categories.enabled
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue