Dont show project limit sidebar if user can own 100+ more projects
This commit is contained in:
parent
d61a21d2d7
commit
9f4fde04f5
|
@ -325,9 +325,13 @@ class User < ActiveRecord::Base
|
|||
MergeRequest.cared(self)
|
||||
end
|
||||
|
||||
def projects_limit_left
|
||||
projects_limit - owned_projects.count
|
||||
end
|
||||
|
||||
def projects_limit_percent
|
||||
return 100 if projects_limit.zero?
|
||||
(personal_projects.count.to_f / projects_limit) * 100
|
||||
(owned_projects.count.to_f / projects_limit) * 100
|
||||
end
|
||||
|
||||
def recent_push project_id = nil
|
||||
|
|
|
@ -73,16 +73,17 @@
|
|||
Want to share a team between projects?
|
||||
= link_to new_team_path, class: "btn btn-tiny" do
|
||||
Create a team
|
||||
%fieldset
|
||||
%legend
|
||||
Personal projects:
|
||||
%small.pull-right
|
||||
%span= current_user.owned_projects.count
|
||||
of
|
||||
%span= current_user.projects_limit
|
||||
.padded
|
||||
.progress
|
||||
.bar{style: "width: #{current_user.projects_limit_percent}%;"}
|
||||
- unless current_user.projects_limit_left > 100
|
||||
%fieldset
|
||||
%legend
|
||||
Owned projects:
|
||||
%small.pull-right
|
||||
%span= current_user.owned_projects.count
|
||||
of
|
||||
%span= current_user.projects_limit
|
||||
.padded
|
||||
.progress
|
||||
.bar{style: "width: #{current_user.projects_limit_percent}%;"}
|
||||
|
||||
%fieldset
|
||||
%legend
|
||||
|
|
Loading…
Reference in New Issue