formatting
Forms are content patterns. Every day we encounter lots of formatted information: weather forecasts, sports cards, restaurant menus, user profile pages, tax documents and nutrition labels each have their own pattern of what information is included, and how it is laid out. These patterns help you compare and contrast information visually, and to notice missing information.
Wagn lets you create forms and apply them to sets of cards, so they contain the same kinds of information with the same structure. It does so using two settings: *structure and *default
+example
Open these two Recipe cards, and you'll see they have the same structure:
Chilaquiles
30 minutes4conventionalChile,Chicken...Carnitas
10 minutes4conventional...pork,meat,mexican
You'll also see the same pattern when you create a new Recipe card.
Here's the structure rule that is used to template Recipes:
Recipe+*type+*structure
{{+preparation time|labeled}}{{+serves|labeled}}{{+diet|labeled; item:link}}{{+ingredients|titled}}{{+preparation|titled}}{{+discussion|titled; show:comment_box}}
You'll notice the form includes cards for recipe information like preparation and cook time, number served, ingredients, etc. When a user edits a recipe, Wagn offers to add or edit those cards.
+howto
Wagn supports formatting with rules (configurations that can apply to any set of cards).
*structure and *default rules
- *default rules control cards' initial type and content. Changing a *default rule won't impact existing cards.
- *structure rules control cards' current type and content. Changing a *structure rule will impact every card in the rule's set.
Special navigation to and from *structure rules
In addition to the common rule navigation described in rules+howto, there are two special card menu items for navigating to *structure rules:
- edit > structure. Any structured card (like a recipe) will present this menu option to anyone with permission to edit the rule. It opens directly to an edit view.
- view > structure. Similarly, anyone with that permission can view the rule directly with this menu item.
The latter is especially useful, because it offers quick links to each of the inclusions on the rule, which makes it simple to alter those rules.
Naming patterns via inclusions
Consider again our example of the recipe form card:
Recipe+*type+*structure
Basic :{{+preparation time|labeled}}{{+serves|labeled}}{{+diet|labeled; item:link}}{{+tags|labeled; item:link}}{{+ingredients|titled}}{{+preparation|titled}}
{{+discussion|titled; show:comment_box}}
Looking at that card, you'll notice lots of inclusions, like {{+ingredients|open}}. Here's a brief overview of how this works:
- The double curly brackets (\{{) represent an inclusion, meaning that one card is inside another. In this case, the ingredients card is inside the recipe card.
- The "+" before "ingredients" indicates that this is a contextual name, meaning that the included card receives a name relative to the including card. For example, if I make a recipe called "Lobster Bisque", then its ingredient list will be named "Lobster Bisque+ingredients".
- The "open" refers to the views of the included card. When you see the ingredients card inside the recipe, it will be open.
The important pattern to understand is that these structured inclusions establish naming patterns. All the cards that contain information about ingredients will have names that begin with the recipe name and end with "+ingredients". These naming patterns are key to Wagn's organizational capabilities.
Fields on structured cards
Typically when we create structured cards, we treat the included cards as "fields". And we often want to set the default type and/or content for those fields. Setting up field types can be done by using the capabilities outlined above in combination.
For example, when viewing the Recipe structure rule included above, you can click on any inclusion to open up its rules. If you click on +diet, you will see that its *default rule determines that any +diet card will, by default, have the type Pointer and the content "conventional".
See also
- inclusions
- compound names
- contextual names
- views
- virtual cards
+tips
- Checkboxes, radio buttons, and other form elements can be added using Pointers.
- You can add help text that shows up when inclusions are being created or edited.