Eric Shulman said the following on 11/03/2013 08:54 PM:
On Sunday, November 3, 2013 5:39:23 PM UTC-8, [email protected]
wrote:

    I came across a reference in
    http://tiddlywiki.org/#[[HideWhenPlugin%20Questions]]
    <http://tiddlywiki.org/#[[HideWhenPlugin%20Questions]]>

        Placing each collection of custom fields in a separate tiddler
        helps cut down on the confusion of having multiple different
        things going on in your ViewTemplate & EditTemplate, as well as
        making it easier to safe guard against accidentally deleting or
        over writing one of them and losing everything.


    That sounds interesting.


That note is talking about using separate tiddlers to define sets of
custom field *template* definitions.  The example that precedes the
comment demonstrates:
----------------------
<div macro="showWhen
           tiddler.tags.contains('Training') ||
           tiddler.title == 'New Training'">
     [[TrainingTemplateEdit]]
</div>
----------------------

Thus, it is not suggesting "indirect custom fields".... rather, simply a
technique that moves the custom field parts of the ViewTemplate or
EditTemplate definitions into separate "template fragments" that are
then included in the main template by using the [[...]] syntax (in the
example, it's wrapped inside a DIV with a "showWhen" macro, so that it
will only appear when a given tag ('Training') is present on the tiddler.

Yes, I saw that example and thought that there was something more than just a cut-and-paste from the EditTemplate into the TrainingTemplateEdit and presumably the ViewTemplate into a corresponding TrainingTemplateView. Something defining the field as just the field names and then somehow making it all work.

Well I cut-and-paste and have a line in the StorylineEditTemplate which reads

...
<div macro='tiddler QuickEditToolbar with: show'></div>
StorylineTemplateFields##Edit
<div class='editor' macro='edit text'></div>
....

and a corresponding one in the StorylineViewTemplate, and then
StorylineTemplateFields reads

!Edit
<div class=" blue groupbox">
<b>Location:</b> <span macro='select location rows:1 =Locations'></span>
<b>Characters:</b> <span macro='select characters rows:3 allowBlank allowMultiple =malecharacter =femalecharacter'></span>
<b>Thread:</b> <span macro='select thread rows:1 =Threads'></span>

<b>Chapter:</b><span class='fivechar max25wide' macro='edit inchapter'> </span>
<b>Seq#:</b> <span class='threechar' macro='edit sceneseqnum'></span>
</div>
!View
<div class='fviewer blue groupbox'>
      <b>Location:</b>&nbsp;<span macro='view location link'></span>&nbsp;
<b>Characters:</b>&nbsp;<span macro='view characters wikified'></span>&nbsp;
      <b>Thread:</b>&nbsp;<span macro='view thread link'></span>&nbsp;
      <b>Chapter:</b>&nbsp;<span macro='view inchapter link'></span>&nbsp;
      <b>Seq#:</b>&nbsp;<span macro='view sceneseqnum'></span>&nbsp;
<b>Scene Date:</b>&nbsp;<span macro='view scenedate date "DD/MM/YYYY" '></span>&nbsp;
</div>


I still think it a bit of kludge and I'm far from happy with it.


Note: another way to manage custom templates based on tags (or other
criteria) is:
    http://www.TiddlyTools.com/#TaggedTemplateTweak

Yes, and I have a lot of them! That's part of the issue and the motive for refactoring.

It looks like I'll be using a single ViewTemplate and EditTemplate but with the HideWhenPlugin and with a lot of TemplateFields tiddlers and
a huge 'case statement'.


Hmm. Perhaps just one TemplateFields and slices for each tag and somehow generate a
        [[TemplateFields##Edit$(tag)]]

I haven't learnt how I might do that kind of thing, never mind how to do it in a template.


--
We must believe in free will.  We have no choice.

--
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to