Home
<% models.select { |m| linkable?(m, :index) }[0..4].each do |m| -%>
<%= m.name.titleize.pluralize %>
<% end -%>
<% each_controller do -%>
<%
new_link = linkable?(:new)
-%>
<%= model_name :title, :plural %>
There
<% if new_link -%>
<% 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
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
collection = model.dependent_collections.sort_by(&:to_s).first
if collection
collection_class = model.reflections[collection].klass
owner = model.reverse_reflection(collection).name
add_link = collection &&linkable?(collection_class, :"new_for_#{owner}")
add_form = !add_link && linkable?(collection_class, :"create_for_#{owner}", :method => :post)
end
-%>
<% if back_link -%>
param="parent-link">«
<% end -%>
<% if boolean_fields.any? -%>
<% end -%>
<% if creator_link -%>
param="creator-link"/>
<% elsif creator -%>
<% end -%>
<% if edit_link -%>
Edit <%= model_name :title %>
<% end -%>
<% if main_content -%>
/>
<% end -%>
<% if show_fields.any? -%>
<% end -%>
<% if collection -%>
<%= collection.to_s.titleize %>
<% if sortable_collection?(collection) -%>
param="collection"/>
<% else -%>
param/>
<% end -%>
<% if add_link -%>
action="new" if="&can_create?" param="new-link">New <%= collection.to_s.singularize.titleize %>
<% elsif add_form -%>
Add <%= a_or_an collection.to_s.singularize.titleize %>
<% end -%>
<% end -%>
<%
name_attribute = model.name_attribute
-%>
<% controller.owner_actions.each_pair do |owner, actions| -%>
<%
collection_name = model.reverse_reflection(owner).name.to_s
owner_model = model.reflections[owner].klass
owner_tag = linkable?(owner_model) ? "a" : "name"
owner = owner.to_s
-%>
<% if :index.in? actions -%>
<%
new_link = :new.in?(actions)
-%>
<%= model_name :title, :plural %>
There
<% if new_link -%>
<% end -%>
<% end -%>
<% if :new.in? actions -%>
New <%= collection_name.singularize.titleize %>
For: <<%= owner_tag %> with="&@<%= owner %>"/>
<% end -%>
<% end # of owner_actions.each_pair -%>
<% if defined? model::Lifecycle -%>
<% model::Lifecycle.creators.values.where.publishable?.*.name.each do |creator| -%>
<<%= creator.dasherize %>-form param="form"/>
<% end -%>
<% model::Lifecycle.transitions.where.publishable?.*.name.each do |transition| -%>
<%= transition.titleize %>
<<%= transition.dasherize %>-form param="form"/>
<% end -%>
<% end # of if defined? model::Lifecycle -%>
<% end # of each_model do -%>