Multiple Card definitions possible?

16 views
Skip to first unread message

Peter Booth

unread,
Aug 8, 2011, 11:25:53 PM8/8/11
to hobo...@googlegroups.com
I understand that the index page implicitly uses a model's Card. Is it possible to define multiple Cards that are used in different contexts? I'm thinking of two scenarios:
1. A search results page that shows a collection of found objects in a list, with an aside containing a second list of objects that have been selected to keep. This might be like a store search results with an associated shopping cart of items to keep.

2. A search results page showing a list of products. Those products that satisfied a criteria (say advertiser supported) might have a richer more detailed view. SO a single collection of objects with two variants of card used to display each object.

UI know thta I can get the intended results by dropping down to ERB, but I'd prefer to understand the "Right Dryml Way" to achieve these.

Peter

Bob Sleys

unread,
Aug 8, 2011, 11:37:24 PM8/8/11
to hobo...@googlegroups.com
There may be a better way but in dryml you can create any tag you want and make it look any way you want.  You could simply create your own tag that looks like a card with the additional info in it and specify in the collection to use your new tag instead of the default card.

bob

kevinpfromnm

unread,
Aug 9, 2011, 12:04:48 PM8/9/11
to hobo...@googlegroups.com
What I'd suggest is redefining/extending the card definition to match the more broadly used version, the one on multiple pages, and then overriding in the specific case, the index page, to match what you want there.

app/views/model_name_pluralized/index.dryml
<index-page>
  <collection: replace>
    custom collection code here
  ...
Reply all
Reply to author
Forward
0 new messages