Hi Matabele
I was wondering...
Can we create "a tagger" which would tag the current tiddler with tag name
you click AND tag the the "tag-tiddler" with the name of the current
tiddler all at once?
Obviously the reversed action should be possible too.... Remove a tag from
the current tiddler and at the same time remove the current tiddlers title
(as a tag) from the "tag-tiddler" at the same time...
I know this sounds overly complicated, however I've setup a system where I
can tag teachers with tasks and tasks with teachers - and as it works now I
have to do it in two steps like described above:
I tag teacher A with a task B
Now I have to find and open task B and tag it with the teacher to make both
types of lists work...
Same thing applies when I tag a task B with the name of teacher A - I will
have to find and open teacher A to tag him/her with task B...
Again - when I want to remove a teacher from a task or a task from a
teacher - I will have to do it in two steps...
*NB : You migt want to skip the rest of this this feature request because
it is so "interwoven" with one of my TW-projects that it is too complicated
for me to create a simple minimal testcase for my examples - sorry...
Here's my "tag a teacher with a task (subcategory SmallTask)" template. It
is tagged with $:/tags/ViewTemplate and it will show up in all tiddlers
tagged with teacher.
\define tag-styles()
background-color:$(backgroundColor)$;
\end
\define slider(caption,state,text)
<$button popup="$state$">$caption$</$button>
<$reveal type="nomatch" state="$state$" text="">
$text$
</$reveal>
\end
<$list filter="[is[current]tag[teacher]!prefix[$]] -[[teacher]]">
Choose a task from the category//(click on tasks to add them to this tiddler)//:
<$fieldmangler>
<$linkcatcher set="$:/NewTagName" setTo="" message="tw-add-tag">
<$count filter="[is[current]tagging[]tag[SmallTask]sort[title]]"></$count>
{{SmallTasks||$:/core/ui/TagTemplate}} has been choosen. <$button
class="btn-invisible" popup="$:/SmallTasksPopupState">Choose some more:
{{$:/core/images/new-button}}
</$button>
<$reveal type="nomatch" state="$:/SmallTasksPopupState" text="">
<div class="tw-drop-down threecolumns medium">
<$list filter='[tag[task]tag[SmallTasks]] -[all[current]tags[]]
-[[task]]'><$link><$set name='backgroundColor' value={{!!color}}><span
style=<<tag-styles>>class='tw-tag-label'><$view field='title'
format='text'/></span></$set></$link></$list>
</div>
</$reveal>
</$linkcatcher>
</$fieldmangler>
</$list>
A matching template for tasks looks like this:
\define tag-styles()
background-color:$(backgroundColor)$;
\end
<$list filter="[is[current]tag[opgave]!prefix[$]] -[[opgave]]">
<div class="tw-edit-tags">
<$fieldmangler>
<$list filter="[all[current]tags[]sort[title]] -[[opgave]]"
storyview="pop"><$set name="backgroundColor" value={{!!color}}><span
style=<<tag-styles>> class="tw-tag-label">
<$view field="title" format="text" />
<$button message="tw-remove-tag" param={{!!title}} class="btn-invisible
tw-remove-tag-button">×</$button></span>
</$set>
</$list>
<$list filter="[is[current]tag[task]!prefix[$]] -[[task]]">
----
@@float:right;
|borderless small|k
|>|>| [[Teacher(s)|Teachers]] |h
|>|>| <$list
filter="[is[current]tagging[]tag[teacher]sort[title]]"><$link><$view
field="title"/></$link>, </$list> |
| Start:| <$edit-text field="start" tag="input" type="date" format="YYYY MM
DD"> </$edit-text>|<$transclude field="start"/> |
| End:| <$edit-text field="slut" tag="input" type="date" format="YYYY MM DD">
</$edit-text>|<$transclude field="slut"/> |
@@
Choose teacher:<br>
<$fieldmangler>
<$linkcatcher set="$:/NewTagName" setTo="" message="tw-add-tag">
<$list filter="[tag[teacher]!prefix[$]] -[all[current]tags[]]
-[[teacher]]">
<$link>
<$set name="backgroundColor" value={{!!color}}>
<span style=<<tag-styles>> class="tw-tag-label">
<$view field="title" format="text"/>
</span>
</$set>
</$link>
</$list>
</$linkcatcher>
</$fieldmangler>
</$list>
I made two templates one which allows removing teachers from tasks and
another one which will remove tasks from teachers:
<div class="tw-edit-tags">
<$fieldmangler>
<$list filter="[all[current]tags[]sort[title]] -[[teacher]]"
storyview="pop"><$set name="backgroundColor" value={{!!color}}><span
style=<<tag-styles>> class="tw-tag-label">
<$view field="title" format="text" />
<$button message="tw-remove-tag" param={{!!title}} class="btn-invisible
tw-remove-tag-button">×</$button></span>
</$fieldmangler>
and a similar one for removing teachers from tasks:
<div class="tw-edit-tags">
<$fieldmangler>
<$list filter="[all[current]tags[]sort[title]] -[[task]]" storyview="pop"><$set
name="backgroundColor" value={{!!color}}><span style=<<tag-styles>>
class="tw-tag-label">
<$view field="title" format="text" />
<$button message="tw-remove-tag" param={{!!title}} class="btn-invisible
tw-remove-tag-button">×</$button></span>
</$set>
</$list>
</$fieldmangler>
My practical example is here: http://opgavefordeling.tiddlyspot.com/
It is not upgraded from 10 to 12 - because vsjs needs to be working...
Cheers Måns Mårtensson
Den fredag den 30. maj 2014 12.40.51 UTC+2 skrev Matabele:
>
> Hi
>
> I have added another widget at: http://gwiz.tiddlyspot.com/
>
> I needed to modify the tags in the template and the <$maketid> widget
> overwrites the tags in the template tiddler. Whilst it is possible to do
> this in some contexts with the <$fieldmangler> widget, the parameter to the
> message is used to specify the tag, and according to my stacking mechanism,
> the title of the target tiddler should be propagated with the parameter to
> the message. Thus a whole new <$mangletags> widget and an associated
> "tw-mangle-tags" message (to avoid confusions with the widget messages
> associated with the <$fieldmangler> widget.)
>
> The <$mangletags> widget can be stacked around a button widget and can do
> any of the following:
> -- append a tag to the tags field of the target tiddler
> -- find and remove a tag from the tags field of the target tiddler (if
> present)
> -- find and replace a tag from the tags field of the target tiddler (if
> present)
> -- send a different widget message.
>
> The unfamiliar attributes are 'add=' and 'find='
> -- to add a tag, use only: add="tag-to-add"
> -- to remove a tag, use only: find="tag-to-remove"
> -- to find and replace a tag use: find="tag-to-be-replaced" and
> add="tag-to-substitute"
>
> Hope this is of use -- there is a demo on the site to show what the widget
> does. The logic is a little complicated -- hope my code works in all
> contexts :-)
>
> regards
>
--
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/d/optout.