Skip to content

Commit

Permalink
Merge pull request suer#37 from yzzy/dmsf-compatibility
Browse files Browse the repository at this point in the history
Other Redmine plugins compatibility
  • Loading branch information
suer authored May 22, 2021
2 parents 4e83772 + a67193e commit 82f59b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 1 addition & 6 deletions app/views/webhook_settings/_show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

<% if User.current.allowed_to?( :manage_hook, @project) %>
<% if Webhook.where(:project_id => @project.id).first%>
<div class="box tabular">
<% Webhook.where(:project_id => @project.id).each do |webhook|%>
Expand All @@ -15,6 +13,7 @@
<% end %>
</div>
<% end %>

<%= form_tag(create_webhook_path(@project), :method => :post, :class => "tabular") do %>
<div class="box tabular">
<span>
Expand All @@ -23,8 +22,4 @@
<%= submit_tag l(:button_add) %>
</span>
</div>


<% end %>

<% end %>
4 changes: 3 additions & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
version '0.0.5'
url 'https://github.com/suer/redmine_webhook'
author_url 'http://d.hatena.ne.jp/suer'
permission :manage_hook, {:webhook_settings => [:index, :show, :update, :create, :destroy]}, :require => :member
project_module :webhooks do
permission :manage_hook, {:webhook_settings => [:index, :show, :update, :create, :destroy]}, :require => :member
end
end
8 changes: 5 additions & 3 deletions lib/redmine_webhook/projects_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ module RedmineWebhook
module ProjectsHelperPatch
def project_settings_tabs
tabs = super
tabs << {
webhook_tab = {
:name => 'webhook',
:controller => 'webhook_settings',
:action => :show,
:partial => 'webhook_settings/show',
:label => :webhook
}
tabs << webhook_tab if User.current.allowed_to?(:manage_hook, @project)
tabs
end
end

ProjectsHelper.prepend ProjectsHelperPatch
end

ProjectsController.send(:helper, RedmineWebhook::ProjectsHelperPatch)

0 comments on commit 82f59b5

Please sign in to comment.