开发 Discourse 插件 - 第五部分 - 添加管理员界面

Work for me!
2018-4-29

1. Code




2. Result

4 个赞

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

3 个赞

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 个赞

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

Hi there, just wanted to say that I found an error with the docs on line 116.
I have opened a pull request.

1 个赞