summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-03 18:36:37 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-03 18:36:37 +0300
commit9f4fde04f5b74199c9bd72621e03c544aaf6f2ef (patch)
treeabff3e715f7e88c9b313c025e5e97b830af1bfa7 /app
parentd61a21d2d77808977fc7d1ea96a5f123719b8b7d (diff)
downloadgitlab-ce-9f4fde04f5b74199c9bd72621e03c544aaf6f2ef.tar.gz
Dont show project limit sidebar if user can own 100+ more projects
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb6
-rw-r--r--app/views/profiles/show.html.haml21
2 files changed, 16 insertions, 11 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index dcbf58123fe..455936321ff 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -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
diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml
index 9cab3ba5252..f63729ffdf6 100644
--- a/app/views/profiles/show.html.haml
+++ b/app/views/profiles/show.html.haml
@@ -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