Commit 929ab909 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Group masters should be able to create/close milestones

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 78d542fc
...@@ -38,7 +38,7 @@ class Groups::MilestonesController < Groups::ApplicationController ...@@ -38,7 +38,7 @@ class Groups::MilestonesController < Groups::ApplicationController
private private
def authorize_group_milestone! def authorize_group_milestone!
return render_404 unless can?(current_user, :admin_group, group) return render_404 unless can?(current_user, :admin_milestones, group)
end end
def milestone_params def milestone_params
......
...@@ -233,6 +233,7 @@ class Ability ...@@ -233,6 +233,7 @@ class Ability
if group.has_master?(user) || group.has_owner?(user) || user.admin? if group.has_master?(user) || group.has_owner?(user) || user.admin?
rules.push(*[ rules.push(*[
:create_projects, :create_projects,
:admin_milestones
]) ])
end end
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
%span.label.label-gray %span.label.label-gray
= milestone.project.name = milestone.project.name
.col-sm-6 .col-sm-6
- if can?(current_user, :admin_group, @group) - if can?(current_user, :admin_milestones, @group)
- if milestone.closed? - if milestone.closed?
= link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-xs btn-grouped btn-reopen" = link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-xs btn-grouped btn-reopen"
- else - else
......
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
= render 'shared/milestones_filter' = render 'shared/milestones_filter'
.gray-content-block .gray-content-block
.pull-right - if can?(current_user, :admin_milestones, @group)
%span.pull-right.hidden-xs .pull-right
= link_to new_group_milestone_path(@group), class: "btn btn-new" do %span.pull-right.hidden-xs
New Milestone = link_to new_group_milestone_path(@group), class: "btn btn-new" do
New Milestone
.oneline .oneline
Only milestones from Only milestones from
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
Open Open
Milestone #{@milestone.title} Milestone #{@milestone.title}
.pull-right .pull-right
- if can?(current_user, :admin_group, @group) - if can?(current_user, :admin_milestones, @group)
- if @milestone.active? - if @milestone.active?
= link_to 'Close Milestone', group_milestone_path(@group, @milestone.safe_title, title: @milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-sm btn-close" = link_to 'Close Milestone', group_milestone_path(@group, @milestone.safe_title, title: @milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-sm btn-close"
- else - else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment