[TW5] New Plugin: tobibeer/rate ★★★★★

395 views
Skip to first unread message

Tobias Beer

unread,
Jan 5, 2016, 9:23:40 AM1/5/16
to TiddlyWiki
Hi everyone,

Motivated by this request and inspired by Mat's post,

...providing a flexible little macro and view-template to rate tiddlers.

Best wishes,

Tobias.

Tobias Beer

unread,
Jan 5, 2016, 12:33:23 PM1/5/16
to tiddl...@googlegroups.com
Hi everyone,

Not even half a day old, here's version 0.6.0 of tobibeer/rate:

Here's what the ratings macro produces:
<<ratings>>

Best wishes,

Tobias.

Jon

unread,
Jan 5, 2016, 1:04:05 PM1/5/16
to TiddlyWiki
Hi Tobias,

I've no idea about half the stuff that you're producing, but I feel grateful to you anyway!

You're a machine!

Regards
Jon

Tobias Beer

unread,
Jan 5, 2016, 2:10:40 PM1/5/16
to TiddlyWiki
Hi Jon,
 
I've no idea about half the stuff that you're producing, but I feel grateful to you anyway!

Thanks for the feedback.

Hope you can put it all to good use
and find my stuff easy (enough) to use. 

Best wishes,

Tobias.

Mat

unread,
Jan 5, 2016, 3:31:51 PM1/5/16
to TiddlyWiki
I'm very happy to see this! Great stuff Tobias. Producing like a machine... I'd add gun to that! :-)

<:-)

Tobias Beer

unread,
Jan 5, 2016, 3:36:24 PM1/5/16
to TiddlyWiki
Hi Mat,
 
I'm very happy to see this! Great stuff Tobias. Producing like a machine... I'd add gun to that! :-)

I'm all for gun-control. :D

Best wishes,

Tobias. 

Tobias Beer

unread,
Jan 5, 2016, 3:52:08 PM1/5/16
to TiddlyWiki
Once again, a little update to version 0.6.1 of tobibeer/rate:


For one, I forgot to update the plugin version for 0.6.0.
Other than that, 0.6.1 has some minor improvements
concerning the style of the reset button.

Best wishes,

Tobias.

PMario

unread,
Jan 5, 2016, 3:59:49 PM1/5/16
to TiddlyWiki, Jeremy Ruston
Hi Tobias,
Nice!

I think there is a little problem with the CSS class names.  TW used a tw-prefix to point out that classes, messages, variables are "tw core stuff".

Since the tw- prefix was a bit to generic, it was changed with beta 16. http://tiddlywiki.com/#Release%205.0.16-beta to, tc- .. classes, tm- .. messages, tv- .. variables

So your tc-rating may be tb-c-rating ... otherwise the class name suggests, that it is a core class.

There is no best practice for plugin class naming conventions yet, so we should probably create one.
my classes may be pm-c-xxxx

@Jermolene what do you think about plugin / author class names? Or should we overwrite / reuse the core prefixes?

have fun!
mario

Tobias Beer

unread,
Jan 5, 2016, 4:03:06 PM1/5/16
to TiddlyWiki, jeremy...@gmail.com
Hi Mario,
 
So your tc-rating may be tb-c-rating ... otherwise the class name suggests, that it is a core class.

Not sure it's needed but I could go with tb-rating.
As for those conventions, the same thing kinda applies to field-names.

I mean, I am using the "rating" field as a default.
Should that also be tb-rating?
I don't think it should.

Best wishes,

Tobias.

PMario

unread,
Jan 5, 2016, 4:17:16 PM1/5/16
to TiddlyWiki, jeremy...@gmail.com


On Tuesday, January 5, 2016 at 10:03:06 PM UTC+1, Tobias Beer wrote:
Hi Mario,
 
So your tc-rating may be tb-c-rating ... otherwise the class name suggests, that it is a core class.

Not sure it's needed but I could go with tb-rating.
 
You could, but you may find out, that you may want to create custom messages in the future too. so imo tb-m-xxx may be the right move.
tbc- using your initials, would be possible too, but I think it's too similar to tc-...  so I added the additional "-"..
pmc would work for my initials, but in favour of consistency I'd use pm-c  :)
 
As for those conventions, the same thing kinda applies to field-names.

I mean, I am using the "rating" field as a default.
Should that also be tb-rating?
I don't think it should.

If we want consistency, you probably should. ... Only the future will tell, if your plugins cause naming clashes with user content.

Let's see, what Jeremy thinks.

-m

Tobias Beer

unread,
Jan 6, 2016, 8:14:01 AM1/6/16
to tiddl...@googlegroups.com, jeremy...@gmail.com
Hi Mario,
 
You could, but you may find out, that you may want to create custom messages in the future too. so imo tb-m-xxx may be the right move.
tbc- using your initials, would be possible too, but I think it's too similar to tc-...  so I added the additional "-"..
pmc would work for my initials, but in favour of consistency I'd use pm-c  :)

I think this level of complexity is mildly over-engineering, but perhaps that's short sighted. It would be relevant if I wanted to have all classes and messages and other things as tiddler titles in my documentation... but then there are other ways to go about it.

This is literally why I prefer to keep the core prefixes, because then their meaning is clear... to anyone not just me... that we're dealing with a certain type of functional construct.

But then this would require some verbose naming that goes something like this:

tc-tb-rating

That does not look like something I want. In fact, there is always a chance that existing code and components will at some point clash with new core modules / macros / widgets and what not. Sure, I can avoid that by prefixing everything I do with some shorthand:

<$tb-appear/>

Let me just say: I am not going to do that, not going to change any of the classes in the appear widget.

If we want consistency, you probably should. ... Only the future will tell, if your plugins cause naming clashes with user content. 

Which is why tobibeer/rate allows you to specify your own rating field. Honestly, atm, I think I do not want any more or different prefixes. Whomever already has such a field with different content will have to chose another "rating" field anyway... or decide on one rating implementation or another, but not both.

Best wishes,

Tobias.

pmar...@gmail.com

unread,
Jan 7, 2016, 6:53:31 AM1/7/16
to tiddl...@googlegroups.com
2016-01-06 14:14 GMT+01:00 Tobias Beer <beert...@gmail.com>:

That does not look like something I want. In fact, there is always a chance that existing code and components will at some point clash with new core modules / macros / widgets and what not. Sure, I can avoid that by prefixing everything I do with some shorthand:

<$tb-appear/>

Let me just say: I am going to do that, not going to change any of the classes in the appear widget.


If you are the first one that creates an appear widget, you basically have the chance to define the name you want. So everyone will be fine with <$appear>. .. but the core styling classes should be only used by the core and nobody else.

We have seen best practice in TWc plugins. Good plugins, that can be used by everyone have there own preficed classes, if they need special styling. "Weak" plugins caused trouble.

-mario

PMario

unread,
Jan 7, 2016, 6:57:41 AM1/7/16
to tiddl...@googlegroups.com
On Thursday, January 7, 2016 at 12:53:31 PM UTC+1, PMario wrote:
If you are the first one that creates an appear widget, you basically have the chance to define the name you want. So everyone will be fine with <$appear>. .. but the core styling classes should be only used by the core and nobody else.

sorry bad wording here. ... Everyone can use existing core tc-x classes if they fit. ... but only the core should define new ones. If you need new classes in the base CSS rules, you should create a PR for the core. ... plugins should use prefixes.

-m

Tobias Beer

unread,
Jan 7, 2016, 10:46:54 AM1/7/16
to TiddlyWiki
Hi Mario,
 
If you are the first one that creates an appear widget, you basically have the chance to define the name you want. So everyone will be fine with <$appear>. .. but the core styling classes should be only used by the core and nobody else.

So far, I understood this nomenclature as a general best practice, not as a reserved namespace for core components only. So, dunno...

If you need new classes in thenbase CSS rules, you should create a PR for the core. ... plugins should use prefixes. 

Perhaps I will go wit the tb-prefix then (in the future) and entirely ignore any distinctions as for classes or fields or messages... they're all going to be tb-foo, if needed ...and quite possibly not everything that can be prefixed will be, e.g. I will not change the rating field to tb-rating. If a user needs something else, they can have it... using parameters.

I also don't feel like I will use any prefixes for widgets, wikirules or macros.
That is actual markup and needs to be short and recognizable, no tb-foo-do.
If it was to clash with someone's wiki or other plugins, there's a good chance
that it can be easily modified to some other name in that one case where it's needed.

Anywho, I think I'll rather search for plugin names and components that I have not yet encountered,
rather than prefix the every living foo out of every tiny detail.
As a user, I would find that confusing.

Best wishes,

Tobias.

PMario

unread,
Jan 7, 2016, 2:01:16 PM1/7/16
to TiddlyWiki
On Thursday, January 7, 2016 at 4:46:54 PM UTC+1, Tobias Beer wrote:
Perhaps I will go wit the tb-prefix then (in the future) and entirely ignore any distinctions as for classes or fields or messages... they're all going to be tb-foo, if needed ...and quite possibly not everything that can be prefixed will be, e.g. I will not change the rating field to tb-rating. If a user needs something else, they can have it... using parameters.

I wasn't suggesting, that widget names should be prefixed. ... The first one, which takes the name will win, like with TW2. If plugin names conflict, a different name was choosen. (most of the time)

-m


David Gifford

unread,
Jan 7, 2016, 3:15:22 PM1/7/16
to TiddlyWiki
Well, seeing this plugin, I realize I'll never have to ask Tobias the question "How do you rate?"

Dave

tobaisch

unread,
Dec 21, 2017, 10:00:04 PM12/21/17
to TiddlyWiki
Hello Tobias,
how can sort by ratings or filter.
For example; only the tiddlers with 5 stars but in a list and sort by name?
THX
Tob

Diego Mesa

unread,
Dec 21, 2017, 10:54:01 PM12/21/17
to TiddlyWiki
Hey Tob,

Ive actually used this plugin in a similar way like this:

I have a Papers of Interest tiddler with the following content:

!! Health
<dl><$list filter="[tag[PoI]tag[EHR]!nsort[touched]]" template="$:/.dm/templates/list-summary-prioritize"/></dl>


!! General
<dl><$list type="dl" filter="[tag[PoI]!tag[EHR]!nsort[touched]]" template="$:/.dm/templates/list-summary-prioritize"/></dl>


with the list-summary prioritize template:

<dt>
<$link><$list filter="[all[current]rating[5]]">
<span class="priorityStar">&#9733;</span></$list> <$view field=title/></$link></dt>
<$list filter="[all[current]has[summary]]">
<dd>{{!!summary}}</dd></$list>

This creates a formatted list of tiddlers tagged PoI sorted by a timestamp I call touched. The template adds an additional red star infront of the title if the rating of the tiddler is a 5.

I have tried to copy as much from Tobias as I can! 

Best,
Diego

tobaisch

unread,
Dec 22, 2017, 11:11:11 AM12/22/17
to TiddlyWiki
Thanks Diego.
a nice variant, but that's not what I'm looking for.
I would like to filter a list search for the text phrase "ABC" in the tiddler title and sort by star rating.
Start with the best rated tiddlers.
Regards
Tob

tobaisch

unread,
Dec 22, 2017, 5:54:44 PM12/22/17
to TiddlyWiki
partially solved:
sort by rating is: !nsort[rating] or sort[rating]  so simple :)
But how can I search for a "ABC" text phrase?
Regards
Tob

Birthe C

unread,
Dec 22, 2017, 6:17:00 PM12/22/17
to TiddlyWiki
<$list filter="[has[rating]field:title/ABC/!nsort[rating]]"/>

Birthe

tobaisch

unread,
Dec 22, 2017, 6:59:11 PM12/22/17
to TiddlyWiki
works like a pro!
Thank you Birthe C
Regards
Tob
Reply all
Reply to author
Forward
0 new messages