Sha256: 9945468c9ce66a1d7ad18177ce10182fcb8f4705b77db0eae3c4d87b894561d2

Contents?: true

Size: 1.87 KB

Versions: 11

Compression:

Stored size: 1.87 KB

Contents

= Code

Decidim is multiple things:

* A command-line utility, which can create an application
* A set of libraries, that the application can use

Most of the time, you should work with the generated application. That application (development_app on this docs) should be named as your project, for instance for Barcelona City Council is `DecidimBarcelona`, so for creating it should be:

[source,console]
----
decidim DecidimBarcelona
----

If you want to override/change anything, you can just do it with the same name of the file, through Monkey Patching. Some real world examples of this method:

* https://github.com/gencat/participa/blob/master/app/decorators/decidim/admin/selective_newsletter_form_decorator.rb[Decidim::Admin::SelectiveNewsletterForm]. As it's a decorator you also need to make it available in the https://github.com/gencat/participa/blob/3416992ae095f6ab1e826fee961253514c4ff0ef/config/application.rb#L48[application config]
* https://github.com/barcelonaregional/decidim-premet25/blob/master/config/initializers/etiquette_validator.rb[EtiquetteValidator.class_eval]

If you want to extend Decidim, the preferred way should be by having a Module. This is a Ruby on Rails Engine which provides ruby code (models, views, controllers, assets, etc). You can use it in multiple ways:

* Putting it on the same directory as your app and pointing on the Gemfile. https://github.com/AjuntamentdeBarcelona/decidim-barcelona/tree/c210b5338d7ba1338c9879627e081da1441f1946[See example on GitHub]. For instance:

[source,ruby]
----
gem "decidim-debates", path: "decidim-debates"
----

* Publishing on a git repository and pointing in on the Gemfile. For instance:

[source,ruby]
----
gem "decidim-consultations", git: "https://github.com/decidim/decidim-module-consultations"
----

* Publishing it on rubygems.org

You can learn more about xref:develop:modules.adoc[Modules] in the development guide.

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-0.26.10 docs/modules/customize/pages/code.adoc
decidim-0.26.9 docs/modules/customize/pages/code.adoc
decidim-0.26.8 docs/modules/customize/pages/code.adoc
decidim-0.26.7 docs/modules/customize/pages/code.adoc
decidim-0.26.5 docs/modules/customize/pages/code.adoc
decidim-0.26.4 docs/modules/customize/pages/code.adoc
decidim-0.26.3 docs/modules/customize/pages/code.adoc
decidim-0.26.2 docs/modules/customize/pages/code.adoc
decidim-0.26.1 docs/modules/customize/pages/code.adoc
decidim-0.26.0 docs/modules/customize/pages/code.adoc
decidim-0.26.0.rc2 docs/modules/customize/pages/code.adoc