Skip to content

Commit

Permalink
Merge pull request #43 from picman/project_settings
Browse files Browse the repository at this point in the history
Project settings
  • Loading branch information
maeda-m authored Oct 27, 2019
2 parents 96b747e + 9b4a9bf commit 93a0c14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Redmine plugin for setting the default custom query of Issues for each project.
$ git clone https://github.com/hidakatsuya/redmine_default_custom_query.git /path/to/your-redmine/plugins/redmine_default_custom_query
```

Install dependencies:

```
$ bundle install
```

Then, migrate:

```
Expand Down
15 changes: 3 additions & 12 deletions app/patches/helpers/projects_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@

module DefaultCustomQuery
module ProjectsHelperPatch
extend ActiveSupport::Concern

included do
alias_method :project_settings_tabs_without_default_query_setting_tab, :project_settings_tabs
alias_method :project_settings_tabs, :project_settings_tabs_with_default_query_setting_tab
end

def project_settings_tabs_with_default_query_setting_tab
tabs = project_settings_tabs_without_default_query_setting_tab

def project_settings_tabs
tabs = super
if User.current.allowed_to?(:manage_default_query, @project) &&
@project.module_enabled?(:default_custom_query)
tabs << {
Expand All @@ -26,6 +19,4 @@ def project_settings_tabs_with_default_query_setting_tab
end
end

DefaultCustomQuery::ProjectsHelperPatch.tap do |mod|
ProjectsHelper.send :include, mod unless ProjectsHelper.include?(mod)
end
ProjectsController.send :helper, DefaultCustomQuery::ProjectsHelperPatch

0 comments on commit 93a0c14

Please sign in to comment.