Commit 4a53e0285c9f823cde7cf8dec9d065952b707864
Exists in
master
and in
4 other branches
Merge branch 'improve/dash_projects_page' of /home/git/repositories/gitlab/gitlabhq into 6-0-dev
Showing
4 changed files
with
38 additions
and
79 deletions
Show diff stats
app/controllers/dashboard_controller.rb
1 | 1 | class DashboardController < ApplicationController |
2 | 2 | respond_to :html |
3 | 3 | |
4 | - before_filter :load_projects | |
4 | + before_filter :load_projects, except: [:projects] | |
5 | 5 | before_filter :event_filter, only: :show |
6 | 6 | |
7 | 7 | def show |
... | ... | @@ -26,16 +26,18 @@ class DashboardController < ApplicationController |
26 | 26 | def projects |
27 | 27 | @projects = case params[:scope] |
28 | 28 | when 'personal' then |
29 | - @projects.personal(current_user) | |
29 | + current_user.namespace.projects | |
30 | 30 | when 'joined' then |
31 | - @projects.joined(current_user) | |
31 | + current_user.authorized_projects.joined(current_user) | |
32 | + when 'owned' then | |
33 | + current_user.owned_projects | |
32 | 34 | else |
33 | - @projects | |
34 | - end | |
35 | + current_user.authorized_projects | |
36 | + end.sorted_by_activity | |
35 | 37 | |
36 | 38 | @projects = @projects.search(params[:search]) if params[:search].present? |
37 | 39 | |
38 | - @labels = Project.where(id: @projects.map(&:id)).tags_on(:labels) | |
40 | + @labels = current_user.authorized_projects.tags_on(:labels) | |
39 | 41 | |
40 | 42 | @projects = @projects.tagged_with(params[:label]) if params[:label].present? |
41 | 43 | @projects = @projects.page(params[:page]).per(30) | ... | ... |
app/views/dashboard/projects.html.haml
1 | -%h3.page_title | |
2 | - Projects | |
3 | - %span | |
4 | - (#{@projects.total_count}) | |
5 | - - if current_user.can_create_project? | |
6 | - %span.pull-right | |
7 | - = link_to new_project_path, class: "btn btn-tiny info" do | |
8 | - %i.icon-plus | |
9 | - New Project | |
10 | - | |
11 | - | |
12 | -%hr | |
13 | 1 | .row |
14 | 2 | .span3 |
15 | 3 | %ul.nav.nav-pills.nav-stacked |
... | ... | @@ -19,58 +7,43 @@ |
19 | 7 | = link_to "Personal", projects_dashboard_path(scope: 'personal') |
20 | 8 | = nav_tab :scope, 'joined' do |
21 | 9 | = link_to "Joined", projects_dashboard_path(scope: 'joined') |
10 | + = nav_tab :scope, 'owned' do | |
11 | + = link_to "Owned", projects_dashboard_path(scope: 'owned') | |
22 | 12 | |
23 | - %p.light Filter by label: | |
24 | - %ul.bordered-list | |
25 | - - @labels.each do |label| | |
26 | - %li{ class: (label.name == params[:label]) ? 'active' : 'light' } | |
27 | - = link_to projects_dashboard_path(scope: params[:scope], label: label.name) do | |
28 | - %i.icon-tag | |
29 | - = label.name | |
13 | + - if @labels.present? | |
14 | + %p.light Filter by label: | |
15 | + %ul.bordered-list | |
16 | + - @labels.each do |label| | |
17 | + %li{ class: (label.name == params[:label]) ? 'active' : 'light' } | |
18 | + = link_to projects_dashboard_path(scope: params[:scope], label: label.name) do | |
19 | + %i.icon-tag | |
20 | + = label.name | |
30 | 21 | |
31 | 22 | |
32 | 23 | .span9 |
33 | - = form_tag projects_dashboard_path, method: 'get' do | |
34 | - %fieldset.dashboard-search-filter | |
35 | - = hidden_field_tag "scope", params[:scope] | |
36 | - = search_field_tag "search", params[:search], { id: 'dashboard_projects_search', placeholder: 'Search', class: 'left input-xxlarge'} | |
37 | - = button_tag type: 'submit', class: 'btn' do | |
38 | - %i.icon-search | |
39 | - | |
40 | - %ul.bordered-list | |
41 | - - @projects.each do |project| | |
42 | - %li.clearfix | |
43 | - .clearfix | |
44 | - %h5 | |
45 | - = link_to project_path(project), class: dom_class(project) do | |
46 | - - if project.namespace | |
47 | - = project.namespace.human_name | |
48 | - %span= "/" | |
49 | - %strong | |
50 | - = truncate(project.name, length: 45) | |
51 | - .pull-right.light | |
52 | - - if project.owner == current_user | |
53 | - %i.icon-wrench | |
54 | - - tm = project.team.get_tm(current_user.id) | |
55 | - - if tm | |
56 | - %strong= tm.project_access_human | |
57 | - .clearfix | |
58 | - .left | |
59 | - - if project.description.present? | |
60 | - %span.light= project.description | |
61 | - - project.labels.each do |label| | |
62 | - %span.label.label-info | |
63 | - %i.icon-tag | |
64 | - = label.name | |
24 | + .ui-box | |
25 | + %h5.title | |
26 | + Projects (#{@projects.total_count}) | |
27 | + %ul.well-list | |
28 | + - @projects.each do |project| | |
29 | + %li | |
30 | + - if project.public | |
31 | + = public_icon | |
32 | + - else | |
33 | + = private_icon | |
34 | + = link_to project_path(project), class: dom_class(project) do | |
35 | + %strong | |
36 | + = project.name_with_namespace | |
37 | + - if project.description.present? | |
38 | + %span.light | |
39 | + = truncate project.description, length: 80 | |
65 | 40 | |
66 | 41 | .pull-right.light |
67 | - %small.light | |
68 | - Last activity #{project_last_activity(project)} | |
42 | + %small Last activity #{project_last_activity(project)} | |
69 | 43 | |
70 | - - if @projects.blank? | |
71 | - %li | |
72 | - %h3.nothing_here_message There are no projects here. | |
44 | + - if @projects.blank? | |
45 | + %li | |
46 | + %h3.nothing_here_message There are no projects here. | |
73 | 47 | .bottom |
74 | - %hr | |
75 | 48 | = paginate @projects, theme: "gitlab" |
76 | 49 | ... | ... |
features/dashboard/projects.feature
features/steps/dashboard/dashboard_projects.rb
... | ... | @@ -8,16 +8,4 @@ class DashboardProjects < Spinach::FeatureSteps |
8 | 8 | page.should have_link project.name_with_namespace |
9 | 9 | end |
10 | 10 | end |
11 | - | |
12 | - Given 'I search for "Sho"' do | |
13 | - fill_in "dashboard_projects_search", with: "Sho" | |
14 | - | |
15 | - within ".dashboard-search-filter" do | |
16 | - find('button').click | |
17 | - end | |
18 | - end | |
19 | - | |
20 | - Then 'I should see "Shop" project link' do | |
21 | - page.should have_link "Shop" | |
22 | - end | |
23 | 11 | end | ... | ... |