Commit bbc916ba authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

If user is owner of project it cant be removed from this project

parent 9fbbd6a6
...@@ -110,4 +110,8 @@ class UsersProject < ActiveRecord::Base ...@@ -110,4 +110,8 @@ class UsersProject < ActiveRecord::Base
def access_field def access_field
project_access project_access
end end
def owner?
project.owner == user
end
end end
...@@ -102,6 +102,9 @@ ...@@ -102,6 +102,9 @@
%strong %strong
= link_to user.name, admin_user_path(user) = link_to user.name, admin_user_path(user)
.pull-right .pull-right
%span.light= users_project.human_access - if users_project.owner?
= link_to admin_project_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn btn-small btn-remove" do %span.light Owner
%i.icon-remove - else
%span.light= users_project.human_access
= link_to admin_project_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn btn-small btn-remove" do
%i.icon-remove
...@@ -90,6 +90,9 @@ ...@@ -90,6 +90,9 @@
- if tm - if tm
.pull-right .pull-right
%span.light= tm.human_access - if tm.owner?
= link_to admin_project_member_path(project, tm.user), confirm: remove_from_project_team_message(project, @user), method: :delete, class: "btn btn-small btn-remove" do %span.light Owner
%i.icon-remove - else
%span.light= tm.human_access
= link_to admin_project_member_path(project, tm.user), confirm: remove_from_project_team_message(project, @user), method: :delete, class: "btn btn-small btn-remove" do
%i.icon-remove
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