2013-01-02 06:34:34 +00:00
|
|
|
module Admin::PagePartsHelper
|
|
|
|
|
|
|
|
def support_link
|
|
|
|
url_method = @module_app.get_default_widget[:url_method]
|
|
|
|
unless url_method.nil?
|
|
|
|
res = "Link:"
|
|
|
|
res << select_tag( "page_part[widget_field_is_link][]", options_for_select([["NotLink",false],["Link1",url_method]]))
|
|
|
|
res.html_safe
|
|
|
|
end
|
|
|
|
end
|
2013-01-04 10:42:25 +00:00
|
|
|
|
2013-01-09 03:23:18 +00:00
|
|
|
def widget_field_options(i,local_item=nil)
|
|
|
|
local_item = @part if local_item.nil?
|
2013-01-04 10:42:25 +00:00
|
|
|
options = @module_app.widget_fields.collect{|widget_field| [I18n.t(widget_field[1]), widget_field[0]]}
|
2013-01-09 03:23:18 +00:00
|
|
|
options_for_select(options, (local_item[:widget_field][i][0] if (local_item && !local_item[:widget_field].blank? && !local_item[:widget_field][i].blank?)) )
|
2013-01-04 10:42:25 +00:00
|
|
|
end
|
|
|
|
|
2013-01-09 03:23:18 +00:00
|
|
|
def widget_fiield_type_options(i,local_item=nil)
|
2013-01-04 10:42:25 +00:00
|
|
|
options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}
|
2013-01-09 03:23:18 +00:00
|
|
|
local_item = @part if local_item.nil?
|
|
|
|
options_for_select(options, (local_item[:widget_field][i][1] if (local_item && !local_item[:widget_field].blank? && !local_item[:widget_field][i].blank?)) )
|
2013-01-04 10:42:25 +00:00
|
|
|
end
|
|
|
|
|
2013-01-10 10:00:58 +00:00
|
|
|
def tag_checked_value(part,radio_value)
|
|
|
|
part and (part[:tag] == radio_value) ? true : false
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def category_checked_value(part,radio_value)
|
|
|
|
part and (part[:tag] == radio_value) ? true : false
|
|
|
|
end
|
2013-01-09 03:23:18 +00:00
|
|
|
|
2013-01-10 10:00:58 +00:00
|
|
|
def style_checked_value(part,radio_value)
|
|
|
|
part and (part.widget_style == radio_value) ? true : false
|
|
|
|
end
|
2013-01-09 03:23:18 +00:00
|
|
|
|
2013-01-10 10:00:58 +00:00
|
|
|
def nil_radio_button(part,tag_or_cate)
|
|
|
|
content_tag :label,:class=>"radio inline" do
|
|
|
|
op = radio_button("page_part", tag_or_cate, nil, :checked => eval("#{tag_or_cate}_checked_value(part,nil)"))
|
|
|
|
op << I18n.t("default_widget.no_value")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def show_default_widget_setting_panel
|
|
|
|
binding.pry
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def show_custom_widget_setting_panel
|
|
|
|
end
|
2013-01-09 03:23:18 +00:00
|
|
|
|
2013-01-02 06:34:34 +00:00
|
|
|
end
|