mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-17 03:20:02 +00:00
Comments plugin: Switch to using the list field to attach comments
https://github.com/Jermolene/TiddlyWiki5/issues/3378#issuecomment-413137626
This commit is contained in:
parent
763f8afaf2
commit
f210b75a30
@ -1,5 +1,7 @@
|
|||||||
title: $:/plugins/tiddlywiki/comments/add-comment-button-actions
|
title: $:/plugins/tiddlywiki/comments/add-comment-button-actions
|
||||||
|
|
||||||
<$set name="username" value={{$:/status/UserName}} emptyValue="(anonymous)">
|
<$set name="username" value={{$:/status/UserName}} emptyValue="(anonymous)">
|
||||||
<$action-createtiddler $basetitle={{{ [[Comment by ']addsuffix<username>addsuffix[' on ']addsuffix<currentTiddler>addsuffix[']] }}} comment-target=<<currentTiddler>> text="" edit-mode="yes"/>
|
<$set name="target" filter="[<currentTiddler>]">
|
||||||
|
<$action-createtiddler $basetitle={{{ [[Comment by ']addsuffix<username>addsuffix[' on ']addsuffix<currentTiddler>addsuffix[']] }}} role="comment" list=<<target>> text="" edit-mode="yes"/>
|
||||||
|
</$set>
|
||||||
</$set>
|
</$set>
|
||||||
|
@ -2,7 +2,7 @@ title: $:/plugins/tiddlywiki/comments/comments-template
|
|||||||
|
|
||||||
<div class="tc-comments">
|
<div class="tc-comments">
|
||||||
<ol class="tc-comment-list">
|
<ol class="tc-comment-list">
|
||||||
<$list filter="[all[tiddlers+shadows]comment-target<currentTiddler>sort[created]!has[draft.of]]">
|
<$list filter="[all[tiddlers+shadows]role[comment]contains<currentTiddler>sort[created]!has[draft.of]]">
|
||||||
<li>
|
<li>
|
||||||
<div class="tc-comment-entry">
|
<div class="tc-comment-entry">
|
||||||
<div class="tc-comment-entry-heading">
|
<div class="tc-comment-entry-heading">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
title: $:/plugins/tiddlywiki/comments/filter-all-comments
|
title: $:/plugins/tiddlywiki/comments/filter-all-comments
|
||||||
tags: $:/tags/Filter
|
tags: $:/tags/Filter
|
||||||
filter: [has[comment-target]!sort[modified]]
|
filter: [role[comment]!sort[modified]]
|
||||||
description: All comments
|
description: All comments
|
||||||
|
|
||||||
|
@ -2,8 +2,15 @@ title: $:/plugins/tiddlywiki/comments/header-view-template-segment
|
|||||||
tags: $:/tags/ViewTemplate
|
tags: $:/tags/ViewTemplate
|
||||||
list-before: $:/core/ui/ViewTemplate/body
|
list-before: $:/core/ui/ViewTemplate/body
|
||||||
|
|
||||||
<$list filter="[all[current]has[comment-target]]" variable="ignore">
|
<$list filter="[all[current]role[comment]]" variable="ignore">
|
||||||
<div class="tc-is-comment-header">
|
<div class="tc-is-comment-header">
|
||||||
This tiddler is a comment on <$link to={{!!comment-target}}><$text text={{!!comment-target}}/></$link>
|
This tiddler is a comment on:
|
||||||
|
<ul>
|
||||||
|
<$list filter="[list<currentTiddler>sort[title]]">
|
||||||
|
<li>
|
||||||
|
<$link to=<<currentTiddler>>><$text text=<<currentTiddler>>/></$link>
|
||||||
|
</li>
|
||||||
|
</$list>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</$list>
|
</$list>
|
||||||
|
@ -9,3 +9,15 @@ This plugin provides a simple means for adding threaded comments to tiddlers.
|
|||||||
* By default, comments are available on all non-system tiddlers. The ''config'' tab lets you customise which tiddlers can accept comments by specifying a filter extension
|
* By default, comments are available on all non-system tiddlers. The ''config'' tab lets you customise which tiddlers can accept comments by specifying a filter extension
|
||||||
* The buttons for adding and editing comments are only available if the system tiddler [[$:/status/IsReadOnly]] is not set to `yes`
|
* The buttons for adding and editing comments are only available if the system tiddler [[$:/status/IsReadOnly]] is not set to `yes`
|
||||||
* Use the "All comments" option in the $:/AdvancedSearch ''Filter'' tab to see or export all comments
|
* Use the "All comments" option in the $:/AdvancedSearch ''Filter'' tab to see or export all comments
|
||||||
|
|
||||||
|
!! Data Model
|
||||||
|
|
||||||
|
The data model employed by the comments plugin is very simple:
|
||||||
|
|
||||||
|
* Comment tiddlers are identified by the `role` field being set to `comment`
|
||||||
|
* The `list` field of comment tiddlers lists the tiddlers to which this comment applies
|
||||||
|
** It is thus possible for a comment to be applied to multiple tiddlers at once
|
||||||
|
** The links between comments can be preserved when renaming them by using the relink checkbox in the edit template
|
||||||
|
* The `edit-mode` field of comment tiddlers is set to `yes` to display it in edit mode, or `no` to display it in view mode
|
||||||
|
* The `saved-text` field is updated when switching to edit mode so that it can be restored if the user cancels
|
||||||
|
|
||||||
|
@ -3,12 +3,15 @@ tags: $:/tags/SideBar
|
|||||||
caption: Comments
|
caption: Comments
|
||||||
|
|
||||||
<div class="tc-timeline">
|
<div class="tc-timeline">
|
||||||
<$list filter="[all[tiddlers+shadows]has[comment-target]has[modified]!sort[modified]eachday[modified]]">
|
<$list filter="[all[tiddlers+shadows]role[comment]has[modified]!sort[modified]eachday[modified]]">
|
||||||
<div class="tc-menu-list-item">
|
<div class="tc-menu-list-item">
|
||||||
<$view field="modified" format="date" template="DDth MMM YYYY"/>
|
<$view field="modified" format="date" template="DDth MMM YYYY"/>
|
||||||
<$list filter="[all[tiddlers+shadows]has[comment-target]sameday:modified{!!modified}!sort[modified]]">
|
<$list filter="[all[tiddlers+shadows]role[comment]sameday:modified{!!modified}!sort[modified]]">
|
||||||
<div class="tc-menu-list-subitem">
|
<div class="tc-menu-list-subitem">
|
||||||
<$link>Comment by '<$view field="modifier">(anonymous)</$view>' on <$text text={{!!comment-target}}/></$link>
|
<$link>Comment by '<$view field="modifier">(anonymous)</$view>'</$link> on
|
||||||
|
<$list filter="[list<currentTiddler>sort[title]]">
|
||||||
|
<$link to=<<currentTiddler>>><$text text=<<currentTiddler>>/></$link>
|
||||||
|
</$list>
|
||||||
</div>
|
</div>
|
||||||
</$list>
|
</$list>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user