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

<%= model_name :title, :plural %>

There

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

New <%= model_name :title %>

<% end -%>

New <%= model_name :title %>

<% back_link = model.dependent_on.detect { |x| !(model.reflections[x].klass < Hobo::User) } boolean_fields = 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::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">« > <% end -%>

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

<%= '' if is_user_model %><%= collection.to_s.titleize %>

<% 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.to_s.singularize.titleize %> > <% elsif add_form -%>

Add <%= a_or_an collection.to_s.singularize.titleize %>

<% end -%>
<% end # of main collection -%>
<% if aside_collections -%>
<% end -%>
<% name_attribute = model.name_attribute -%>

Edit

<% 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::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 -%> <% if owner_is_user %>

<%= model_name :title, :plural %>

<% else -%>

<%= model_name :title, :plural %>

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

<% end -%>

There

<% if new_link -%> New <%=model_name :title %> <% 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 -%>