-# The following are all available to you here: -# unknown - This is the model passed into the up_model method. -# This attribute is always present in any partial rendered -# by Upmin, and will always match the name of the partial -# *UNLESS* nil, true, or false are passed in. -# upmin_model - This is an Upmin::Model instantiated with unknown -# and is always present. -# -# In general, the upmin_model makes it significantly easier to -# render a view, so I suggest using it. It is way simpler than -# trying to find all associations for a model on your own. -# -# Just an FYI: upmin_model.instance == unknown .upmin-model{class: upmin_model.color} -# Display the model title as "Model # ID" %h3 = upmin_model.title %br %br %h3{style: "color: #333;"} Attributes %hr -# Create a form to wrap the attributes in. -# TODO(jon): Update the URL with a decent helper? = form_for(upmin_model.instance, url: upmin_model_path(upmin_model.path_hash), html: { method: :put }) do |f| -# Render each attribute - upmin_model.klass.attributes.each do |attribute| - any_errors = model.errors[attribute].any? .form-group{class: any_errors ? "has-error" : ""} -# = f.label(attribute.to_s) # Not using this because it drops _id and this isn't always desirable %label{for: upmin_model.attribute_form_id(attribute)} = upmin_model.attribute_label_name(attribute) - if upmin_model.attribute_type(attribute) == :string = up_attribute(upmin_model.instance, attribute, locals: { form_builder: f }, as: :nilable) - else = up_attribute(upmin_model.instance, attribute, locals: { form_builder: f }) = f.submit("Save", class: "btn btn-primary") - if upmin_model.klass.associations.any? %br %br %br %h3{style: "color: #333;"} Associations %hr - upmin_model.klass.associations.each do |association| %h5 = association.to_s.humanize = up_association(upmin_model.instance, association, limit: 5) - if upmin_model.klass.actions.any? %br %br %br %h3{style: "color: #333;"} Actions %hr - upmin_model.klass.actions.each do |action| %h4{style: "color: #333;"} = action.to_s.capitalize.humanize = up_action(upmin_model.instance, action)