From 9e03264ebe141a5dc4d37dcb62f3bbf2f740d983 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Tue, 3 Apr 2018 17:50:57 +0100 Subject: [PATCH] Add pluggable previews to the import listing --- core/language/en-GB/Import.multids | 6 ++++++ core/ui/ImportListing.tid | 10 ++++++---- core/ui/ImportPreviews/Diff.tid | 5 +++++ core/ui/ImportPreviews/DiffFields.tid | 5 +++++ core/ui/ImportPreviews/Fields.tid | 7 +++++++ core/ui/ImportPreviews/Text.tid | 5 +++++ core/ui/ImportPreviews/TextRaw.tid | 5 +++++ core/ui/ViewTemplate/import.tid | 16 ++++++++++++---- .../tw5.com/tiddlers/concepts/SystemTags.tid | 1 + themes/tiddlywiki/vanilla/base.tid | 14 ++++++++++++++ 10 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 core/ui/ImportPreviews/Diff.tid create mode 100644 core/ui/ImportPreviews/DiffFields.tid create mode 100644 core/ui/ImportPreviews/Fields.tid create mode 100644 core/ui/ImportPreviews/Text.tid create mode 100644 core/ui/ImportPreviews/TextRaw.tid diff --git a/core/language/en-GB/Import.multids b/core/language/en-GB/Import.multids index 697d3b510..083086606 100644 --- a/core/language/en-GB/Import.multids +++ b/core/language/en-GB/Import.multids @@ -7,6 +7,12 @@ Listing/Import/Caption: Import Listing/Select/Caption: Select Listing/Status/Caption: Status Listing/Title/Caption: Title +Listing/Preview: Preview: +Listing/Preview/Text: Text +Listing/Preview/TextRaw: Text (Raw) +Listing/Preview/Fields: Fields +Listing/Preview/Diff: Diff +Listing/Preview/DiffFields: Diff (Fields) Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <> being older than existing <>) Upgrader/Plugins/Upgraded: Upgraded plugin from <> to <> diff --git a/core/ui/ImportListing.tid b/core/ui/ImportListing.tid index 4917ffedc..ddf49a8ce 100644 --- a/core/ui/ImportListing.tid +++ b/core/ui/ImportListing.tid @@ -41,12 +41,12 @@ $(currentTiddler)$!!popup-$(payloadTiddler)$ <$checkbox field=<> checked="checked" unchecked="unchecked" default="checked"/> -<$reveal type="nomatch" state=<> text="yes"> +<$reveal type="nomatch" state=<> text="yes" tag="div"> <$button class="tc-btn-invisible tc-btn-dropdown" set=<> setTo="yes"> {{$:/core/images/right-arrow}} <$text text=<>/> -<$reveal type="match" state=<> text="yes"> +<$reveal type="match" state=<> text="yes" tag="div"> <$button class="tc-btn-invisible tc-btn-dropdown" set=<> setTo="no"> {{$:/core/images/down-arrow}} <$text text=<>/> @@ -58,8 +58,10 @@ $(currentTiddler)$!!popup-$(payloadTiddler)$ -<$reveal type="match" text="yes" state=<>> -<$macrocall $name="compareTiddlerText" sourceTiddlerTitle=<> destTiddlerTitle=<> destSubTiddlerTitle=<>/> +<$reveal type="match" text="yes" state=<> tag="div"> +<$list filter="[{$:/state/importpreviewtype}has[text]]" variable="listItem" emptyMessage={{$:/core/ui/ImportPreviews/Text}}> +<$transclude tiddler={{$:/state/importpreviewtype}}/> + diff --git a/core/ui/ImportPreviews/Diff.tid b/core/ui/ImportPreviews/Diff.tid new file mode 100644 index 000000000..18c367b99 --- /dev/null +++ b/core/ui/ImportPreviews/Diff.tid @@ -0,0 +1,5 @@ +title: $:/core/ui/ImportPreviews/Diff +tags: $:/tags/ImportPreview +caption: {{$:/language/Import/Listing/Preview/Diff}} + +<$macrocall $name="compareTiddlerText" sourceTiddlerTitle=<> destTiddlerTitle=<> destSubTiddlerTitle=<>/> diff --git a/core/ui/ImportPreviews/DiffFields.tid b/core/ui/ImportPreviews/DiffFields.tid new file mode 100644 index 000000000..d02db4fb4 --- /dev/null +++ b/core/ui/ImportPreviews/DiffFields.tid @@ -0,0 +1,5 @@ +title: $:/core/ui/ImportPreviews/DiffFields +tags: $:/tags/ImportPreview +caption: {{$:/language/Import/Listing/Preview/DiffFields}} + +<$macrocall $name="compareTiddlers" sourceTiddlerTitle=<> destTiddlerTitle=<> destSubTiddlerTitle=<> exclude="text"/> diff --git a/core/ui/ImportPreviews/Fields.tid b/core/ui/ImportPreviews/Fields.tid new file mode 100644 index 000000000..cb237ea96 --- /dev/null +++ b/core/ui/ImportPreviews/Fields.tid @@ -0,0 +1,7 @@ +title: $:/core/ui/ImportPreviews/Fields +tags: $:/tags/ImportPreview +caption: {{$:/language/Import/Listing/Preview/Fields}} + +<$tiddler tiddler=<>> +<$transclude tiddler="$:/core/ui/TiddlerFields"/> + diff --git a/core/ui/ImportPreviews/Text.tid b/core/ui/ImportPreviews/Text.tid new file mode 100644 index 000000000..0156a63c0 --- /dev/null +++ b/core/ui/ImportPreviews/Text.tid @@ -0,0 +1,5 @@ +title: $:/core/ui/ImportPreviews/Text +tags: $:/tags/ImportPreview +caption: {{$:/language/Import/Listing/Preview/Text}} + +<$transclude tiddler=<> mode="block"/> diff --git a/core/ui/ImportPreviews/TextRaw.tid b/core/ui/ImportPreviews/TextRaw.tid new file mode 100644 index 000000000..ddaba4c30 --- /dev/null +++ b/core/ui/ImportPreviews/TextRaw.tid @@ -0,0 +1,5 @@ +title: $:/core/ui/ImportPreviews/TextRaw +tags: $:/tags/ImportPreview +caption: {{$:/language/Import/Listing/Preview/TextRaw}} + +
<$view tiddler=<>/>
\ No newline at end of file diff --git a/core/ui/ViewTemplate/import.tid b/core/ui/ViewTemplate/import.tid index 9dc4a52ea..4de7539b3 100644 --- a/core/ui/ViewTemplate/import.tid +++ b/core/ui/ViewTemplate/import.tid @@ -3,19 +3,27 @@ tags: $:/tags/ViewTemplate \define lingo-base() $:/language/Import/ +\define buttons() +<$button message="tm-delete-tiddler" param=<>><> +<$button message="tm-perform-import" param=<>><> +<> <$select tiddler="$:/state/importpreviewtype" default="$:/core/ui/ImportPreviews/Text"> +<$list filter="[all[shadows+tiddlers]tag[$:/tags/ImportPreview]!has[draft.of]]"> + + + +\end + <$list filter="[all[current]field:plugin-type[import]]">
<> -<$button message="tm-delete-tiddler" param=<>><> -<$button message="tm-perform-import" param=<>><> +<> {{||$:/core/ui/ImportListing}} -<$button message="tm-delete-tiddler" param=<>><> -<$button message="tm-perform-import" param=<>><> +<>
diff --git a/editions/tw5.com/tiddlers/concepts/SystemTags.tid b/editions/tw5.com/tiddlers/concepts/SystemTags.tid index f15cbb41d..d74c113fb 100644 --- a/editions/tw5.com/tiddlers/concepts/SystemTags.tid +++ b/editions/tw5.com/tiddlers/concepts/SystemTags.tid @@ -29,6 +29,7 @@ These are the available system tags |<> |for the exporters | |<> |for filters in advanced seach sample filter dropdown | |<> |for (core) images | +|<> |for preview types for the import listing | |<> |for the tiddler manager. $:/Manager | |<> |for the tiddler manager | |<> |for global macros | diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 27729f06a..a3f2160ab 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -2410,6 +2410,20 @@ body.tc-dirty span.tc-dirty-indicator, body.tc-dirty span.tc-dirty-indicator svg color: <>; } +.tc-diff-tiddlers th { + text-align: right; + background: <>; + font-weight: normal; + font-style: italic; +} + +.tc-diff-tiddlers pre { + margin: 0; + padding: 0; + border: none; + background: none; +} + /* ** Errors */