Plugin FAQ » History » Revision 2
Revision 1 (Jean-Baptiste Barth, 2013-05-16 16:27) → Revision 2/8 (Derric Atzrott, 2013-05-16 17:58)
h1. Frequently Asked Questions about Redmine plugins
{{toc}}
This page aims at documenting how to achieve simple things in Redmine plugins.
h2. Determine if a module is enabled
If your project is in the @@project@ variable: <pre><code class="ruby">
if @project.module_enabled?("<module_name>")
</code></pre>
First _modules_ are a project level concept. So be sure to make this check in an action that operates at project level. Redmine core generally uses a @before_filter@ called @find_project@ to find the current project in standard actions, which populates the @@project@ variable.
Available modules as of Redmine 2.3.x are: boards, calendar, documents, files, gantt, issue_tracking, news, repository, time_tracking, wiki. Each plugin can add its own module (see [[Plugin_Tutorial]] which adds a "polls" module).
h2. Changing the layout of a page
Changing the layout of a page is done by overriding its View. Redmine stores its views in @app/views/@. To change a page's view using a plugin, first copy the view from @app/views/@ to @plugins/your_plugin/app/views/@ and then modify the file.
If multiple plugins override the same view, the last plugin loaded will be the one whose view is shown. If you are having trouble finding out which view you need to override, check @config/routes.rb@ and look for a pattern that matches the URL for the page you are trying to modify. That may help point you in the right direction.