Folks,
I have build but not published a solution for this. The idea is to maintain the idea of an Edit and View Template structure with sub templates such as the update template.
I now have the ability to make multiple alternate view/edit templates triggered by a fields existence.
A Summary of my actions
I have cloned and renamed $:/core/ui/ViewTemplate and $:/core/ui/ViewTemplate then updated
$:/core/ui/PageTemplate/story to call the replacement $:/core/ui/ViewTemplate and $:/core/ui/ViewTemplate
To provide a hook for this in future It would be nice to alter $:/core/ui/PageTemplate/story to allow parameters for View and Edit. See my PSaT Edit here
<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" template="$:/PSaT/ViewTemplate" editTemplate="$:/PSaT/EditTemplate" storyview={{$:/view}} emptyMessage={{$:/config/EmptyStoryMessage}}/>
Now I have edited my $:/PSaT/ViewTemplate tiddler Snipit only
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">> userClass={{!!class}}><$tiddler tiddler=<<currentTiddler>>><div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class=<<frame-classes>>>
<$list filter="[all[current]has:field[update-mode]]" variable=nul>Update Mode On <$list filter="[all[shadows+tiddlers]tag[$:/tags/UpdateTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list></$list>
<$list filter="[all[current]!has:field[update-mode]]" variable=nul><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list></$list>
</div>
</$tiddler></$vars>
Such that if the current tiddler has:field[update-mode] it will use items tagged tag[$:/tags/UpdateTemplate]
Without providing all the details I have replicated the TiddlerTool bar visibility options and created a custom $:/core/ui/ViewTemplate/title tiddler to ($:/PSaT/UpdateTemplate/title) to honour these settings.
My New updateTemplate can now be independently tagged with tiddlers as an alternate to using the view template. So for example I simply add the field update-mode to a tiddler and uses the UpdateTemplate which hides the Edit Button behind more and displays selected edit fields below the tiddler text. I plan to provide a way to even remove the edit button from behind more, and have a global switch to overide UpdateTemplates with the ViewTemplate. Eventually I want the CustomView tiddlers to be drawn from a simple tag list.
The same model can be used for the EditTemplate such that you could have an additional edit mode that exposes for edit, only the fields you want. Perhaps an example called EditTextOnly editTemplate.
I plan to build a Readonly-editmode view that can be locally or globally applied
I am now plan to build a special set of sub ViewTemplates to allow the the toolbar and fields to be divided into headers, body and footer within a "Outliner" view. Where the alternate views are displayed within an outliner tiddler with each tiddler selected. This will also allow the readonly view to present in a readonly viewer
So to re-iterate, have only interfered with the core in $:/core/ui/PageTemplate/story
If this was parametised the default View and Edit Templates could be set in the control panel or system tiddlers to alternatives, perhaps provided in a plugin or bundle, and if compelling in the core.
In closing you see I have demonstrated the the technical solution, if you see my vision please help
- Minor Change to future core to facilitate and avoid core override, and provide settings.
- Produce the tool to define and replicate such alternate view and edit templates.
- Criticise and improve my techniques.
To me this opens TiddlyWiki to a more sophisticated interface where the complexity of tiddlywiki can be hidden globally or just inside a view tiddler. It would enable users a reduced learning curve when a solution or edition caters to there ignorance and does not demand they learn (Yet) key tiddlywiki concepts, they will simply experience the result.
Possible additional futures
- Perhaps we could even allow some view/edit templates to be encrypted so that other view/edit templates will be used instead until the encrypted ones are decrypted.
- Perhaps we could Provide an edit mode for the text field(s) that prohibits more than wikitext so there is no code insertion.
Regards
Tony