Add order fields for cateogies setting.
This commit is contained in:
1 parent
ffff41153c
commit
ec1ff2051a
4 files changed
+65
-15
No files matched your search
@@ -115,7 +115,11 @@ class AsksController < ApplicationController
|
||||
if @layout_type == 'index'
|
||||
module_app = ModuleApp.where(:key => "ask").first
|
||||
categories = Array(Category.find(OrbitHelper.page_categories)) rescue ['all']
|
||||
categories = module_app.categories if categories.include? 'all'
|
||||
if categories.include? 'all'
|
||||
categories = module_app.categories.enabled
|
||||
else
|
||||
categories = categories & module_app.categories.enabled
|
||||
end
|
||||
ask_settings = AskCategorySetting.where(:category_id.in=> categories.collect{|v| v.id.to_s}).to_a
|
||||
if ask_settings.count != categories.count
|
||||
ask_settings = [AskSetting.first]+ask_settings
|
||||
@@ -251,7 +255,7 @@ class AsksController < ApplicationController
|
||||
end
|
||||
private
|
||||
def cal_form_from_setting(ask_setting,categories,show_categories=false,filter_fields=nil)
|
||||
disp_fields_infos = AskSetting.get_disp_fields_infos
|
||||
disp_fields_infos = AskSetting.get_disp_fields_infos(ask_setting.class == AskCategorySetting ? ask_setting.category_id : nil)
|
||||
if filter_fields
|
||||
disp_fields_infos = disp_fields_infos.select{|field, info| filter_fields.include?(field)}
|
||||
end
|
||||
@@ -261,12 +265,10 @@ class AsksController < ApplicationController
|
||||
tmp_ask_cat_id = (tmp_type == 1) ? ask_setting.id.to_s : ""
|
||||
disp_fields_infos.each do |field, info|
|
||||
if field.include?("default@")
|
||||
if tmp_type == 0
|
||||
k = field[8..-1]
|
||||
v = ask_setting.custom_fields[k]
|
||||
if v
|
||||
defalt_fields << {'label'=>ask_label(v['field'][I18n.locale],v['required']),'content'=>show_on_front(k,v)}
|
||||
end
|
||||
k = field[8..-1]
|
||||
v = ask_setting.custom_fields[k]
|
||||
if v
|
||||
defalt_fields << {'label'=>ask_label(v['field'][I18n.locale],v['required']),'content'=>show_on_front(k,v)}
|
||||
end
|
||||
elsif field.include?("custom@") && tmp_ask_cat_id != ""
|
||||
if tmp_type == 1 && field.include?(tmp_ask_cat_id)
|
||||
|
||||
Reference in new issue
Block a user