Composer Help Button


(cpradio) #1

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.


Emoji selector and custom Emoji
Why is there no UI to create a poll?
Plugin Author Badge Qualifications
Undo (Ctrl/Cmd+Z) doesn't work for Markdown
(cpradio) #2

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:


(cpradio) #3

@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!


(cpradio) #4

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


(Robin Ward) #5

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


(Ali) #6

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?


(cpradio) #7

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.


(cpradio) #8

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

(cpradio) #9

I believe this is functional again. Thanks for reporting it!
https://github.com/cpradio/composer-help-button/commit/b52fd9e7609f571405cb8a259c86874ffb5fd47f


(Ali) #10

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

https://github.com/cpradio/composer-help-button/issues/6


(cpradio) #11

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


(cpradio) #12

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



(Kane York) #13

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


#14

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?


(cpradio) #15

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;
}

#16

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!


(cpradio) #17

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