Fixed gallery and video widgets

This commit is contained in:
saurabhbhatia 2013-11-07 10:59:00 +08:00
parent 8c532e7241
commit 4e706fab0c
4 changed files with 41 additions and 1 deletions

View File

@ -3,4 +3,25 @@
<div class="controls">
<%= select 'page_part', 'widget_style', @frontend_styles, {:selected => (@part && @part[:widget_style])}, class: "input-xlarge" %>
</div>
</div>
<div class="control-group input-content">
<% @module_app.widget_options.tap { |widget|%>
<% widget.each { |w|%>
<% w.get_options.each do |key, settings| %>
<% options = settings[:opts] %>
<%= label_tag(t(settings[:label_i18n], :class=>"control-label muted"))%>
<% case options%>
<% when Hash%>
<div class="controls">
<%= select_tag "page_part[widget_options][#{key}]", options_from_collection_for_select(eval(options["query"]), options["value"], options["label"].to_s, :selected => (@part.widget_options[key] rescue nil)), class: "input-xlarge" %>
</div>
<% else%>
<div class="controls">
<%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)), class: "input-xlarge" %>
<% end %>
</div>
<% end %>
<% } %>
<% } %>
</div>

View File

@ -0,0 +1,18 @@
<% if (not(@selected[:module_app].widget_options(@selected[:app_frontend_url]).blank?) and @selected[:app_frontend_url]!='default_widget')%>
<% @selected[:module_app].widget_options(@selected[:app_frontend_url]).get_options.each do |key,settings| %>
<% options = settings[:opts] %>
<%= label_tag(t(settings[:label_i18n]))%>
<% case options%>
<% when Hash%>
<%= select_tag "page_part[widget_options][#{key}]", options_from_collection_for_select(eval(options["query"]), options["value"], options["label"].to_s, :selected => (@part.widget_options[key] rescue nil)) %>
<% else%>
<%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)) %>
<!-- (@part[:widget_field][i][0] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ) -->
<% end %>
<% end %>
<% end %>

View File

@ -34,7 +34,7 @@ module Gallery
customize_widget "widget1" do
widget_i18n "gallery.widget.widget1"
style []
style ["1","2"]
options "vertical",:i18n => "gallery.widget_option.vertical",:options_item=>[1, 2]
options "horizontal",:i18n => "gallery.widget_option.horizontal",:options_item=>[1, 2,3,4,5,6]
options "album_id",:i18n =>"gallery.album",:options_item => {"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}

View File

@ -50,6 +50,7 @@ module Videos
#* customize_widget_options_fields_i18n({"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.album"}} )
customize_widget "channel_videos" do
widget_i18n "videos.widget.channel_videos"
style ["1","2"]
options "channel_videos",:i18n =>"videos.channel_videos",:options_item => {"query"=>"ChannelVideo.all", "value"=>:id, "label"=>:channel_name}
end