Discourse. does this, but is not persistent.
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 does this if you want an example in the Discourse code base.
[quote=“eviltrout, post:25, topic:31761”]
assets/javascripts/discourse/templates/admin/plugins-purple-tentacle.hbs
{{#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”}}
This line should have `id="show-tentacle"` for test in Part 6 :smile:
export default {
resource: 'admin.adminPlugins',
path: '/plugins',
map() {
this.route('purple-tentacle');
}
};
What do we exactly specify in the resource field here?
If you’re following this tutorial, you’d leave it as is, because the route is embedded in admin/plugins
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
I suggest making a new topic in the dev category asking for advice, and giving as much information as possible. It’s hard to help someone without knowing what they want.
I’ve recently done this in the Lattice plugin, where I was able to get this to go without specifying a resource field.
# 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.
Does this still work with Ember v2.10?:
It should! Is it not working for you?
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.
@gdpelican, thanks a million for advertising this! Your plugin is the only example I found about how to create a public route (non-admin) from a plugin.
Seems like a common enough plugin use case that it would be really nice to put it into a plugin helper, something like
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
same issue with the title, renaming to client.en.yml has worked for me
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!
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.
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
it has worked like magic!
Just so I can update the original post, what steps were required to fix this tutorial?
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
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.