Composer Help Button

I’ve now completed my work on a composer help button.

It adds a button to the composer window

and a setting in the Admin area:

Clicking on that icon, will open a modal window with the content from the first post at the URL set in the Admin area

The only caveat, is that you need to store the Topic in a publicly accessible location so ALL of your members can see it. Otherwise, they’ll get an access denied error.

21 Likes

Something I should mention. By default the button will not appear until a URL is entered in the Admin Setting. So you won’t have a broken button out of the box :smile:

4 Likes

@eviltrout, @lightyear, @santouras, @orodio (Jude and James, I included you in case you have a moment to help guide me too!)

Okay, so I started with this plugin, as it was a tad bit simplier than the ReplyGIF one to get my “feet wet”.

You can see my first attempt here
https://github.com/cpradio/composer-help-button/tree/convert-to-es6

I feel like I’m close! I just can’t get the ajax loaded content to appear in the body of the modal window. I feel like I’m missing something, but I’m not getting any errors to indicate what I’m missing.

Can one of you take a peek and push me in the right direction? I’d really appreciate it!

nm. Seems I figured it out (not sure how though… I simply renamed the composer-help.js.handlebars to composer-help.hbs and took it out of the plugin.rb. Then I fixed the showModal call and it started working!

Merging to main branch soon so this plugin is at least functional again.

Edit: Version 0.2 is now live on GitHub

2 Likes

Awesome! Yeah we use hbs as extensions and they are automatically included now.

The help button doesn’t show up on Discourse version 1.4. Did you have time to check out why it isn’t working anymore?

1 Like

Yeah, it seems to be the ember upgrade, I’m trying to debug it, but running into problems, as it almost seems the plugin’s front-end isn’t being loaded at all.

There are a couple of things going on, first was the change that moved the composer window from #wmd-button-row to .wmd-button-row, now the second is far more confusing, as it states it can’t load discourse/controllers/controller…

Uncaught Error: Could not find module `discourse/controllers/controller` imported from 
`discourse/plugins/composer-help-button/discourse/controllers/composer-help`requireFrom @ loader:111
reify @ loader:98
mod.state @ loader:141
tryFinally @ loader:22
requireModule @ loader:140
__exports__.default.Ember.DefaultResolver.extend.customResolve @ discourse/ember/resolver:85
__exports__.default.Ember.DefaultResolver.extend.resolveController @ discourse/ember/resolver:110
superWrapper @ ember-template-compiler:9278
exports.default.EmberObject.default.extend.resolve @ ember.debug:4591
resolve @ ember.debug:4434
resolve @ ember.debug:2110
Registry.resolve @ ember.debug:1716
factoryFor @ ember.debug:1318
instantiate @ ember.debug:1376
lookup @ ember.debug:1274
Container.lookup @ ember.debug:1209
__exports__.default @ discourse/lib/show-modal:23
__exports__.default.initialize.ApplicationRoute.reopen.actions.showComposerHelp @ javascripts/discourse/initializers/composer-help:15
triggerEvent @ ember.debug:23488
trigger @ ember.debug:45006
Router.trigger @ ember.debug:43730
EmberObject.default.extend.send @ ember.debug:22983
mixin.Mixin.create.send @ ember.debug:26917
mixin.Mixin.create.send @ ember.debug:26917
(anonymous function) @ javascripts/discourse/initializers/composer-help:29
jQuery.event.dispatch @ jquery.debug:4431
jQuery.event.add.elemData.handle @ jquery.debug:4117

I believe this is functional again. Thanks for reporting it!

5 Likes

Awesome @cpradio It works for me. I added another issue. It’s just about moving the settings to the plugin-tab.

1 Like

Yeah, I thought about looking into that too, but haven’t yet (as I believe that came about after this plugin was written).

Just finished this request

As an FYI
With this change, you will need to re-enable the plugin and re-enter the URL for the modal window (so you might want to copy the URL before upgrading).

Here are the new Admin Screenshots


4 Likes

thanks, this will make the plugin behave nicer on multisite :slight_smile:

1 Like

Very nice plugin @cpradio, thanks!

I found difficult to write the message that would display when clicking the help button, and I ended up posting a table with formatting :left_right_arrow: code equivalences, quite larger than the pop-up window.

Is there a way to resize the modal window so that my table fits completely inside it?

Yes. Change the max height for .composer-help-content in your admin > customize > css

Example:

.modal-body {
  max-height: 550px;
}
.composer-help-content {
  max-height: 500px;
}
2 Likes

First time using CSS, it’s quite easy actually :wink:

The following customization did the trick for me:

.modal-inner-container {
    max-width: 950px;
    height: 820px;
}
.composer-help-modal {
  .composer-help-content {
    max-height: 750px;
  }
}

Thanks again!

1 Like

With the Ember 2.4 upgrade now merged in, there is a release branch to use for older versions of Discourse

git clone --branch v0.6.0 https://github.com/cpradio/discourse-plugin-composer-help-button.git

4 Likes

Just fixed

3 Likes

Does someone have a good post or documentation that explains all the markdown, bbcode, and html tags in discourse? This can be used for the composer help button.

IMHO that is a lot to give to all users in one post.

If it were me I would break it down and post just the basics on the popup and include links to more advanced features. Also don’t forget to note the Keyboard Shortcuts which is on Discourse by default and accessed under the hamburger menu.

2 Likes