Developing Discourse Plugins - Part 5 - Add an admin interface

Work for me!
2018-4-29

1. Code




2. Result

4 Likes

Glad it worked, but It is always better to post code than pictures of code.

3 Likes

Thanks for reply
original post have all these code,
it’s not necessary for me to post code again.

The purpose of these picture is to show it work, give viewer a big picture view
(not for viewer to copy&paste)
(code in code editor have nicer code highlight)

If anyone runs into a testing error, I had to add id="show-tentacle" to the button component to get the tests to pass in part 6 of the tutorial:

<div class="buttons">
  {{d-button label="purple_tentacle.show" action="showTentacle" icon="eye" id="show-tentacle"}}
</div>

I found the Ember routing didn’t work until I commented out path: '/plugins' in the route-map file:

export default {
  resource: 'admin.adminPlugins',
  // path: '/plugins',
  map () {
    this.route('watch-mute')
  }
}

For some reason Ember was expecting a route at adminPlugins/watch-mute not at adminPlugins/plugins/watch-mute. Is this something I did wrong upstream in the routing call chain, or has something changed in the way Discourse/Ember handles these?

The linked discourse-akismet plugin doesn’t have that admin UI/tab/code btw. The good news is that another plugin, https://github.com/discourse/discourse-data-explorer, does have it.

1 Like

11 posts were split to a new topic: How to execute server-side code when clicking a button?