Commit 4a53e028 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'improve/dash_projects_page' of /home/git/repositories/gitlab/gitlabhq into 6-0-dev

parents c9370b75 a3b42b6f
class DashboardController < ApplicationController class DashboardController < ApplicationController
respond_to :html respond_to :html
before_filter :load_projects before_filter :load_projects, except: [:projects]
before_filter :event_filter, only: :show before_filter :event_filter, only: :show
def show def show
...@@ -26,16 +26,18 @@ class DashboardController < ApplicationController ...@@ -26,16 +26,18 @@ class DashboardController < ApplicationController
def projects def projects
@projects = case params[:scope] @projects = case params[:scope]
when 'personal' then when 'personal' then
@projects.personal(current_user) current_user.namespace.projects
when 'joined' then when 'joined' then
@projects.joined(current_user) current_user.authorized_projects.joined(current_user)
when 'owned' then
current_user.owned_projects
else else
@projects current_user.authorized_projects
end end.sorted_by_activity
@projects = @projects.search(params[:search]) if params[:search].present? @projects = @projects.search(params[:search]) if params[:search].present?
@labels = Project.where(id: @projects.map(&:id)).tags_on(:labels) @labels = current_user.authorized_projects.tags_on(:labels)
@projects = @projects.tagged_with(params[:label]) if params[:label].present? @projects = @projects.tagged_with(params[:label]) if params[:label].present?
@projects = @projects.page(params[:page]).per(30) @projects = @projects.page(params[:page]).per(30)
......
%h3.page_title
Projects
%span
(#{@projects.total_count})
- if current_user.can_create_project?
%span.pull-right
= link_to new_project_path, class: "btn btn-tiny info" do
%i.icon-plus
New Project
%hr
.row .row
.span3 .span3
%ul.nav.nav-pills.nav-stacked %ul.nav.nav-pills.nav-stacked
...@@ -19,7 +7,10 @@ ...@@ -19,7 +7,10 @@
= link_to "Personal", projects_dashboard_path(scope: 'personal') = link_to "Personal", projects_dashboard_path(scope: 'personal')
= nav_tab :scope, 'joined' do = nav_tab :scope, 'joined' do
= link_to "Joined", projects_dashboard_path(scope: 'joined') = link_to "Joined", projects_dashboard_path(scope: 'joined')
= nav_tab :scope, 'owned' do
= link_to "Owned", projects_dashboard_path(scope: 'owned')
- if @labels.present?
%p.light Filter by label: %p.light Filter by label:
%ul.bordered-list %ul.bordered-list
- @labels.each do |label| - @labels.each do |label|
...@@ -30,47 +21,29 @@ ...@@ -30,47 +21,29 @@
.span9 .span9
= form_tag projects_dashboard_path, method: 'get' do .ui-box
%fieldset.dashboard-search-filter %h5.title
= hidden_field_tag "scope", params[:scope] Projects (#{@projects.total_count})
= search_field_tag "search", params[:search], { id: 'dashboard_projects_search', placeholder: 'Search', class: 'left input-xxlarge'} %ul.well-list
= button_tag type: 'submit', class: 'btn' do
%i.icon-search
%ul.bordered-list
- @projects.each do |project| - @projects.each do |project|
%li.clearfix %li
.clearfix - if project.public
%h5 = public_icon
- else
= private_icon
= link_to project_path(project), class: dom_class(project) do = link_to project_path(project), class: dom_class(project) do
- if project.namespace
= project.namespace.human_name
%span= "/"
%strong %strong
= truncate(project.name, length: 45) = project.name_with_namespace
.pull-right.light
- if project.owner == current_user
%i.icon-wrench
- tm = project.team.get_tm(current_user.id)
- if tm
%strong= tm.project_access_human
.clearfix
.left
- if project.description.present? - if project.description.present?
%span.light= project.description %span.light
- project.labels.each do |label| = truncate project.description, length: 80
%span.label.label-info
%i.icon-tag
= label.name
.pull-right.light .pull-right.light
%small.light %small Last activity #{project_last_activity(project)}
Last activity #{project_last_activity(project)}
- if @projects.blank? - if @projects.blank?
%li %li
%h3.nothing_here_message There are no projects here. %h3.nothing_here_message There are no projects here.
.bottom .bottom
%hr
= paginate @projects, theme: "gitlab" = paginate @projects, theme: "gitlab"
...@@ -6,7 +6,3 @@ Feature: Dashboard projects ...@@ -6,7 +6,3 @@ Feature: Dashboard projects
Scenario: I should see projects list Scenario: I should see projects list
Then I should see projects list Then I should see projects list
Scenario: I should see project I am looking for
Given I search for "Sho"
Then I should see "Shop" project link
...@@ -8,16 +8,4 @@ class DashboardProjects < Spinach::FeatureSteps ...@@ -8,16 +8,4 @@ class DashboardProjects < Spinach::FeatureSteps
page.should have_link project.name_with_namespace page.should have_link project.name_with_namespace
end end
end end
Given 'I search for "Sho"' do
fill_in "dashboard_projects_search", with: "Sho"
within ".dashboard-search-filter" do
find('button').click
end
end
Then 'I should see "Shop" project link' do
page.should have_link "Shop"
end
end end
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