Hi Eric, hi Matabele,

thank you so much for your very quick and helpfull response.
Summary: it's working now :)

To get more into detail:

@Matabele

> There's a <<tag>> macro which often simplifies things -- for example, try 
> this (in a tiddler with some tags.)
>
> <$list filter="[tags[]]"><<tag>></$list>
>
I tried working with the tag macro as well, but is has the same basic 
problem. If you have more than one occurence of the same tag  within  the 
tiddler text, all will open up when you click on the tag pill.
Reason for that imho is, that the tag macro uses the $:/core/ui/TagTemplate as 
well, so it faces the same qualifier/ state problem metioned above by 
Alberto and Jeremy.

@Eric:

> The problem is that the state="..." param in the $reveal widget *must* be 
> the same value as the popup="..." param in the corresponding $button 
> widget.  Thus, you need to write:
> <$button popup=<<qualify """$state$""">>...
> <$reveal state=<<qualify """$state$""">> ...
>
> or perhaps this would be even better:
> <$button popup=<<qualify """$:/state/popup/tag/$state$""">>
> <$reveal state=<<qualify """$:/state/popup/tag/$state$""">>
>

Thank you so much, for pointing that out. And it does make absolute sense, 
when I think about it.
Quick question: Why using the $:/state/popup/tag prefix? Is this just best 
practice to make it obvious that we are dealing with a state here? Or is 
there more to that? To be honest, I tried to work myself through  
http://tiddlywiki.com/static/StateMechanism.html but did not really 
understand it. :)


One small problem here is that you forgot the quotes are $(id)$.  Since the 
> id value MIGHT contains spaces (from the tiddler title), you should write:
> ... state="""$(id)$"""
>
> Howevr, the much bigger problem here is that you can't use the $(id)$ 
> syntax to insert the value from a variable that was just $set.  Macros do 
> NOT "run" their content and return the output.  Rather, then ONLY expand 
> the $(variable)$ and $param$ references that exist when it is invoked and 
> then return THAT content for processing in the calling context.  Thus, your 
> macro, when called with <<createTag foo bar>> produces this output:
> <$set name="id" value="$:/state/popup/tagfoobar">
>
> <$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}} 
>  state=$(id)$/>
> </$set>
> Note that the $(id)$ syntax remains, because the variable was NOT defined 
> when the macro was *invoked*.
>

I am still somehow struggling on how to call Variables, Parameters, 
Tiddler-fields in certain situation. Especially for sometimes you have to 
call the same object like a variable like $(myVar)$ and other times like 
<<myVar>>. At this point it is usually try and error for me, the 
documenation and transclusions, variables and parameters helps, but seems 
not cover all situations.

But anyway: thank you very much for the help.

If somebody is interessted in the final solution, here it is:

1. Transclusion in the target tiddler, where I want to display the results:
{{||$:_/woto/ui/TasklistTemplate}}


 2. The tasklisk template, to show open tasks with their assigned task 
inline with the task title:
!! Offen 
<$list filter="[!has[draft.of]tag<currentTiddler>!tag[done]sort[created]]">

<$checkbox tag="done"> <$link to={{!!title}}><$view 
field="title"/></$link></$checkbox>
<$set name="tiddlerTitle" value={{!!title}}>
<$list filter="[all[current]tags[]sort[title]]" storyview="pop">
<$set name="currentTag" value={{!!title}}>
{{||$:_/woto/ui/TagTemplateUnique}}
</$set>
</$list>
</$set>
</$list>


3. and the rewritten tagTemplate, just to keep it more structured for me. 
It would probably be better, to put all this in an macro, to make the 
parameter input more obvious:
\define tag-styles()
background-color:$(backgroundColor)$;
fill:$(foregroundColor)$;
color:$(foregroundColor)$;
\end

\define tag-body-inner(colour,fallbackTarget,colourA,colourB, state)
<$set name="foregroundColor" value=<<contrastcolour target:"""$colour$""" 
fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" 
colourB:"""$colourB$""">>>
<$set name="backgroundColor" value="""$colour$""">
<$button popup=<<qualify """$state$""">> class="tc-btn-invisible 
tc-tag-label" style=<<tag-styles>>>
<$transclude tiddler={{!!icon}}/> <$view field="title" format="text" />
</$button>
<$reveal state=<<qualify """$state$""">> type="popup" position="below" 
animate="yes"><div class="tc-drop-down"><$transclude 
tiddler="$:/core/ui/ListItemTemplate"/>
<hr>
<$list filter="[all[current]tagging[]]" 
template="$:/core/ui/ListItemTemplate"/>
</div>
</$reveal>
</$set>
</$set>
\end

\define tag-body(colour,palette,state)
<span class="tc-tag-list-item">
<$macrocall $name="tag-body-inner" colour="""$colour$""" 
fallbackTarget={{$palette$##tag-background}} 
colourA={{$palette$##foreground}} colourB={{$palette$##background}} 
state="""$state$"""/>
</span>
\end

\define createTag(title, tag)
<$set name="id" value="$:/state/popup/tag/$title$$tag$">
<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}} 
 state=<<id>>/>
</$set>
\end

<$macrocall $name="createTag" title=<<tiddlerTitle>> tag=<<currentTag>>/>








-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/97ae29e1-53fd-41cf-8f75-999c42428ae2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to