1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 23:34:50 +00:00

Add group headings to type dropdown

We’re also reverting to the old custom dropdown. Using the select
widget didn’t work out because it couldn’t cleanly work with a text box
allowing custom types to be specified.
This commit is contained in:
Jermolene 2014-06-06 09:32:14 +01:00
parent 08ed0017af
commit 9b576f2a8d

View File

@ -2,12 +2,20 @@ title: $:/core/ui/EditTemplate/type
tags: $:/tags/EditTemplate
\define lingo-base() $:/language/EditTemplate/
<<lingo Type/Prompt>> <$select field="type" default="text/vnd.tiddlywiki">
<$list filter="[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]each[group]]">
<optgroup label={{!!group}}>
<$list filter="[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]group{!!group}] +[sort[description]]">
<option value={{!!name}}><$view field="description"><$view field="title"/></$view> (<$view field="name"/>)</option>
<p><$fieldmangler><em class="tw-edit"><<lingo Type/Prompt>></em> <$edit-text field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify "$:/state/typeDropdown">> class="tw-edit-typeeditor"/> <$button popup=<<qualify "$:/state/typeDropdown">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <$button message="tw-remove-field" param="type" class="btn-invisible btn-icon">{{$:/core/images/delete-button}}</$button></$fieldmangler></p>
<div class="tw-block-dropdown-wrapper">
<$reveal state=<<qualify "$:/state/typeDropdown">> type="nomatch" text="" default="">
<div class="tw-block-dropdown tw-edit-type-dropdown">
<$linkcatcher to="!!type">
<$list filter='[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]each[group]sort[group]]'>
<div class="tw-dropdown-item">
<$text text={{!!group}}/>
</div>
<$list filter="[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]group{!!group}] +[sort[description]]"><$link to={{!!name}}><$view field="description"/> (<$view field="name"/>)</$link>
</$list>
</optgroup>
</$list>
</$select>
</$linkcatcher>
</div>
</$reveal>
</div>