1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 20:10:03 +00:00
TiddlyWiki5/core/ui/ControlPanel/Modals/AddPlugins.tid
Jeremy Ruston 55e3b8d66d Plugin improvements
* Improve docs
* Improve styling of subplugins
2019-09-28 11:49:09 +01:00

161 lines
6.6 KiB
Plaintext

title: $:/core/ui/ControlPanel/Modals/AddPlugins
subtitle: {{$:/core/images/download-button}} {{$:/language/ControlPanel/Plugins/Add/Caption}}
\define install-plugin-button()
<div>
<$button class={{{ [<assetInfo>get[original-title]get[version]then[tc-reinstall]] tc-btn-invisible tc-install-plugin +[join[ ]] }}}>
<$action-sendmessage $message="tm-load-plugin-from-library" url={{!!url}} title={{$(assetInfo)$!!original-title}}/>
<$set name="url" value={{!!url}}>
<$set name="currentTiddler" value=<<assetInfo>>>
<$list filter="[enlist{!!dependents}] [{!!parent-plugin}] +[sort[title]]" variable="dependency">
<$action-sendmessage $message="tm-load-plugin-from-library" url=<<url>> title=<<dependency>>/>
</$list>
</$set>
</$set>
{{$:/core/images/download-button}}
<$list filter="[<assetInfo>get[original-title]get[version]]" variable="installedVersion" emptyMessage="""{{$:/language/ControlPanel/Plugins/Install/Caption}}""">
{{$:/language/ControlPanel/Plugins/Reinstall/Caption}}
</$list>
</$button>
<div>
</div>
<$reveal stateTitle=<<assetInfo>> stateField="requires-reload" type="match" text="yes">{{$:/language/ControlPanel/Plugins/PluginWillRequireReload}}</$reveal>
</div>
\end
\define popup-state-macro()
$:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
\end
\define display-plugin-info(type)
<$set name="popup-state" value=<<popup-state-macro>>>
<div class="tc-plugin-info">
<div class="tc-plugin-info-chunk tc-plugin-info-toggle">
<$reveal type="nomatch" state=<<popup-state>> text="yes">
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<popup-state>> setTo="yes">
{{$:/core/images/chevron-right}}
</$button>
</$reveal>
<$reveal type="match" state=<<popup-state>> text="yes">
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<popup-state>> setTo="no">
{{$:/core/images/chevron-down}}
</$button>
</$reveal>
</div>
<div class="tc-plugin-info-chunk tc-plugin-info-icon">
<$list filter="[<assetInfo>has[icon]]" emptyMessage="""<$transclude tiddler="$:/core/images/plugin-generic-$type$"/>""">
<img src={{$(assetInfo)$!!icon}}/>
</$list>
</div>
<div class="tc-plugin-info-chunk tc-plugin-info-description">
<h1><strong><$text text={{{ [<assetInfo>get[name]] ~[<assetInfo>get[original-title]split[/]last[1]] }}}/></strong>: <$view tiddler=<<assetInfo>> field="description"/></h1>
<h2><$view tiddler=<<assetInfo>> field="original-title"/></h2>
<div><em><$view tiddler=<<assetInfo>> field="version"/></em></div>
</div>
<div class="tc-plugin-info-chunk tc-plugin-info-buttons">
<<install-plugin-button>>
</div>
</div>
<$reveal type="match" text="yes" state=<<popup-state>>>
<div class="tc-plugin-info-dropdown">
<div class="tc-plugin-info-dropdown-message">
<$list filter="[<assetInfo>get[original-title]get[version]]" variable="installedVersion" emptyMessage="""{{$:/language/ControlPanel/Plugins/NotInstalled/Hint}}""">
<em>
{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}
</em>
</$list>
<$set name="currentTiddler" value=<<assetInfo>>>
<$list filter="[enlist{!!dependents}] [<currentTiddler>get[parent-plugin]] +[limit[1]]" variable="ignore">
<div>
{{$:/language/ControlPanel/Plugins/AlsoRequires}}
<$list filter="[enlist{!!dependents}] [{!!parent-plugin}] +[sort[title]]" variable="dependency">
<$text text=<<dependency>>/>
</$list>
</div>
</$list>
</$set>
</div>
<div class="tc-plugin-info-dropdown-body">
<$transclude tiddler=<<assetInfo>> field="readme" mode="block"/>
</div>
<$set name="original-title" value={{{ [<assetInfo>get[original-title]] }}}>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>limit[1]]" variable="ignore">
<div class="tc-plugin-info-sub-plugins">
<$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>sort[title]sort[name]]" variable="assetInfo">
<<display-plugin-info "$type$">>
</$list>
</div>
</$list>
</$set>
</div>
</$reveal>
</$set>
\end
\define load-plugin-library-button()
<$button class="tc-btn-big-green">
<$action-sendmessage $message="tm-load-plugin-library" url={{!!url}} infoTitlePrefix="$:/temp/RemoteAssetInfo/"/>
{{$:/core/images/chevron-right}} {{$:/language/ControlPanel/Plugins/OpenPluginLibrary}}
</$button>
\end
\define display-server-assets(type)
{{$:/language/Search/Search}}: <$edit-text tiddler="""$:/temp/RemoteAssetSearch/$(currentTiddler)$""" default="" type="search" tag="input"/>
<$reveal state="""$:/temp/RemoteAssetSearch/$(currentTiddler)$""" type="nomatch" text="">
<$button class="tc-btn-invisible">
<$action-setfield $tiddler="""$:/temp/RemoteAssetSearch/$(currentTiddler)$""" $field="text" $value=""/>
{{$:/core/images/close-button}}
</$button>
</$reveal>
<div class="tc-plugin-library-listing">
<$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]search:author,description,original-title,readme,title{$:/temp/RemoteAssetSearch/$(currentTiddler)$}sort[title]sort[name]]" variable="assetInfo">
<$list filter="[[$:/temp/RemoteAssetSearch/$(currentTiddler)$]has[text]] ~[<assetInfo>!has[parent-plugin]]" variable="ignore"><!-- Hide sub-plugins if we're not searching -->
<<display-plugin-info "$type$">>
</$list>
</$list>
</div>
\end
\define display-server-connection()
<$list filter="[all[tiddlers+shadows]tag[$:/tags/ServerConnection]suffix{!!url}]" variable="connectionTiddler" emptyMessage=<<load-plugin-library-button>>>
<<tabs "[[$:/core/ui/ControlPanel/Plugins/Add/Plugins]] [[$:/core/ui/ControlPanel/Plugins/Add/Themes]] [[$:/core/ui/ControlPanel/Plugins/Add/Languages]]" "$:/core/ui/ControlPanel/Plugins/Add/Plugins">>
</$list>
\end
\define close-library-button()
<$reveal type='nomatch' state='$:/temp/ServerConnection/$(PluginLibraryURL)$' text=''>
<$button class='tc-btn-big-green'>
<$action-sendmessage $message="tm-unload-plugin-library" url={{!!url}}/>
{{$:/core/images/chevron-left}} {{$:/language/ControlPanel/Plugins/ClosePluginLibrary}}
<$action-deletetiddler $filter="[prefix[$:/temp/ServerConnection/$(PluginLibraryURL)$]][prefix[$:/temp/RemoteAssetInfo/$(PluginLibraryURL)$]]"/>
</$button>
</$reveal>
\end
\define plugin-library-listing()
<$list filter="[all[tiddlers+shadows]tag[$:/tags/PluginLibrary]]">
<div class="tc-plugin-library">
!! <$link><$transclude field="caption"><$view field="title"/></$transclude></$link>
//<$view field="url"/>//
<$transclude/>
<$set name=PluginLibraryURL value={{!!url}}>
<<close-library-button>>
</$set>
<<display-server-connection>>
</div>
</$list>
\end
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
<div>
<<plugin-library-listing>>
</div>