merger select options for widget
This commit is contained in:
parent
25be05e5d1
commit
7b4f271fcc
|
@ -412,38 +412,39 @@ class AnnouncementsController < ApplicationController
|
||||||
@show_options = modile_app.show_options rescue nil
|
@show_options = modile_app.show_options rescue nil
|
||||||
end
|
end
|
||||||
subpart.select_options.each do |select_option|
|
subpart.select_options.each do |select_option|
|
||||||
if !(@show_options.nil?) && select_option.field_name == @show_options.keys[1].to_s
|
if !(@show_options.nil?)
|
||||||
value = YAML.load(select_option.value)
|
value = YAML.load(select_option.value)
|
||||||
tmp = value[:en]
|
tmp = value[:en]
|
||||||
I18n.with_locale(:en) do
|
I18n.with_locale(:en) do
|
||||||
tab_options.each_with_index do |option,i|
|
case select_option.field_name
|
||||||
if tmp == t("announcement.#{option}")
|
when @show_options.keys[0].to_s
|
||||||
@tab_option = i
|
if tmp == t('announcement.small_size')
|
||||||
break
|
@image_version = 'thumb'
|
||||||
|
elsif tmp == t('announcement.medium_size')
|
||||||
|
@image_version = 'mobile'
|
||||||
|
elsif tmp == t('announcement.orignal_size')
|
||||||
|
@image_version = 'orignal'
|
||||||
end
|
end
|
||||||
end
|
when @show_options.keys[1].to_s
|
||||||
end
|
tab_options.each_with_index do |option,i|
|
||||||
end
|
if tmp == t("announcement.#{option}")
|
||||||
if !(@show_options.nil?) && select_option.field_name == @show_options.keys[2].to_s
|
@tab_option = i
|
||||||
value = YAML.load(select_option.value)
|
break
|
||||||
tmp = value[:en]
|
end
|
||||||
I18n.with_locale(:en) do
|
|
||||||
read_more_options.each_with_index do |option,i|
|
|
||||||
if tmp == t("announcement.#{option}")
|
|
||||||
@read_more_option = i
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
when @show_options.keys[2].to_s
|
||||||
end
|
read_more_options.each_with_index do |option,i|
|
||||||
end
|
if tmp == t("announcement.#{option}")
|
||||||
if !(@show_options.nil?) && select_option.field_name == @show_options.keys[3].to_s
|
@read_more_option = i
|
||||||
value = YAML.load(select_option.value)
|
break
|
||||||
tmp = value[:en]
|
end
|
||||||
I18n.with_locale(:en) do
|
end
|
||||||
all_setting_options.each_with_index do |option,i|
|
when @show_options.keys[3].to_s
|
||||||
if tmp == t("announcement.#{option}")
|
all_setting_options.each_with_index do |option,i|
|
||||||
@all_setting_option = i
|
if tmp == t("announcement.#{option}")
|
||||||
break
|
@all_setting_option = i
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -458,7 +459,6 @@ class AnnouncementsController < ApplicationController
|
||||||
subpart = OrbitHelper.get_current_widget
|
subpart = OrbitHelper.get_current_widget
|
||||||
widget_data_count = OrbitHelper.widget_data_count
|
widget_data_count = OrbitHelper.widget_data_count
|
||||||
anns_cache = AnnsCache.where(parent_id: subpart.id.to_s + cats.to_s + tags.to_s + widget_data_count.to_s,locale: I18n.locale.to_s)
|
anns_cache = AnnsCache.where(parent_id: subpart.id.to_s + cats.to_s + tags.to_s + widget_data_count.to_s,locale: I18n.locale.to_s)
|
||||||
set_image_version_for_widget()
|
|
||||||
devide_flag = (!(defined? SiteFeed).nil?)
|
devide_flag = (!(defined? SiteFeed).nil?)
|
||||||
anns_cache.where(:invalid_date.lte => Time.now).destroy
|
anns_cache.where(:invalid_date.lte => Time.now).destroy
|
||||||
count = anns_cache.count
|
count = anns_cache.count
|
||||||
|
|
|
@ -20,30 +20,6 @@ module AnnouncementsHelper
|
||||||
end
|
end
|
||||||
'#'+comp.join
|
'#'+comp.join
|
||||||
end
|
end
|
||||||
def set_image_version_for_widget
|
|
||||||
subpart = OrbitHelper.get_current_widget
|
|
||||||
@image_version = 'thumb'
|
|
||||||
if subpart.methods.include? 'select_options'.to_sym
|
|
||||||
ModuleApp.all.select{|tmp| tmp.key.to_s=='announcement'}.each do |modile_app|
|
|
||||||
@show_options = modile_app.show_options rescue nil
|
|
||||||
end
|
|
||||||
subpart.select_options.each do |select_option|
|
|
||||||
if !(@show_options.nil?) && select_option.field_name == @show_options.keys.first.to_s
|
|
||||||
value = YAML.load(select_option.value)
|
|
||||||
tmp = value[:en]
|
|
||||||
I18n.with_locale(:en) do
|
|
||||||
if tmp == t('announcement.small_size')
|
|
||||||
@image_version = 'thumb'
|
|
||||||
elsif tmp == t('announcement.medium_size')
|
|
||||||
@image_version = 'mobile'
|
|
||||||
elsif tmp == t('announcement.orignal_size')
|
|
||||||
@image_version = 'orignal'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
def data_to_human_type(a,set_tag_ids=nil)
|
def data_to_human_type(a,set_tag_ids=nil)
|
||||||
statuses = a.statuses_with_classname.collect do |status|
|
statuses = a.statuses_with_classname.collect do |status|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue