Fix no responding when trying to access front end page
This commit is contained in:
parent
fac4faad6c
commit
1d80b39dcb
|
@ -1,5 +1,5 @@
|
||||||
class Admin::PagesController < Admin::ItemsController
|
class Admin::PagesController < Admin::ItemsController
|
||||||
|
helper Admin::PagePartsHelper
|
||||||
def show
|
def show
|
||||||
@item = Page.find(params[:id])
|
@item = Page.find(params[:id])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -9,14 +9,19 @@ module Admin::PagePartsHelper
|
||||||
end
|
end
|
||||||
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 = @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
|
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 = 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -3,8 +3,8 @@
|
||||||
<%= label_tag('frontend_field & frontend_field_type') %>
|
<%= label_tag('frontend_field & frontend_field_type') %>
|
||||||
<% @module_app.widget_fields.each_with_index do |frontend_field, i| %>
|
<% @module_app.widget_fields.each_with_index do |frontend_field, i| %>
|
||||||
<%= i+1 %>
|
<%= 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][]",widget_field_options(i,@item) , :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 %> <br />
|
<%= select_tag "page[frontend_field_type][]", widget_fiield_type_options(i,@item), :include_blank => true %> <br />
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue