diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb
index 0e58a00f..73ddc398 100644
--- a/app/controllers/admin/pages_controller.rb
+++ b/app/controllers/admin/pages_controller.rb
@@ -1,5 +1,5 @@
class Admin::PagesController < Admin::ItemsController
-
+helper Admin::PagePartsHelper
def show
@item = Page.find(params[:id])
respond_to do |format|
diff --git a/app/helpers/admin/page_parts_helper.rb b/app/helpers/admin/page_parts_helper.rb
index 8e2951f5..3d71b9bb 100644
--- a/app/helpers/admin/page_parts_helper.rb
+++ b/app/helpers/admin/page_parts_helper.rb
@@ -9,14 +9,19 @@ module Admin::PagePartsHelper
end
end
- def widget_field_options(i)
+ def widget_field_options(i,local_item=nil)
+ local_item = @part if local_item.nil?
options = @module_app.widget_fields.collect{|widget_field| [I18n.t(widget_field[1]), widget_field[0]]}
- options_for_select(options, (@part[:widget_field][i][0] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) )
+ options_for_select(options, (local_item[:widget_field][i][0] if (local_item && !local_item[:widget_field].blank? && !local_item[:widget_field][i].blank?)) )
end
- def widget_fiield_type_options(i)
+ def widget_fiield_type_options(i,local_item=nil)
options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}
- options_for_select(options, (@part[:widget_field][i][1] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) )
+ 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?)) )
end
+
+
+
end
\ No newline at end of file
diff --git a/app/views/admin/pages/_frontend_fields.html.erb b/app/views/admin/pages/_frontend_fields.html.erb
index ce042ddd..ac4882c8 100644
--- a/app/views/admin/pages/_frontend_fields.html.erb
+++ b/app/views/admin/pages/_frontend_fields.html.erb
@@ -3,8 +3,8 @@
<%= label_tag('frontend_field & frontend_field_type') %>
<% @module_app.widget_fields.each_with_index do |frontend_field, i| %>
<%= i+1 %>
- <%= select_tag "page[frontend_field][]", options_for_select(@module_app.widget_fields.collect{|frontend_field| [frontend_field.humanize, frontend_field]}, (@item[:frontend_field][i][0] if (@item && !@item[:frontend_field].blank? && !@item[:frontend_field][i].blank?)) ), :include_blank => true %>
- <%= select_tag "page[frontend_field_type][]", options_for_select(LIST[:widget_field_type].collect{|frontend_field| [frontend_field.humanize, frontend_field]}, (@item[:frontend_field][i][1] if (@item && !@item[:frontend_field].blank? && !@item[:frontend_field][i].blank?)) ), :include_blank => true %>
+ <%= select_tag "page[frontend_field][]",widget_field_options(i,@item) , :include_blank => true %>
+ <%= select_tag "page[frontend_field_type][]", widget_fiield_type_options(i,@item), :include_blank => true %>
<% end %>
<% end %>