Sha256: ea584d1acb52f91bf69ad1eec248ed91b48201c7988720b3da62c1e64386fd0e

Contents?: true

Size: 1.84 KB

Versions: 6

Compression:

Stored size: 1.84 KB

Contents

<% each_controller do -%>
<%
form_fields = standard_fields :belongs_to, :has_many

cancel_to_show_page  = linkable?(:show)
cancel_to_index_page = !cancel_to_index_page && linkable?(:index)
model_key = model.to_s.underscore
-%>
<def tag="form" for="<%= model.name %>">
  <form merge param="default">
    <error-messages param/>
    <field-list fields="<%= form_fields * ', ' %>" param/>
    <div param="actions">
      <submit label="#{ht '<%= model_key %>.actions.save', :default=>['Save']}" param/><or-cancel param="cancel"/>
    </div>
  </form>
</def>

<% creators.each do |creator| -%>
<def tag="<%= creator.name.to_s.dasherize %>-form" polymorphic/>
<def tag="<%= creator.name.to_s.dasherize %>-form" for="<%= model.name %>">
  <form lifecycle="<%= creator.name %>" merge param="default">
    <error-messages param/>
    <field-list fields="<%= creator.parameters * ', ' %>" param/>
    <div param="actions">
      <submit label="#{ht '<%= model_key %>.actions.<%= creator.name.to_s %>', :default=>['<%= creator.name.to_s.titleize %>']}" param/><or-cancel param="cancel"/>
    </div>
  </form>
</def>
<% end -%>

<% transitions.each do |transition| -%>
<def tag="<%= transition.name.to_s.dasherize %>-form" polymorphic/>
<def tag="<%= transition.name.to_s.dasherize %>-form" for="<%= model.name %>">
  <form lifecycle="<%= transition.name %>" merge param="default">
    <error-messages param/>
    <input type="hidden" name="key" value="&this.lifecycle.provided_key" if="&this.lifecycle.provided_key"/>
    <field-list fields="<%= transition.parameters * ', ' %>" param/>
    <div param="actions">
      <submit label="#{t 'activerecord.attributes.<%= model_key %>.lifecycle.transitions.<%= transition.name.to_s %>', :default=>['<%= transition.name.to_s.titleize %>']}" param/><or-cancel param="cancel"/>
    </div>
  </form>
</def>
<% end -%>

<% end # of each_model do -%>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hobo-1.3.0.RC1 lib/hobo/rapid/generators/rapid/forms.dryml.erb
hobo-1.3.0.RC lib/hobo/rapid/generators/rapid/forms.dryml.erb
hobo-1.3.0.pre31 lib/hobo/rapid/generators/rapid/forms.dryml.erb
hobo-1.3.0.pre29 lib/hobo/rapid/generators/rapid/forms.dryml.erb
hobo-1.3.0.pre28 lib/hobo/rapid/generators/rapid/forms.dryml.erb
hobo-1.3.0.pre27 lib/hobo/rapid/generators/rapid/forms.dryml.erb