Sha256: 756c2dc56f46419077f6d27a930b3e2a6c1600885ffda2c7cc17a76ef1133fe2
Contents?: true
Size: 1.79 KB
Versions: 5
Compression:
Stored size: 1.79 KB
Contents
<% each_model do -%> <% name_attribute = model.name_attribute description_attribute = model.primary_content_attribute creator_attribute = model.creator_attribute primary_collection = model.view_hints.primary_children if creator_attribute creator_refl = model.reflections[creator_attribute] creator_link = creator_refl && linkable?(creator_refl.klass, :show) end show_link = linkable?(:show) edit_link = !show_link && linkable?(:edit) delete_button = !show_link && !edit_link && linkable?(:destroy, :method => :delete) has_actions = edit_link || delete_button has_body = (!show_link && description_attribute) || creator_link || creator_attribute || primary_collection show_title = !show_link && (name_attribute || !has_body) -%> <def tag="card" for="<%= model.name %>"> <card class="<%= model_name :dashed %>" param="default" merge> <% if name_attribute || show_link || has_actions || !has_body -%> <header: param> <% if show_link || show_title -%> <h4 param="heading"><% if show_link %><a><name/></a><% else %><name/><% end %></h4> <% end -%> <% if has_actions -%> <div param="actions"> <% if edit_link -%> <a action="edit" if="&can_edit?" param="edit-link">Edit</a> <% end -%> <% if delete_button -%> <delete-button label="X" param/> <% end -%> </div> <% end -%> </header:> <% end -%> <% if has_body -%> <body: param> <% if !show_link && description_attribute -%> <view:<%= description_attribute %> param="description"/> <% end -%> <% if creator_link -%> <a:<%= creator_attribute %> param="creator-link"/> <% elsif creator_attribute -%> <view:<%= creator_attribute %> param="creator"/> <% end -%> <% if primary_collection -%> <count:<%= primary_collection%> param/> <% end -%> </body:> <% end -%> </card> </def> <% end -%>
Version data entries
5 entries across 5 versions & 1 rubygems