Commit 9f4fde04f5b74199c9bd72621e03c544aaf6f2ef
1 parent
d61a21d2
Exists in
master
and in
4 other branches
Dont show project limit sidebar if user can own 100+ more projects
Showing
2 changed files
with
16 additions
and
11 deletions
Show diff stats
app/models/user.rb
... | ... | @@ -325,9 +325,13 @@ class User < ActiveRecord::Base |
325 | 325 | MergeRequest.cared(self) |
326 | 326 | end |
327 | 327 | |
328 | + def projects_limit_left | |
329 | + projects_limit - owned_projects.count | |
330 | + end | |
331 | + | |
328 | 332 | def projects_limit_percent |
329 | 333 | return 100 if projects_limit.zero? |
330 | - (personal_projects.count.to_f / projects_limit) * 100 | |
334 | + (owned_projects.count.to_f / projects_limit) * 100 | |
331 | 335 | end |
332 | 336 | |
333 | 337 | def recent_push project_id = nil | ... | ... |
app/views/profiles/show.html.haml
... | ... | @@ -73,16 +73,17 @@ |
73 | 73 | Want to share a team between projects? |
74 | 74 | = link_to new_team_path, class: "btn btn-tiny" do |
75 | 75 | Create a team |
76 | - %fieldset | |
77 | - %legend | |
78 | - Personal projects: | |
79 | - %small.pull-right | |
80 | - %span= current_user.owned_projects.count | |
81 | - of | |
82 | - %span= current_user.projects_limit | |
83 | - .padded | |
84 | - .progress | |
85 | - .bar{style: "width: #{current_user.projects_limit_percent}%;"} | |
76 | + - unless current_user.projects_limit_left > 100 | |
77 | + %fieldset | |
78 | + %legend | |
79 | + Owned projects: | |
80 | + %small.pull-right | |
81 | + %span= current_user.owned_projects.count | |
82 | + of | |
83 | + %span= current_user.projects_limit | |
84 | + .padded | |
85 | + .progress | |
86 | + .bar{style: "width: #{current_user.projects_limit_percent}%;"} | |
86 | 87 | |
87 | 88 | %fieldset |
88 | 89 | %legend | ... | ... |