Sha256: 0710300e96147c0b10904b39f1d154d970130be7ba552fb8d3f133229730ebc9

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

<% each_model do -%>
<%
name_attribute     = model.name_attribute
content_attribute  = model.primary_content_attribute
creator_attribute  = model.creator_attribute
primary_collection = primary_collection_name

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 && content_attribute) || creator_link || creator_attribute || primary_collection
-%>
<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>
      <h4 param="heading"><% if show_link %><a><name/></a><% else %><name/><% end %></h4>
<% 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 && content_attribute -%>
      <view:<%= content_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

3 entries across 3 versions & 1 rubygems

Version Path
hobo-0.8.1 dryml_generators/rapid/cards.dryml.erb
hobo-0.8.2 dryml_generators/rapid/cards.dryml.erb
hobo-0.8 dryml_generators/rapid/cards.dryml.erb