Home <% models.select { |m| linkable?(m, :index) }[0..4].each do |m| -%> <% end -%> <% each_controller do -%> <% new_link = linkable?(:new) new_form = !new_link && linkable?(model, :create, :method => :post) model_key = model.to_s.underscore -%>

<% if new_link -%> New <%=model_name %> <% end -%> <% if view_hints.paginate? -%> <% end -%> <% if view_hints.sortable? -%> <% else -%> <% end -%> <% if view_hints.paginate? -%> <% end -%> <% if new_form -%>

New <%= model_name %>

<% end -%>

New <%= model_name %>

<% back_link = model.view_hints.parent back_link_human_name = model.reflections[back_link] && model.reflections[back_link].klass unless back_link.blank? back_link_human_name = back_link_human_name && back_link_human_name.model_name.human boolean_fields = model.table_exists? ? (model.columns.select { |c| c.type == :boolean }.*.name - model.view_hints.inline_booleans) : [] creator = model.creator_attribute creator_link = creator && model.reflections[creator] && linkable?(model.reflections[creator].klass, :show) edit_link = linkable?(:edit) main_content = model.primary_content_attribute show_fields = standard_fields(:belongs_to).*.to_s - [model.name_attribute, main_content, creator, back_link, *boolean_fields].*.to_s is_user_model = model < Hobo::Model::User collection = model.view_hints.primary_children if collection collection_class = model.reflections[collection].klass owner = model.reverse_reflection(collection)._?.name if owner add_link = collection && linkable?(collection_class, :"new_for_#{owner}") add_form = !add_link && linkable?(collection_class, :"create_for_#{owner}", :method => :post) end end unless model.view_hints.secondary_children.empty? aside_collections = model.view_hints.secondary_children.map { |c| [model.reflections[c], model.reverse_reflection(c)] } aside_collections.reject! { |refl, reverse| reverse.nil? } end -%> <% if aside_collections -%>
<% end -%>
<% if back_link -%> param="parent-link">« Back to > <% end -%>

<% if boolean_fields -%> <% end -%> <% if creator_link -%> param="creator-link"/> <% elsif creator -%> <% end -%> <% if edit_link -%> Edit <%= model_name %> <% end -%>
<% if main_content -%> param="description"/> <% end -%> <% if show_fields.any? -%> <% end -%> <% if collection -%>

<% if sortable_collection?(collection) -%> param="collection"/> <% else -%> param/> <% end -%> <% if add_link -%> action="new" if="&can_create?(@<%= model.name.underscore %>.<%= collection %>)" param="new-link"> New <%= collection_class.to_s.titleize %> > <% elsif add_form -%>

Add <%= a_or_an collection_class.to_s.titleize %>

<% end -%>
<% end -%>
<% if aside_collections -%>
<% end -%>
<% name_attribute = model.name_attribute -%>

Edit <%= model_name %>

<% controller.owner_actions.each_pair do |owner, actions| -%> <% collection_name = model.reverse_reflection(owner).name.to_s owner_model = model.reflections[owner].klass linkable_owner = linkable?(owner_model, :show) owner_tag = linkable_owner ? "a" : "name" owner_is_user = owner_model < Hobo::Model::User owner = model.reflections[owner].macro == :has_many ? owner.to_s.singularize : owner.to_s -%> <% if :index.in? actions -%> <% new_link = :new.in?(actions) -%>
<% if linkable_owner -%>
Back to
<% end -%>

<% unless owner_is_user %>

For: <<%= owner_tag %> with="&@<%= owner %>"/>

<% end -%>

<% if new_link -%> New <%=model_name %> <% end -%>
<% end -%> <% if :new.in? actions -%>

New <%= collection_name.singularize.titleize %>

For: <<%= owner_tag %> with="&@<%= owner %>"/>

<% end -%> <% end # of owner_actions.each_pair -%> <% creator_names.each do |creator| -%>

<%= creator.titleize %>

<<%= creator.dasherize %>-form param="form"/>
<% end -%> <% transition_names.each do |transition| -%>

<%= transition.titleize %>

<<%= transition.dasherize %>-form param="form"/>
<% end -%> <% end # of each_model do -%>