Views (HTML)
As usual you should make some tests with the changes that you made and configure a Continuous Integration environment for checking that your overrides doesn’t get removed with new decidim versions.
Overrides
To find what you need to change you’ll need to make some detective work to find out which partial or view do you need to change. You can do so by:
-
looking at your application log and finding the lines that start with "Rendered"
-
inspecting with the web development tools of your browser, copying a special class and using
grep
, github search or your IDE search by multiple files to find out on which file this exists.
Filename method
If you want to override a view or partial given by Decidim you can do this just by naming it with the same filename that you already have. On more details, if you want to change the social media icons on the footer, you can do so by looking at which file you need to change, copying that file to your application with the same filename and directory structure, and making your local changes.
As an example, if I want to change the footer, you’d need to search for the file (on this case, it’s on decidim-core/app/views/layouts/decidim/_mini_footer.html.erb
), and copy that file to your own application on app/views/layouts/decidim/_mini_footer.html.erb
).
Deface method
You’ll need the deface
gem installed on your application, and follow their instructions on how to use the different overridign methods that they support.
As an example, if you want to change the footer, you can do so by creating the file app/overrides/layouts/decidim/_main_footer/pre_footer.html.erb.deface
with these contents:
<!-- insert_before ".main-footer" -->
hello world
New pages
If you want to add a new HTML page, you can do this by working as a regular Rails application (ie, you can scaffold a new view and work with the HTML as usual).
As an example of how to do this on Decidim Barcelona application, there’s the StaticController (main accountability section pages). You should inherit your controller from Decidim::ApplicationController.