<%= best_in_place @mega_display[:model_display], :header, url: @model_display_path %>
<%= best_in_place @mega_display[:model_display], :instructions, url: @model_display_path, as: :textarea %>
<%=@mf.record_wrapper.html_safe%>
<% @mega_display[:displayable_fields].each do | displayable_field | %>
<%
@field_display_path = MegaBar::Engine.routes.url_for(controller: '/mega_bar/field_displays', action: 'show', id: displayable_field[:field_display].id, :only_path=> true)
%>
<% if @mf.name == 'ProfileTable' %>
<%= render partial: "mega_bar_inline_help_links", :locals => {:links => reorder_up(displayable_field, 'up')} %>
<%= best_in_place displayable_field[:field_display], :header, url: @field_display_path %>
<%= render partial: "mega_bar_inline_help_links", :locals => {:links => reorder_down(displayable_field, 'down')} %>
<% if displayable_field[:field].instructions.present? %>
<% #byebug %>
<% @field_path = MegaBar::Engine.routes.url_for(controller: '/mega_bar/fields', action: 'show', id: displayable_field[:field].id, :only_path=> true) %>
<%= best_in_place displayable_field[:field], :instructions, url: @field_path %>
<% end %>
<%= render partial: "mega_bar_help_links", :locals => {:links => field_help_links(displayable_field)} %>
|
<% end %>
<%= @mf.field_wrapper.html_safe%>
<% # figure out the value of the thing we are trying to display
instance_value = instance_variable_get("@" + displayable_field[:field].field) if (instance_variable_get("@" + displayable_field[:field].field).is_a?(String))
if instance_value.present? && (displayable_field[:field].field != 'field' and params[:action] == 'edit')
value = instance_value
else
if params[:action] == 'edit' || params[:redo]
value= @mega_instance.read_attribute(displayable_field[:field].field)
else
value = instance_value.blank? ? displayable_field[:field].default_value : instance_value
end
end
%>
<% puts displayable_field[:field_display].format.tableize %>
<%=render template: displayable_field[:field_display].format.tableize + "/show", locals: data_format_locals(@mega_instance, displayable_field, value, @mega_display)
# {displayable_field: displayable_field, obj: @mega_instance, mega_bar: @mega_display, value: value}
%>
<%= render partial: "mega_bar_help_links", :locals => {:links => data_display_help_links(displayable_field)} %>
<%= @mf.field_wrapper_end.html_safe %>
<%end %>
<%= @mf.record_wrapper_end.html_safe%>
---|