fixed Widget data count should be available for other widgets, not only for default widget. The availability of this option must be set in the init

This commit is contained in:
Fu Matthew 2013-02-23 15:19:04 +08:00 committed by chris
parent 0e6599e9b9
commit d7699e1a46
3 changed files with 18 additions and 13 deletions

View File

@ -2,11 +2,9 @@
<% when PagePart %> <% when PagePart %>
<% object_name = 'page_part' %> <% object_name = 'page_part' %>
<% field_name = 'widget_field' %> <% field_name = 'widget_field' %>
<% data_count = 'widget_data_count' %>
<% when Page %> <% when Page %>
<% object_name = 'page' %> <% object_name = 'page' %>
<% field_name = 'frontend_field' %> <% field_name = 'frontend_field' %>
<% data_count = 'frontend_data_count' %>
<% end %> <% end %>
<div class="style_switch control-group"> <div class="style_switch control-group">
@ -41,16 +39,5 @@
</span> </span>
</div><br/> </div><br/>
<% end %> <% end %>
<br/>
<div class="rows clear">
<span class="span4">
<%= label_tag t("default_widget.widget_data_count") %>
</span>
</div>
<div class="rows clear">
<span class="span4">
<%= text_field_tag "#{object_name}[#{data_count}]",object.send(data_count) %>
</span>
</div>
</div> </div>
</div> </div>

View File

@ -45,3 +45,12 @@
<div id="widget_setting"> <div id="widget_setting">
<%= render :partial => 'widget_setting' ,:locals=>{:f=>f,:object=>@part} %> <%= render :partial => 'widget_setting' ,:locals=>{:f=>f,:object=>@part} %>
</div> </div>
<div class="control-group">
<label for="page_part[widget_data_count]" class="control-label">
<%= t("default_widget.widget_data_count") %>
</label>
<div class="controls">
<%= text_field_tag "page_part[widget_data_count]",@part.widget_data_count %>
</div>
</div>

View File

@ -66,6 +66,15 @@
<%= render :partial => 'frontend_setting', :locals=>{:object=>@item,:f=>f} %> <%= render :partial => 'frontend_setting', :locals=>{:object=>@item,:f=>f} %>
</div> </div>
<div class="control-group">
<label for="page[widget_data_count]" class="control-label">
<%= t("default_widget.widget_data_count") %>
</label>
<div class="controls">
<%= text_field_tag "page[frontend_data_count]",@item.frontend_data_count %>
</div>
</div>
<div class="control-group"> <div class="control-group">
<%= f.label :is_published, "#{t('front_page.is_published')} ?", :class => 'control-label' %> <%= f.label :is_published, "#{t('front_page.is_published')} ?", :class => 'control-label' %>