1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Plugin Chooser: Distinguish between install, reinstall, update and downgrade

This commit is contained in:
Jeremy Ruston 2020-04-13 10:04:14 +01:00
parent 245dab0c8c
commit 86296b67aa
4 changed files with 33 additions and 12 deletions

View File

@ -70,6 +70,7 @@ Plugins/Caption: Plugins
Plugins/Disable/Caption: disable
Plugins/Disable/Hint: Disable this plugin when reloading page
Plugins/Disabled/Status: (disabled)
Plugins/Downgrade/Caption: downgrade
Plugins/Empty/Hint: None
Plugins/Enable/Caption: enable
Plugins/Enable/Hint: Enable this plugin when reloading page
@ -87,9 +88,10 @@ Plugins/Plugins/Hint: Plugins
Plugins/Reinstall/Caption: reinstall
Plugins/Themes/Caption: Themes
Plugins/Themes/Hint: Theme plugins
Plugins/Update/Caption: update
Plugins/Updates/Caption: Updates
Plugins/Updates/Hint: Available updates to installed plugins
Plugins/Updates/UpdateAll/Caption: Update <<upgrade-count>> plugins
Plugins/Updates/UpdateAll/Caption: Update <<update-count>> plugins
Plugins/SubPluginPrompt: With <<count>> sub-plugins available
Saving/Caption: Saving
Saving/DownloadSaver/AutoSave/Description: Permit automatic saving for the download saver

View File

@ -14,15 +14,27 @@ subtitle: {{$:/core/images/download-button}} {{$:/language/ControlPanel/Plugins/
\define install-plugin-button()
<div>
<$button actions=<<install-plugin-actions>> class={{{ [<assetInfo>get[original-title]get[version]then[tc-reinstall]] tc-btn-invisible tc-install-plugin +[join[ ]] }}}>
<$set name="libraryVersion" value={{{ [<assetInfo>get[version]] }}}>
<$set name="installedVersion" value={{{ [<assetInfo>get[original-title]get[version]] }}}>
<$set name="reinstall-type" value={{{ [<libraryVersion>compare:version:eq<installedVersion>then[tc-reinstall]] [<libraryVersion>compare:version:gt<installedVersion>then[tc-reinstall-upgrade]] [<libraryVersion>compare:version:lt<installedVersion>then[tc-reinstall-downgrade]] }}}>
<$button actions=<<install-plugin-actions>> class={{{ [<assetInfo>get[original-title]has[version]then<reinstall-type>] tc-btn-invisible tc-install-plugin +[join[ ]] }}}>
{{$:/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 filter="[<assetInfo>get[original-title]get[version]]" variable="ignore" emptyMessage="{{$:/language/ControlPanel/Plugins/Install/Caption}}">
<$list filter="[<libraryVersion>compare:version:gt<installedVersion>]" variable="ignore" emptyMessage="""
<$list filter="[<libraryVersion>compare:version:lt<installedVersion>]" variable="ignore" emptyMessage="{{$:/language/ControlPanel/Plugins/Reinstall/Caption}}">
{{$:/language/ControlPanel/Plugins/Downgrade/Caption}}
</$list>
""">
{{$:/language/ControlPanel/Plugins/Update/Caption}}
</$list>
</$list>
</$button>
<div>
</div>
<$reveal stateTitle=<<assetInfo>> stateField="requires-reload" type="match" text="yes">{{$:/language/ControlPanel/Plugins/PluginWillRequireReload}}</$reveal>
</$set>
</$set>
</$set>
</div>
\end

View File

@ -1,7 +1,7 @@
title: $:/core/ui/ControlPanel/Plugins/Add/Updates
caption: <$importvariables filter="$:/core/ui/ControlPanel/Plugins/Add/Updates">{{$:/language/ControlPanel/Plugins/Updates/Caption}} (<<upgrade-count>>)</$importvariables>
caption: <$importvariables filter="$:/core/ui/ControlPanel/Plugins/Add/Updates">{{$:/language/ControlPanel/Plugins/Updates/Caption}} (<<update-count>>)</$importvariables>
\define each-upgradeable-plugin(body)
\define each-updateable-plugin(body)
<$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}sort[title]]" variable="assetInfo">
<$set name="libraryVersion" value={{{ [<assetInfo>get[version]] }}}>
<$list filter="[<assetInfo>get[original-title]has[version]!version<libraryVersion>]" variable="ignore">
@ -15,17 +15,17 @@ $body$
</$list>
\end
\define upgrade-all-actions()
<$macrocall $name="each-upgradeable-plugin" body="""
\define update-all-actions()
<$macrocall $name="each-updateable-plugin" body="""
<<install-plugin-actions>>
"""/>
\end
\define upgrade-count()
<$wikify name="count-filter" text=<<each-upgradeable-plugin "&#91;&#91;<$text text=<<assetInfo>>/>]]">>><$count filter=<<count-filter>>/></$wikify>
\define update-count()
<$wikify name="count-filter" text=<<each-updateable-plugin "&#91;&#91;<$text text=<<assetInfo>>/>]]">>><$count filter=<<count-filter>>/></$wikify>
\end
<$button actions=<<upgrade-all-actions>> class="tc-btn-invisible tc-install-plugin">
<$button actions=<<update-all-actions>> class="tc-btn-invisible tc-install-plugin">
{{$:/core/images/download-button}} {{||$:/language/ControlPanel/Plugins/Updates/UpdateAll/Caption}}
</$button>
@ -45,7 +45,7 @@ Available
Install
</th>
</tr>
<$macrocall $name="each-upgradeable-plugin" body="""<tr>
<$macrocall $name="each-updateable-plugin" body="""<tr>
<td>
<strong><$text text={{{ [<assetInfo>get[name]] ~[<assetInfo>get[original-title]split[/]last[1]] }}}/></strong>: <$view tiddler=<<assetInfo>> field="description"/>
<br>

View File

@ -2237,10 +2237,17 @@ a.tc-tiddlylink.tc-plugin-info:hover .tc-plugin-info > .tc-plugin-info-chunk > s
padding: 3px;
}
.tc-install-plugin.tc-reinstall-downgrade {
background: red;
}
.tc-install-plugin.tc-reinstall {
background: blue;
}
.tc-install-plugin.tc-reinstall-upgrade {
background: orange;
}
.tc-check-list {
line-height: 2em;