Sha256: 76737440f4b247809b7625a11c1c1bdc08d141a6d14f6bba6800254dd6da6307

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

<%= form_for(@model) do |f| %>
  <%=@mega_bar[:app_format].app_wrapper.html_safe%>
  <%=@mega_bar[:app_format].record_wrapper.html_safe%>
  <% @mega_bar[:displayable_fields].each do | displayable_field | %>
    <% if @mega_bar[:app_format].app_format == 'profile_table' %>
      <tr><th><%=displayable_field[:field_display].header %></th>
    <% end %>
    <%= @mega_bar[:app_format].field_wrapper.html_safe%>
    <%   
      instance_value = instance_variable_get("@" + displayable_field[:field].field)
      if instance_value.present? && (displayable_field[:field].field != 'field' and params[:action] == 'edit')
          value = instance_value 
      else
        if params[:action] == 'edit' 
          value= @model.read_attribute(displayable_field[:field].field) 
        else
          value = displayable_field[:field].default_value
        end
      end
    %>
    <%=render template: displayable_field[:field_display].format.tableize + "/show", locals: {displayable_field: displayable_field, obj: @model, mega_bar: @mega_bar, value: value} %>
    <%= @mega_bar[:app_format].field_wrapper_end.html_safe %>
  <%end %>
  <%= @mega_bar[:app_format].record_wrapper_end.html_safe%>
  <tr><th>Save</th><td><%= submit_tag %></td><th></tr>
  <%=@mega_bar[:app_format].app_wrapper_end.html_safe%>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mega_bar-0.0.1 app/views/mega_bar/application/_mega_bar_write.html.erb