Hook for extra buttons at the bottom of a post


(Carlo Kok) #1

Is there a plugin hook where I can add an extra button to the 3 buttons that already exist at the bottom of the page (Favorite/Share/Reply To)? For staff users I want to add a button that logs the current post as a bugreport, the bug tracker has pretty much all the logic already to get a post, all I need is to link to it.


(Carlo Kok) #2

In case anyone is interested: I couldn’t figure out how to solve this from a plugin but it was easy enough to add one in the ember javascript files:

--- a/app/assets/javascripts/discourse/views/topic_footer_buttons_view.js
+++ b/app/assets/javascripts/discourse/views/topic_footer_buttons_view.js
@@ -30,6 +30,13 @@ Discourse.TopicFooterButtonsView = Discourse.ContainerView.extend({
         this.attachViewClass(Discourse.ClearPinButton);
       }
       this.attachViewClass(Discourse.ReplyButton);
+      if (Discourse.User.current().get('staff')) {
+        this.attachViewClass(Discourse.ButtonBr);
+        this.attachViewClass(Discourse.FromtalkBugButton);
+        this.attachViewClass(Discourse.FromtalkSupportButton);
+        this.attachViewClass(Discourse.FromtalkClientBugButton);
+       this.attachViewClass(Discourse.FromtalkClientSupportButton);
+      }

```

Then in the buttons/ directory a js file with things like:
```javascript
Discourse.ButtonBr = Discourse.View.extend({
  tagName: 'br'
});

Discourse.FromtalkBugButton = Discourse.ButtonView.extend({
  text: 'Log Bug (Web)',
  tagName: 'a',
  attributeBindings: ['href', 'target'],
  target: '_blank',
  href: "https://ourbugtracker#fromtalk-bug?"+ window.location
});

```

(Sam Saffron) #3

Discussing this with @eviltrout, I would like some plugin examples that add buttons either at the post level or topic level.


(Carlo Kok) #4

we use this for

the 4 buttons are used by our personel to enter a support issue or bug report into our bug tracker so someone can track it & make sure it gets responded to in time (the fun logic is in the bug tracker itself which grabs the post, puts it in there and posts a reply).


(RĂ©gis Hanol) #5

@carlokok you might want to take a look at this

http://meta.discourse.org/t/plugin-tutorial-2-how-to-add-a-button-at-the-end-of-a-topic/11040


(RĂ©gis Hanol) #6

@carlokok and this one too


(Arpit Jalan) #7

We just published two new plugins for adding a button at the bottom of a topic.

  • Button visible to everyone (who is logged in):
  • Button visible only to staff or members of a specific group: