2013-11-15 22:55:32 +00:00
|
|
|
title: $:/core/ui/EditTemplate/fields
|
|
|
|
tags: $:/tags/EditTemplate
|
2013-06-08 16:34:51 +00:00
|
|
|
|
2024-10-24 13:34:23 +00:00
|
|
|
\procedure lingo-base() $:/language/EditTemplate/
|
|
|
|
\function tf.config-title() [[$:/config/EditTemplateFields/Visibility/]addsuffix[$(currentField)$]substitute[]get[text]]
|
2014-12-04 09:39:14 +00:00
|
|
|
|
2024-10-24 13:34:23 +00:00
|
|
|
\function tf.config-filter() [[hide]] :except[title<tf.config-title>]
|
2014-12-04 09:39:14 +00:00
|
|
|
|
2022-12-05 22:05:20 +00:00
|
|
|
<!-- Beware this is duplicated from EditTemplate.tid. For details see bug #7054 -->
|
2024-10-24 13:34:23 +00:00
|
|
|
\procedure get-field-value-tiddler-filter() [subfilter<get-field-editor-filter>sha256[16]addprefix[/]addprefix<newFieldValueTiddlerPrefix>]
|
|
|
|
\procedure get-field-editor-filter() [<newFieldNameTiddler>get[text]else[]] :cascade[all[shadows+tiddlers]tag[$:/tags/FieldEditorFilter]!is[draft]get[text]] :and[!is[blank]else{$:/core/ui/EditTemplate/fieldEditor/default}]
|
2022-12-05 22:05:20 +00:00
|
|
|
|
2024-10-24 13:34:23 +00:00
|
|
|
\procedure prefix.bracket() [
|
|
|
|
\procedure suffix.bracket() ]
|
|
|
|
|
|
|
|
\function tf.current-tiddler-new-field-selector() [[data-tiddler-title=]addprefix[$(prefix.bracket)$]substitute[]addsuffix<currentTiddlerCSSescaped>addsuffix[$(suffix.bracket)$]substitute[]] .tc-edit-field-add-name-wrapper input :and[join[ ]]
|
2019-10-14 13:31:57 +00:00
|
|
|
|
2024-10-24 13:34:23 +00:00
|
|
|
\procedure new-field-actions()
|
2022-03-26 15:18:42 +00:00
|
|
|
\whitespace trim
|
2022-05-14 12:30:04 +00:00
|
|
|
<$action-sendmessage $message="tm-add-field" $name={{{ [<newFieldNameTiddler>get[text]] }}} $value={{{ [<newFieldNameTiddler>get[text]] :map[subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
2022-12-05 22:05:20 +00:00
|
|
|
<$set name="safeNewFieldValueTiddlerPrefix" value=<<newFieldValueTiddlerPrefix>> emptyValue=<<qualify "$:/temp/NewFieldValue">> >
|
|
|
|
<$action-deletetiddler $filter="[<newFieldNameTiddler>] [prefix[$:/temp/NewFieldValue]prefix<safeNewFieldValueTiddlerPrefix>] [<storeTitle>] [<searchListState>]"/>
|
|
|
|
</$set>
|
2024-10-24 13:34:23 +00:00
|
|
|
<$action-sendmessage $message="tm-focus-selector" $param=<<tf.current-tiddler-new-field-selector>>/>
|
2019-10-14 13:31:57 +00:00
|
|
|
\end
|
|
|
|
|
2024-10-24 13:34:23 +00:00
|
|
|
\procedure delete-state-tiddlers() <$action-deletetiddler $filter="[<newFieldNameTiddler>] [<storeTitle>] [<searchListState>]"/>
|
2020-10-28 17:16:20 +00:00
|
|
|
|
2024-10-24 13:34:23 +00:00
|
|
|
\procedure cancel-search-actions-inner()
|
2022-03-26 15:18:42 +00:00
|
|
|
\whitespace trim
|
|
|
|
<$list
|
|
|
|
filter="[<storeTitle>has[text]] [<newFieldNameTiddler>has[text]]"
|
|
|
|
variable="ignore"
|
|
|
|
emptyMessage="<<cancel-delete-tiddler-actions 'cancel'>>">
|
2020-10-28 17:16:20 +00:00
|
|
|
<<delete-state-tiddlers>>
|
|
|
|
</$list>
|
|
|
|
\end
|
|
|
|
|
2024-10-24 13:34:23 +00:00
|
|
|
\procedure cancel-search-actions()
|
2022-03-26 15:18:42 +00:00
|
|
|
\whitespace trim
|
2020-11-02 19:08:24 +00:00
|
|
|
<$set name="userInput" value={{{ [<storeTitle>get[text]] }}}>
|
2022-03-26 15:18:42 +00:00
|
|
|
<$list
|
|
|
|
filter="[<newFieldNameTiddler>get[text]!match<userInput>]"
|
|
|
|
emptyMessage="<<cancel-search-actions-inner>>">
|
2020-11-02 19:08:24 +00:00
|
|
|
<$action-setfield $tiddler=<<newFieldNameTiddler>> text=<<userInput>>/><$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
|
|
|
</$list>
|
|
|
|
</$set>
|
|
|
|
\end
|
|
|
|
|
2024-10-24 13:34:23 +00:00
|
|
|
\procedure new-field()
|
2022-03-26 15:18:42 +00:00
|
|
|
\whitespace trim
|
2019-10-14 13:31:57 +00:00
|
|
|
<$vars name={{{ [<newFieldNameTiddler>get[text]] }}}>
|
2015-04-03 08:06:57 +00:00
|
|
|
<$reveal type="nomatch" text="" default=<<name>>>
|
2023-11-18 16:13:27 +00:00
|
|
|
<$button tooltip={{$:/language/EditTemplate/Fields/Add/Button/Hint}}>
|
2018-04-24 21:03:59 +00:00
|
|
|
<$action-sendmessage $message="tm-add-field"
|
|
|
|
$name=<<name>>
|
2022-05-14 12:30:04 +00:00
|
|
|
$value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
2022-12-05 22:05:20 +00:00
|
|
|
<$set name="safeNewFieldValueTiddlerPrefix" value=<<newFieldValueTiddlerPrefix>> emptyValue=<<qualify "$:/temp/NewFieldValue">> >
|
|
|
|
<$action-deletetiddler $filter="[<newFieldNameTiddler>] [prefix[$:/temp/NewFieldValue]prefix<safeNewFieldValueTiddlerPrefix>] [<storeTitle>] [<searchListState>]"/>
|
|
|
|
</$set>
|
2014-12-04 09:39:14 +00:00
|
|
|
<<lingo Fields/Add/Button>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
2015-04-03 08:06:57 +00:00
|
|
|
<$reveal type="match" text="" default=<<name>>>
|
2014-12-04 09:39:14 +00:00
|
|
|
<$button>
|
|
|
|
<<lingo Fields/Add/Button>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
2018-04-24 21:03:59 +00:00
|
|
|
</$vars>
|
2015-04-03 08:06:57 +00:00
|
|
|
\end
|
2019-08-02 14:05:30 +00:00
|
|
|
\whitespace trim
|
2015-04-03 08:06:57 +00:00
|
|
|
|
2022-12-05 22:05:20 +00:00
|
|
|
<$set name="newFieldValueTiddlerPrefix" value=<<newFieldValueTiddlerPrefix>> emptyValue=<<qualify "$:/temp/NewFieldValue">> >
|
2023-06-21 16:13:33 +00:00
|
|
|
<div class="tc-edit-fields">
|
2024-10-24 13:34:23 +00:00
|
|
|
<table class={{{ [all[current]fields[]] :filter[lookup[$:/config/EditTemplateFields/Visibility/]!match[hide]] :and[count[]!match[0]] :and[then[tc-edit-fields]] :else[[tc-edit-fields tc-edit-fields-small]] }}}>
|
2014-04-06 21:49:59 +00:00
|
|
|
<tbody>
|
2024-10-24 13:34:23 +00:00
|
|
|
<$list filter="[all[current]fields[]] :and[sort[title]]" variable="currentField" storyview="pop">
|
|
|
|
<$list filter=<<tf.config-filter>> variable="temp">
|
2014-08-28 17:47:21 +00:00
|
|
|
<tr class="tc-edit-field">
|
|
|
|
<td class="tc-edit-field-name">
|
2014-04-06 21:49:59 +00:00
|
|
|
<$text text=<<currentField>>/>:</td>
|
2014-08-28 17:47:21 +00:00
|
|
|
<td class="tc-edit-field-value">
|
2024-10-24 13:34:23 +00:00
|
|
|
<$keyboard key="((delete-field))" actions="""<$action-deletefield $field=<<currentField>>/><$set name="currentTiddlerCSSescaped" value={{{ [<currentTiddler>escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<<tf.current-tiddler-new-field-selector>>/></$set>""">
|
2022-03-17 17:06:24 +00:00
|
|
|
<$transclude tiddler={{{ [<currentField>] :cascade[all[shadows+tiddlers]tag[$:/tags/FieldEditorFilter]!is[draft]get[text]] :and[!is[blank]else{$:/core/ui/EditTemplate/fieldEditor/default}] }}} />
|
2020-11-06 16:27:41 +00:00
|
|
|
</$keyboard>
|
2014-04-06 21:49:59 +00:00
|
|
|
</td>
|
2014-08-28 17:47:21 +00:00
|
|
|
<td class="tc-edit-field-remove">
|
2014-11-07 21:15:21 +00:00
|
|
|
<$button class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>
|
2023-10-25 12:29:40 +00:00
|
|
|
<$action-deletefield $field=<<currentField>>/>
|
2014-11-06 18:32:11 +00:00
|
|
|
{{$:/core/images/delete-button}}
|
|
|
|
</$button>
|
2014-04-06 21:49:59 +00:00
|
|
|
</td>
|
2013-10-21 22:10:20 +00:00
|
|
|
</tr>
|
2014-08-10 08:13:56 +00:00
|
|
|
</$list>
|
2013-10-21 22:10:20 +00:00
|
|
|
</$list>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2013-06-08 16:34:51 +00:00
|
|
|
</div>
|
|
|
|
|
2014-12-04 09:39:14 +00:00
|
|
|
<$fieldmangler>
|
2023-06-21 16:13:33 +00:00
|
|
|
<div class="tc-edit-field-add">
|
2021-03-26 09:32:12 +00:00
|
|
|
<em class="tc-edit tc-small-gap-right">
|
2020-10-28 13:13:55 +00:00
|
|
|
<<lingo Fields/Add/Prompt>>
|
2014-11-06 18:24:33 +00:00
|
|
|
</em>
|
2020-11-16 16:54:29 +00:00
|
|
|
<$vars refreshTitle=<<qualify "$:/temp/fieldname/refresh">> storeTitle=<<newFieldNameInputTiddler>> searchListState=<<newFieldNameSelectionTiddler>>>
|
2020-11-15 15:49:43 +00:00
|
|
|
<div class="tc-edit-field-add-name-wrapper">
|
2024-10-24 13:34:23 +00:00
|
|
|
<$transclude $variable="keyboard-driven-input" tiddler=<<newFieldNameTiddler>> storeTitle=<<storeTitle>> refreshTitle=<<refreshTitle>>
|
2020-10-28 17:16:20 +00:00
|
|
|
selectionStateTitle=<<searchListState>> tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Name/Placeholder}}
|
|
|
|
focusPopup=<<qualify "$:/state/popup/field-dropdown">> class="tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}}
|
2024-10-24 13:34:23 +00:00
|
|
|
focus={{{ [{$:/config/AutoFocus}match[fields]then[true]] :else[[false]] }}} cancelPopups="yes"
|
2020-10-28 17:16:20 +00:00
|
|
|
configTiddlerFilter="[[$:/config/EditMode/fieldname-filter]]" inputCancelActions=<<cancel-search-actions>> />
|
2020-10-28 13:13:55 +00:00
|
|
|
<$button popup=<<qualify "$:/state/popup/field-dropdown">> class="tc-btn-invisible tc-btn-dropdown tc-small-gap" tooltip={{$:/language/EditTemplate/Field/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Field/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button>
|
2015-06-29 17:45:41 +00:00
|
|
|
<$reveal state=<<qualify "$:/state/popup/field-dropdown">> type="nomatch" text="" default="">
|
|
|
|
<div class="tc-block-dropdown tc-edit-type-dropdown">
|
2018-11-24 15:53:39 +00:00
|
|
|
<$set name="tv-show-missing-links" value="yes">
|
2019-10-14 13:31:57 +00:00
|
|
|
<$linkcatcher to=<<newFieldNameTiddler>>>
|
2015-06-29 17:45:41 +00:00
|
|
|
<div class="tc-dropdown-item">
|
2015-07-01 14:58:49 +00:00
|
|
|
<<lingo Fields/Add/Dropdown/User>>
|
|
|
|
</div>
|
2020-10-28 17:16:20 +00:00
|
|
|
<$set name="newFieldName" value={{{ [<storeTitle>get[text]] }}}>
|
2024-10-24 13:34:23 +00:00
|
|
|
<$list filter="[!is[shadow]!is[system]fields[]search:title<newFieldName>sort[]] :except[[created]] :except[[creator]] :except[[draft.of]] :except[[draft.title]] :except[[modified]] :except[[modifier]] :except[[tags]] :except[[text]] :except[[title]] :except[[type]]" variable="currentField">
|
|
|
|
<$list filter="[<currentField>addsuffix[-primaryList]] :except[<searchListState>get[text]]" emptyMessage="""<$link to=<<currentField>> class="tc-list-item-selected"><$text text=<<currentField>>/></$link>""">
|
2015-06-29 17:45:41 +00:00
|
|
|
<$link to=<<currentField>>>
|
2019-08-30 09:44:23 +00:00
|
|
|
<$text text=<<currentField>>/>
|
2015-06-29 17:45:41 +00:00
|
|
|
</$link>
|
|
|
|
</$list>
|
2020-10-28 17:16:20 +00:00
|
|
|
</$list>
|
2015-07-01 14:58:49 +00:00
|
|
|
<div class="tc-dropdown-item">
|
|
|
|
<<lingo Fields/Add/Dropdown/System>>
|
|
|
|
</div>
|
2024-10-24 13:34:23 +00:00
|
|
|
<$list filter="[fields[]search:title<newFieldName>sort[]] :except[!is[shadow]!is[system]fields[]]" variable="currentField">
|
|
|
|
<$list filter="[<currentField>addsuffix[-secondaryList]] :except[<searchListState>get[text]]" emptyMessage="""<$link to=<<currentField>> class="tc-list-item-selected"><$text text=<<currentField>>/></$link>""">
|
2015-06-29 17:45:41 +00:00
|
|
|
<$link to=<<currentField>>>
|
2019-08-30 09:44:23 +00:00
|
|
|
<$text text=<<currentField>>/>
|
2015-06-29 17:45:41 +00:00
|
|
|
</$link>
|
|
|
|
</$list>
|
2020-10-28 17:16:20 +00:00
|
|
|
</$list>
|
2019-10-14 13:31:57 +00:00
|
|
|
</$set>
|
2015-06-29 17:45:41 +00:00
|
|
|
</$linkcatcher>
|
2018-11-24 13:36:48 +00:00
|
|
|
</$set>
|
2015-06-29 17:45:41 +00:00
|
|
|
</div>
|
|
|
|
</$reveal>
|
2020-06-11 11:18:31 +00:00
|
|
|
</div>
|
2022-05-14 12:30:04 +00:00
|
|
|
<$let currentTiddlerCSSescaped={{{ [<currentTiddler>escapecss[]] }}} currentTiddler={{{ [subfilter<get-field-value-tiddler-filter>] }}} currentField="text" currentFieldName={{{ [<newFieldNameTiddler>get[text]] }}}>
|
2020-10-28 13:13:55 +00:00
|
|
|
<span class="tc-edit-field-add-value tc-small-gap-right">
|
2019-10-14 13:31:57 +00:00
|
|
|
<$keyboard key="((add-field))" actions=<<new-field-actions>>>
|
2022-05-14 12:30:04 +00:00
|
|
|
<$transclude tiddler={{{ [subfilter<get-field-editor-filter>] }}} />
|
2019-10-14 13:31:57 +00:00
|
|
|
</$keyboard>
|
2020-10-28 13:13:55 +00:00
|
|
|
</span>
|
2014-11-06 18:24:33 +00:00
|
|
|
<span class="tc-edit-field-add-button">
|
2024-10-24 13:34:23 +00:00
|
|
|
<$transclude $variable="new-field"/>
|
2014-04-06 21:49:59 +00:00
|
|
|
</span>
|
2022-03-17 17:06:24 +00:00
|
|
|
</$let>
|
2020-11-15 15:49:43 +00:00
|
|
|
</$vars>
|
2014-04-06 21:49:59 +00:00
|
|
|
</div>
|
2014-12-04 09:39:14 +00:00
|
|
|
</$fieldmangler>
|
2022-12-05 22:05:20 +00:00
|
|
|
</$set>
|