Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other Redmine plugins compatibility #37

Merged
merged 1 commit into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)