Sha256: 656b6985c174adf4c35e48657f2faee1275508d907dfb3eea39792ff097cca04
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
-# 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 Create a = upmin_model.klass.humanized_name(:singular) %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_create_model_path(klass: @klass.name), html: { method: :post }) do |f| -# Render each attribute - upmin_model.klass.attributes.each do |attribute| - any_errors = new_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("Create", class: "btn btn-primary")
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
upmin-admin-0.0.39 | app/views/upmin/partials/models/_new_model.html.haml |