Hi Tony,
sorry for not answering yesterday, but my migraine apparently now gets also
triggered by smaller changes in weather.
Thanks for the reminder of the size parameter! Somehow I was so convinced
at the time that it had to be something with width and found nothing except
for css changes that I used a textarea for the bigger size.
The whole it has to be width was probably while I also overread it in the
documentation.
To your test, can you elaborate on what you think is not right? I tried
both versions in the same wiki and they gave me the same result.
Regards,
Felicia
On Sunday, 5 July 2020 03:38:32 UTC+2, TW Tones wrote:
>
> Felicia,
>
> Great work.
>
> I am happy to do more challenges, I hope others also support this idea,
> and they are welcome to do it themselves.
>
> In chrome I downloaded your json to a scratch area, went to tiddlywiki.com,
> dragged the file and dropped it in tiddlywiki.com and tested it. I added
> enable disable to the value config values. It works and it reuses the
> select statements reducing the amount of code required.
>
> The edit pairs could be changed to
> Edit Pairs: <$edit-text tiddler="$:/smartConfig/config/pairs" field="text"
> tag=input size=80/>
>
> I used this small test opn your example and mine
> <$list filter="[prefix[$:/config/]]">
> <<smart-configure fieldname:"text">>
> </$list>
> Something is not right.
>
> Regards
> Tony
>
>
>
>
>
> On Sunday, July 5, 2020 at 6:52:41 AM UTC+10, Felicia Crow wrote:
>>
>> Hi,
>>
>> First personally I would love for challenges like these to become a thing
>> since not only do I get to learn things I normally would not necessarily
>> need for myself and second I think it would be interesting to see different
>> approaches to the same challenge.
>>
>> Second here is my solution for the basic challenge:
>>
>> *How the macro works:*
>>
>> - The Macro is still called with tiddlername and fieldname with the
>> same defaults.
>> - The outermost list widgets check if currentValue is empty or not
>> and react accordingly
>> - If there is no currentValue the first select will be created with
>> all values currently defined in the corresponding config tiddler.
>> - The config tiddler to use is defined in the configTiddler
>> variable to make it easier to change the tiddler. Currently the only
>> hard
>> coded part is that the pairs have to be in the text field.
>> - If there is a currentValue - or a value was chosen in the first
>> select - then the second select will be created only showing the
>> corresponding pair. E.g.: If the current value is 'yes' only the options
>> 'yes' and 'no' are available.
>> - For now the value pair has to be defined in the config tiddler
>> for this to work. In the version for the extended challenge I
>> hopefully
>> manage to have a way to create a field on setting the initial value
>> that
>> will keep the respective pair within the tiddler itself.
>>
>> *How to extend the macro*
>>
>> - Simply add another pair/set of options to the config separated at
>> least by ';' for the pair and by at least one space for each option.
>> - Only caveat for now is each value in a pair/set has to be a single
>> word/string without spaces.
>>
>> *Macro*
>> \define smart-configure(tiddlername fieldname:"fieldname")
>> <$set name=configTiddler value="$:/smartConfig/config/pairs">
>> <$set name=tiddlername value="$tiddlername$" emptyValue=<<currentTiddler
>> >> >
>> <$set name=currentValue value={{{ [<tiddlername>get[$fieldname$]trim[]]
>> }}}>
>> tiddlername=<<tiddlername>>, fieldname=$fieldname$, currentValue=<<
>> currentValue>><br>
>>
>> <$list filter="[<currentValue>is[blank]]" variable=nul>
>> Select initial value:
>> <$select tiddler=<<tiddlername>> field="$fieldname$" default=<<
>> currentValue>> >
>> <$list filter='[<configTiddler>get[text]split[;]!is[blank]join[ ]]'>
>> <$list filter="[<currentTiddler>split[ ]!is[blank]]">
>> <option value=<<currentTiddler>>><$view field='title'/></option>
>> </$list>
>> </$list>
>> </$select>
>> </$list>
>>
>> <$list filter="[<currentValue>!is[blank]]" variable=nul>
>> <$list filter="[<configTiddler>get[text]split[;]trim[]!is[blank]]
>> +[search<currentValue>]">
>> <$select tiddler=<<tiddlername>> field="$fieldname$" default=<<
>> currentValue>> >
>> <$list filter="[<currentTiddler>split[ ]]">
>> <option value=<<currentTiddler>>><$view field='title'/></option>
>> </$list>
>> </$select>
>> </$list>
>> </$list>
>>
>> </$set>
>> </$set>
>> </$set>
>> \end
>>
>> *Configuration*
>> yes no; show hide; true false; left right; top bottom
>>
>> The attached version of the macro tiddler includes a text edit widget to
>> quickly edit the config tiddler and two examples to see both states of the
>> macro.
>> The import and tiddlers work on empty.html, tiddlywiki.com and the
>> playground <https://anthonymuscio.github.io/playground.html>.
>>
>> For now I will leave it at that, but will look into the extended
>> challenge within the next days since it has some very interesting points to
>> solve.
>>
>> Regards,
>> Felicia
>>
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/7bd6e04c-bc16-4f66-bd91-07e9931abbe4o%40googlegroups.com.