# Checklist: A simple markdownified checkbox-plugin with inline-updating

(Tobias Eigen) #21

small bug - checkbox does not show up in email notifications.

(Cameron Wong) #22

Perhaps a bigger bug - after altering the state of a box, any other boxes in a post “freeze” and can’t be altered again until refreshing.

Additionally, a [.] will cause a box immediately after to fail to display properly, as displayed here.

(Markus) #23

It looks pretty shine. BUT it does destroy my MathJax plugin (LaTeX typesetting support).

I guess, there is an update necessary…

(Erlend Sogge Heggen) #24

Would hugely appreciate an update. Does this fall under the unsupported plugins @lightyear?

Considering most of Discourse’s early adopters are developer-centric communities, I think feature parity with GitHub’s markdown extensions is a Very Good Thing. I hope the core devs will give it the attention it deserves.

(Benjamin Kampmann) #25

Nope. Email is currently not supported by this plugin.

Never had this and am running the plugin in production on our systems. Is this still a problem? If so, can you maybe open the developer console and see whether there are any errors?

Not sure why this happens, but yes, if you use wrong syntax it renders wrong #wontfix .

I am not using the MathJax plugin and incompatibility with other plugins might very well be the case. Can you tell me what exactly goes wrong and do you have an idea why? Might be an easy fix. I accept PRs on this if anyone cares about running both .

An update on the plugin? Sure the previously mentioned things might be valid reports, but I do not consider the plugin broken. As mentioned earlier, we are running this in production and I will continue to support it to the extend, that it works there, for us and any breaking reports.

(Cameron Wong) #26

Sure, I’ll do that and report back when I have a moment.

Well, I’m not expecting the [.] to break, but [.][_] seems like somethingt hat should work /arms

E:

Nope, doesn’t look like there are any console errors. Could it be a problem on my end? (I’m using Chrome on Windows, I’ll test if the bug still exists on Linux Chromium and/or Seamonkey in a bit)

E2:

Yes, the bug still exists on Seamonkey.

@lightyear

(Mikulas Dite) #27

I couldn’t get the inline updating to work on recent Discourse release (93ab0396). Server-side stuff works, the checkboxes render fine, but the ui js never loads. Is this an error on my part, or does the plugin need to be updated?

(Felix Freiberger) #28

I have the same problem, so I assume it’s a plugin issue.

(Zajako) #29

Same, clicking on the checkboxes does nothing on any screen for me.

(Sam Saffron) #30

Moving to broken plugins

Seems abandoned by @lightyear

#31

Probably no the best way, but I did get it to work using these tweaks:

Discourse.PostView.reopen({
createChecklistUI: function($post) { if (!this.get('post').can_edit) { return }; var boxes =$post.find(".chcklst-box"),
view = this.get('post');

boxes.each(function(idx, val) {
$(val).click(function(ev) { var elem =$(ev.currentTarget),
new_value = elem.hasClass("checked") ? "[ ]": "[*]",
poller = Discourse.ajax("/posts/" + view.id + ".json");

elem.after('<i class="fa fa-spinner fa-spin"></i>');
elem.hide();

poller.then(function(result) {
var nth = -1, // make the first run go to index = 0
new_raw = result.raw.replace(/$([\ \_\-\x\*]?)$/g, function(match, args, offset) {
nth += 1;
return nth == idx ? new_value : match;
});
Discourse.ajax("/posts/" + view.id, {
type: "PUT",
data: {
"post[raw]" : new_raw,
"post[edit_reason]" : "change checkmark"
}
});
});
});
});

// confirm the feature is enabled by showing the click-ability
boxes.css({"cursor": "pointer"});

}.on('postViewInserted', 'postViewUpdated'),

destroyChecklistUI: function() {
}.on('willClearRender')
});

(Kane York) #32

You can also do this, which will be resilient to change in the name of PostView:

var decorateCooked = require('discourse/lib/plugin-api').decorateCooked;

function createChecklistUI(\$post) {
...
}

decorateCooked(Discourse.__container__, createChecklistUI);

(Daniela) #33

In the last update to 1.5.0.beta6 Checklist plugin (and Alert plugin) broken all the others plugins (tagging, replygif, imgflip, solved, spoiler_alert and some others).

We have had to disable this two plugin and rebuild the container to resolve.
Unfortunately, we use a lot of TO-DO lists in our private category (now broken).

There is a way to work around the problem?

@mr8’s code is still valid?

(Mittineague) #34

it looks like the checklist plugin needs an edit due to

discourse-plugin-checklist/checklist_ui.js at master · gnunicorn/discourse-plugin-checklist · GitHub

Discourse.PostView.reopen({

(Erlend Sogge Heggen) #35

Any developer interested in this plugin for their own purposes should feel free to make a clean-break* fork of this repository since the author @lightyear is no longer active in this community.

(* re-upload the code to your own repo instead of using the GitHub forking, that way your repository’s code is searchable and won’t be “x commits behind/ahead” an effectively abandoned repo)

I’m considering taking this on, need to see if I have the time to do so. I might try and get to it later today/tomorrow.

(Erlend Sogge Heggen) #37

Also note that this plugin might be affected by the impending Markdown refactor:

Okay, so I’m close, but I’m struggling to replace this part

I can’t find a suitable replace to Post.load, which is what poller is

I attempted the following, but it is failing to properly update the actions_summary via updateFromPost

Once, I can get that working and saving the result back to the Post, I’ve got this completed. (I’ve been trying for hours and I’m not making any progress)