How to create an Alternate View

Every Thing in Querki has a "Default View" -- the way that this Thing normally shows. But sometimes, you also want Alternate Views: different displays of this Thing, for different purposes. Here is how you do that.
First, create the Property that will hold the View. Simply make a new Property, of Exactly One Large Text Type, on the Thing or Model that you want to have this View. (We'll call it "My Alternate View" in this example.)
Fill in My Alternate View with what you want this View to look like. A simple and common example is an Edit View, which might contain nothing but [[_edit]] -- this displays the Editor for this Thing. I usually find that I want a way back to the Default View from my Alternate Views; the easiest way to do that is to put this at the bottom:
[[_linkButton(""Back to Default View"")]]
That displays a button labeled "Back to Default View". (As always, it defaults to operating on the Thing you are looking at, so it is a link to this Thing.)
Then, from your Default View (or somewhere else), you link to My Alternate View using the _propLink function. This takes the name of the View, and turns it into a Link pointing to it; you can then use _linkButton or _showLink, to display it as a button or an ordinary underlined link, as you prefer. So for example, to show an underlined link, you would say:
[[My Alternate View._propLink -> _showLink(""Other View"")]]

Back to Recipes