Build sequential modals out of a list filter

92 views
Skip to first unread message

Diego Mesa

unread,
Feb 2, 2018, 5:35:43 PM2/2/18
to TiddlyWiki
Hey all,

I am working on something where I would take a list of tiddlers I've filtered for, and display each one as a modal popup with a button to the next one. Is this possible?

Thanks!

coda coder

unread,
Feb 2, 2018, 5:59:27 PM2/2/18
to TiddlyWiki
Yes. I've done it using listops. But frankly, I ended up hardwiring the whole thing -- I could understand and reason about the code better, AND, most importantly, understand it six months (weeks? minutes?) later.

Diego Mesa

unread,
Feb 2, 2018, 7:36:13 PM2/2/18
to TiddlyWiki
Awesome! Could you give me a shell of an example if you get a chance?

Thanks!

Diego Mesa

unread,
Feb 3, 2018, 10:54:02 PM2/3/18
to TiddlyWiki
Reporting back here some progress/questions. Im trying to do something like this:


<!-- for the n many cards, we return n-1 -->
<$formula-vars counter="count([tag[Flash Card]])-1">

   
<!-- iter goes from 0 to n-2  -->
    <$list filter="[range
<counter>butlast[]]" variable="iter">
 
   
<!-- arrays need to be accessed from 1 to n -->
    Current Card: (= nth([tag[Flash Card]sort[created]], <
<iter>> + 1) =)
   
<br/>
    Link to Next: (= nth([tag[Flash Card]sort[created]], <
<iter>> + 2) =)

    </$list>

   
<!-- take last element with no forward link -->
    <$list filter="[range
<counter>last[]]" variable="iter">

    Last One: (= nth([tag[Flash Card]sort[created]], <
<iter>> + 1) =)

    </$list>

</$formula-vars>


The above is the only way I could get this kind of linked list working.

Things I could not figure out and would like some help with
  • How to make range go from 1 to the variable <counter> using its native format: [range[1,<counter>]]. This did not work, so I had to do shifting.
  • Place the filter in a field, and have the above code with the field contents
  • Actually place a button on the outside of the lists, and an actionwidget on the inside to create the tm modal!

More importantly, I initally tried to only perform the filtering once, and use its results, stored in a variable, but I couldnt quite figure it out. I kept getting cound not auto-convert into an array with Evan's plugin, and even the list widget was acting strangely with it.


If anyone has any suggestions to imrpove the above i would be greatful! 


Diego

coda coder

unread,
Feb 4, 2018, 4:47:01 PM2/4/18
to TiddlyWiki
Sorry, Diego, that will take a while.  I have it in an archive "somewhere"...
Reply all
Reply to author
Forward
0 new messages