Z
Z
Zaur Ashurbekov2017-08-29 15:59:26
Ruby on Rails
Zaur Ashurbekov, 2017-08-29 15:59:26

How to implement plugins for an application?

Hello Toaster!
There is an application on rails, which is essentially a kind of task scheduler that will run tasks from plugins. Now you need to somehow write and embed plugins into it, which will have to use models from the main application and each other's capabilities. Something like plugins from wordpress. What is the right way to implement this in Rails?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Petrov, 2017-08-29
@zaurius

In essence, you write the same code as usual, just call it "Plugin".
I do this:
In the controllers folder, in javascripts, stylesheets and views put the modules folder. (in my project I just call them modules)
I create a controller
A controller is created, script style. I throw the sheets with my hands.
Then, where necessary, I connect the script and the plugin style.

/*
*= require module/name_module.css
*/

Next, I throw the views on the page with Ajax, or you can insert them anywhere . With this option, scripts and styles can be connected inside this file. Well, that's all. you have plugin html, js, css and controller. You can do whatever you want with them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question