# Developing Discourse Plugins - Part 5 - Add an admin interface

**URL:** https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761
**Category:** Developer Guides
**Tags:** plugin-guides, tutorial
**Created:** [4 augustus 2015 om 20:34 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761 "2015-08-04T20:34:32Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![Einsteino](https://avatars.discourse-cdn.com/v4/letter/e/e95f7d/32.png) [@Einsteino](https://meta.discourse.org/u/Einsteino)
#### Post date: [24 maart 2016 om 09:28 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/24 "2016-03-24T09:28:33Z")

</div>

Discourse. does this, but is not persistent.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [24 maart 2016 om 14:26 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/25 "2016-03-24T14:26:31Z")

</div>

You can update site settings via a custom interface but not automatically. You’ll have to define rails controllers and have them respond to REST calls which update the stuff. The [Embedding interface](https://github.com/discourse/discourse/blob/master/app/controllers/admin/embedding_controller.rb) does this if you want an example in the Discourse code base.

---

<div class="post-metadata">

### Author: ![thanhmssl10](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thanhmssl10/32/52944_2.png) [@thanhmssl10](https://meta.discourse.org/u/thanhmssl10)
#### Post date: [28 maart 2016 om 10:18 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/26 "2016-03-28T10:18:47Z")

</div>

[quote=“eviltrout, post:25, topic:31761”]  
**assets/javascripts/discourse/templates/admin/plugins-purple-tentacle.hbs**

````handlebars
{{#if tentacleVisible}}
  <div class='tentacle'>
    <img src="http://eviltrout.com/images/tentacle.gif">
  </div>
{{/if}}

<div class='buttons'>
  {{d-button label="purple_tentacle.show" action="showTentacle" icon="eye"}}
</div>
```[/quote]

````

{{d-button label=“purple\_tentacle.show” action=“showTentacle” icon=“eye”}}

```plaintext

This line should have `id="show-tentacle"` for test in Part 6 :smile:
```

---

<div class="post-metadata">

### Author: ![Aman\_Jagga](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Aman\_Jagga](https://meta.discourse.org/u/Aman_Jagga)
#### Post date: [28 oktober 2016 om 09:28 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/27 "2016-10-28T09:28:13Z")

</div>

```js
export default {
  resource: 'admin.adminPlugins',
  path: '/plugins',
  map() {
    this.route('purple-tentacle');
  }
};

```

What do we exactly specify in the resource field here?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [28 oktober 2016 om 14:47 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/28 "2016-10-28T14:47:05Z")

</div>

If you’re following this tutorial, you’d leave it as is, because the route is embedded in admin/plugins

---

<div class="post-metadata">

### Author: ![Aman\_Jagga](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Aman\_Jagga](https://meta.discourse.org/u/Aman_Jagga)
#### Post date: [28 oktober 2016 om 14:54 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/29 "2016-10-28T14:54:00Z")

</div>

I am not embedding it in admin plugins, I want to embed it in a new independent static page  
@eviltrout …please help, I couldnt find any tutorial for this

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [28 oktober 2016 om 14:58 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/30 "2016-10-28T14:58:28Z")

</div>

I suggest making a new topic in the #Development category asking for advice, and giving as much information as possible. It’s hard to help someone without knowing what they want.

---

<div class="post-metadata">

### Author: ![gdpelican](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gdpelican/32/81308_2.png) [@gdpelican](https://meta.discourse.org/u/gdpelican)
#### Post date: [28 oktober 2016 om 15:52 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/31 "2016-10-28T15:52:18Z")

</div>

I’ve recently done this in the [Lattice](http://www.github.com/gdpelican/lattice) plugin, where I was able to get this to go without specifying a resource field.

```plaintext
# lattice-route-map.js.es6
export default function() {
  this.resource('lattice', { path: '/lattices/:id' })
}

```

Fun fact: Discourse does pattern matching on filenames to determine what to cook into the routes. Anything matching `/route-map$/` will attempt to get baked into the router.

---

<div class="post-metadata">

### Author: ![EndruK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/endruk/32/50211_2.png) [@EndruK](https://meta.discourse.org/u/EndruK)
#### Post date: [13 januari 2017 om 10:17 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/32 "2017-01-13T10:17:19Z")

</div>

Does this still work with Ember v2.10?:

> [@eviltrout](#):
>
> ```plaintext
> export default {
> resource: 'admin.adminPlugins',
> path: '/plugins',
> map() {
> this.route('purple-tentacle');
> }
> };
> 
> ```

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [13 januari 2017 om 15:47 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/33 "2017-01-13T15:47:15Z")

</div>

It should! Is it not working for you?

---

<div class="post-metadata">

### Author: ![EndruK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/endruk/32/50211_2.png) [@EndruK](https://meta.discourse.org/u/EndruK)
#### Post date: [18 januari 2017 om 12:12 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/34 "2017-01-18T12:12:17Z")

</div>

Hi Robin,  
It does work but I was suspicious that this might not work since you switched to Ember v2.10 all resources in the app-route-map were changed to routes.

---

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [27 februari 2017 om 12:36 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/35 "2017-02-27T12:36:26Z")

</div>

@gdpelican, thanks a million for advertising this! [Your plugin](https://github.com/gdpelican/lattice) is the only example I found about how to create a **public route** (non-admin) from a plugin.

---

<div class="post-metadata">

### Author: ![gdpelican](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gdpelican/32/81308_2.png) [@gdpelican](https://meta.discourse.org/u/gdpelican)
#### Post date: [27 februari 2017 om 23:22 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/36 "2017-02-27T23:22:22Z")

</div>

Seems like a common enough plugin use case that it would be really nice to put it into a plugin helper, something like

```plaintext
define_route :get, '/lattices', 'lattices#index'
define_route :post, '/lattices', 'lattices#create'

```

Rather than having plugin authors care about rails engines and mounting and whatnot.

If I get back to having some time to work on Discourse, I may do that 🙂

---

<div class="post-metadata">

### Author: ![Jen\_Lijo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jen_lijo/32/77057_2.png) [@Jen\_Lijo](https://meta.discourse.org/u/Jen_Lijo)
#### Post date: [6 juli 2017 om 08:33 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/37 "2017-07-06T08:33:12Z")

</div>

same issue with the title, renaming to client.en.yml has worked for me 🙂

---

<div class="post-metadata">

### Author: ![Jen\_Lijo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jen_lijo/32/77057_2.png) [@Jen\_Lijo](https://meta.discourse.org/u/Jen_Lijo)
#### Post date: [6 juli 2017 om 09:33 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/38 "2017-07-06T09:33:56Z")

</div>

Hi,  
My “show purple tentacle” (I’ve used other namings) button is not displaying.

discourse/plugins/dis-plug/assets/javascripts/discourse/templates/admin/dis-plug.hbs

```
{{#if imgVisible}}
  <div class='tentacle'>
    <img src="https://media.giphy.com/media/oiGCnybFPh6Q8/giphy.gif">
  </div>
{{/if}}

<div class='buttons'>
  {{d-button label="dis-plug.show" action="showImg" icon="eye"}}
</div>

```

I `rm -rf tmp; bundle exec rails s` when I start the server. I’ve compared the code with eviltrout’s repo and all seems alright. What could be the issue? Thanks!

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [6 juli 2017 om 09:44 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/39 "2017-07-06T09:44:31Z")

</div>

The auto-loading of handlebars templates (and other ember related things) is quite sensitive to file names - it might be as simple as adding `plugins-` to the beginning of the file name so it matches the instructions closer.

> [@eviltrout](#):
>
> assets/javascripts/discourse/templates/admin/plugins-purple-tentacle.hbs

If that doesn’t work, I’d suggest trying the tutorial again, but using _exactly_ the plugin & file names specified in the instructions. Then if that works adapt it from there

---

<div class="post-metadata">

### Author: ![Jen\_Lijo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jen_lijo/32/77057_2.png) [@Jen\_Lijo](https://meta.discourse.org/u/Jen_Lijo)
#### Post date: [6 juli 2017 om 09:50 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/40 "2017-07-06T09:50:09Z")

</div>

it has worked like magic!

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [6 juli 2017 om 14:50 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/41 "2017-07-06T14:50:56Z")

</div>

Just so I can update the original post, what steps were required to fix this tutorial?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [6 juli 2017 om 15:45 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/42 "2017-07-06T15:45:06Z")

</div>

If it was what I said, then no changes, other than maybe a message to say how important it is that file names are exactly correct

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [6 juli 2017 om 17:19 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761/43 "2017-07-06T17:19:11Z")

</div>

I don’t know how far things should go for teaching prerequisite “basic knowledge”. But I think a lot of the troubles are when it is not only the first Discourse plugin but also an early venture into Ruby / Ember

That is, an unfamiliarity with the conventions that do “magic”. When structure and naming look like arbitrary is OK but it isn’t it can be a pain to figure out what’s wrong.

The “this can be whatever, this _must_ be” stuff.

[Previous page](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761.md?page=1)

[Next page](https://meta.discourse.org/t/developing-discourse-plugins-part-5-add-an-admin-interface/31761.md?page=3)
