On May 9, 2010, at 8:19 PM, Jeremy Savoy wrote:
Thanks Matt!
Now, when I go to /contacts/attending I get "Template is Missing"
error, telling me that contacts/attending.erb is missing in app/views.
How would I go about defining the attendees page - does this go in a
file in app/views/contacts, or application.dryml? Can it be dryml, or
does it need to be erb ?
It's just like a regular Rails view - you'll put it in app/views/
attending.dryml (or .html.erb, or .haml, or .mab, etc etc etc) In
DRYML, you'll want to either start with:
<index-page />
which will give you a standard autogenerated index page (paginated
collection of cards), or you can go full-custom:
<page title="Attending">
<content:>
Anything DRYML can go here
</content:>
</page>
depending on how much customization you plan on doing to the page. You
may also want to consult the autogenerated index-page tag for ideas -
it's in app/views/taglibs/auto/rapid/pages.dryml. To convert the tag
def to vanilla page DRYML, you can make a simple transformation:
- bare param declarations become class attributes that have the same
name as the tag
- named param declarations become class attributes that have the
declared name
Both of these help keep styles well-behaved by replicating the
behavior that the DRYML parser already exhibits.
- merge and friends (merge-attrs, etc) go away
- if you prefer to live dangerously re: i18n, you can also remove the
ht tags and keep only the defaults
An example from one of my current projects:
<def tag="index-page" for="ConferenceRegistration">
<page merge title="#{ht
'conference_registrations.index.title', :default=>['Conference
Registrations'] }">
<body: class="index-page conference-registration" param/>
<content: param>
<header param="content-header">
<h2 param="heading">
<ht key="conference_registrations.index.heading">
Conference Registrations
</ht>
</h2>
<p param="count" if>
<ht key="conference_registrations.collection.count"
count="&this.size">
There <count prefix="are"/>
</ht>
</p>
</header>
<section param="content-body">
<page-nav param="top-page-nav"/>
<collection param/>
<page-nav param="bottom-page-nav"/>
</section>
</content:>
</page>
</def>
becomes:
<page title="'Conference Registrations">
<body: class="index-page conference-registration" />
<content:>
<header class="content-header">
<h2 class="heading">
Conference Registrations
</h2>
<p class="count" if>
There <count prefix="are"/>
</p>
</header>
<section class="content-body">
<page-nav class="top-page-nav"/>
<collection class="collection" />
<page-nav class="bottom-page-nav"/>
</section>
</content:>
</page>
I'd advise *against* expanding a tag like this most of the time, but
occasionally you need to make pretty severe changes to layout and / or
structure and it's simply clearer to start from scratch rather than
adding a zillion after-, before- and replace parameters.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.