Commit d12a6ac4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'dashboard-restyle' into 'master'

Dashboard restyle

For #2069

See merge request !1675
parents c621a771 9ed71f77
class @Dashboard class @Dashboard
constructor: -> constructor: ->
@initSidebarTab()
new ProjectsList() new ProjectsList()
initSidebarTab: ->
key = "dashboard_sidebar_filter"
# store selection in cookie
$('.dash-sidebar-tabs a').on 'click', (e) ->
$.cookie(key, $(e.target).attr('id'))
# show tab from cookie
sidebar_filter = $.cookie(key)
$("#" + sidebar_filter).tab('show') if sidebar_filter
...@@ -23,25 +23,6 @@ ...@@ -23,25 +23,6 @@
} }
} }
.dash-sidebar-tabs {
margin-bottom: 2px;
border: none;
margin: 0 !important;
li {
&.active {
a {
background-color: whitesmoke !important;
border-bottom: 1px solid whitesmoke !important;
}
}
a {
border-color: #DDD !important;
}
}
}
.project-row, .group-row { .project-row, .group-row {
padding: 0 !important; padding: 0 !important;
font-size: 14px; font-size: 14px;
...@@ -116,15 +97,6 @@ ...@@ -116,15 +97,6 @@
} }
} }
.dash-new-group {
background: $gl-success;
border: 1px solid $gl-success;
a {
color: #FFF;
}
}
.dash-list .str-truncated { .dash-list .str-truncated {
max-width: 72%; max-width: 72%;
} }
...@@ -5,15 +5,9 @@ class DashboardController < ApplicationController ...@@ -5,15 +5,9 @@ class DashboardController < ApplicationController
before_filter :event_filter, only: :show before_filter :event_filter, only: :show
def show def show
@projects_limit = 20
@groups = current_user.authorized_groups.order_name_asc
@has_authorized_projects = @projects.count > 0
@projects_count = @projects.count
@projects = @projects.includes(:namespace) @projects = @projects.includes(:namespace)
@last_push = current_user.recent_push @last_push = current_user.recent_push
@publicish_project_count = Project.publicish(current_user).count
respond_to do |format| respond_to do |format|
format.html format.html
...@@ -29,29 +23,6 @@ class DashboardController < ApplicationController ...@@ -29,29 +23,6 @@ class DashboardController < ApplicationController
end end
end end
def projects
@projects = case params[:scope]
when 'personal' then
current_user.namespace.projects
when 'joined' then
current_user.authorized_projects.joined(current_user)
when 'owned' then
current_user.owned_projects
else
current_user.authorized_projects
end
@projects = @projects.where(namespace_id: Group.find_by(name: params[:group])) if params[:group].present?
@projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present?
@projects = @projects.includes(:namespace, :forked_from_project, :tags)
@projects = @projects.tagged_with(params[:tag]) if params[:tag].present?
@projects = @projects.sort(@sort = params[:sort])
@projects = @projects.page(params[:page]).per(30)
@tags = current_user.authorized_projects.tags_on(:tags)
@groups = current_user.authorized_groups
end
def merge_requests def merge_requests
@merge_requests = get_merge_requests_collection @merge_requests = get_merge_requests_collection
@merge_requests = @merge_requests.page(params[:page]).per(20) @merge_requests = @merge_requests.page(params[:page]).per(20)
......
...@@ -6,6 +6,9 @@ class Explore::ProjectsController < ApplicationController ...@@ -6,6 +6,9 @@ class Explore::ProjectsController < ApplicationController
def index def index
@projects = ProjectsFinder.new.execute(current_user) @projects = ProjectsFinder.new.execute(current_user)
@tags = @projects.tags_on(:tags)
@projects = @projects.tagged_with(params[:tag]) if params[:tag].present?
@projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present?
@projects = @projects.search(params[:search]) if params[:search].present? @projects = @projects.search(params[:search]) if params[:search].present?
@projects = @projects.sort(@sort = params[:sort]) @projects = @projects.sort(@sort = params[:sort])
@projects = @projects.includes(:namespace).page(params[:page]).per(20) @projects = @projects.includes(:namespace).page(params[:page]).per(20)
......
...@@ -105,7 +105,7 @@ class ProjectsController < ApplicationController ...@@ -105,7 +105,7 @@ class ProjectsController < ApplicationController
if request.referer.include?('/admin') if request.referer.include?('/admin')
redirect_to admin_namespaces_projects_path redirect_to admin_namespaces_projects_path
else else
redirect_to projects_dashboard_path redirect_to dashboard_path
end end
end end
end end
......
module DashboardHelper module DashboardHelper
def projects_dashboard_filter_path(options={})
exist_opts = {
sort: params[:sort],
scope: params[:scope],
group: params[:group],
tag: params[:tag],
visibility_level: params[:visibility_level],
}
options = exist_opts.merge(options)
path = request.path
path << "?#{options.to_param}"
path
end
def assigned_issues_dashboard_path def assigned_issues_dashboard_path
issues_dashboard_path(assignee_id: current_user.id) issues_dashboard_path(assignee_id: current_user.id)
end end
......
module ExploreHelper
def explore_projects_filter_path(options={})
exist_opts = {
sort: params[:sort],
scope: params[:scope],
group: params[:group],
tag: params[:tag],
visibility_level: params[:visibility_level],
}
options = exist_opts.merge(options)
path = request.path
path << "?#{options.to_param}"
path
end
end
.panel.panel-default
.panel-heading.clearfix
.input-group
= search_field_tag :filter_group, nil, placeholder: 'Filter by name', class: 'dash-filter form-control'
- if current_user.can_create_group?
.input-group-addon.dash-new-group
= link_to new_group_path, class: "" do
%strong New group
%ul.well-list.dash-list
- groups.each do |group|
%li.group-row
= link_to group_path(id: group.path), class: dom_class(group) do
.dash-project-avatar
= image_tag group_icon(group.path), class: "avatar s40"
%span.group-name.filter-title
= truncate(group.name, length: 35)
%span.arrow
%i.fa.fa-angle-right
- if groups.blank?
%li
.nothing-here-block You have no groups yet.
.dash-projects-filters.append-bottom-20
.append-right-20
%ul.nav.nav-tabs
= nav_tab :scope, nil do
= link_to projects_dashboard_filter_path(scope: nil) do
All
= nav_tab :scope, 'personal' do
= link_to projects_dashboard_filter_path(scope: 'personal') do
Personal
= nav_tab :scope, 'joined' do
= link_to projects_dashboard_filter_path(scope: 'joined') do
Joined
= nav_tab :scope, 'owned' do
= link_to projects_dashboard_filter_path(scope: 'owned') do
Owned
.dropdown.inline.append-right-10
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%i.fa.fa-globe
%span.light Visibility:
- if params[:visibility_level].present?
= visibility_level_label(params[:visibility_level].to_i)
- else
Any
%b.caret
%ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(visibility_level: nil) do
Any
- Gitlab::VisibilityLevel.values.each do |level|
%li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' }
= link_to projects_dashboard_filter_path(visibility_level: level) do
= visibility_level_icon(level)
= visibility_level_label(level)
- if @groups.present?
.dropdown.inline.append-right-10
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%i.fa.fa-group
%span.light Group:
- if params[:group].present?
= Group.find_by(name: params[:group]).name
- else
Any
%b.caret
%ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(group: nil) do
Any
- @groups.each do |group|
%li{ class: (group.name == params[:group]) ? 'active' : 'light' }
= link_to projects_dashboard_filter_path(group: group.name) do
= group.name
%small.pull-right
= group.projects.count
- if @tags.present?
.dropdown.inline.append-right-10
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%i.fa.fa-tags
%span.light Tags:
- if params[:tag].present?
= params[:tag]
- else
Any
%b.caret
%ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(tag: nil) do
Any
- @tags.each do |tag|
%li{ class: (tag.name == params[:tag]) ? 'active' : 'light' }
= link_to projects_dashboard_filter_path(tag: tag.name) do
%i.fa.fa-tag
= tag.name
.pull-right
.dropdown.inline
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%span.light sort:
- if @sort.present?
= sort_options_hash[@sort]
- else
= sort_title_recently_created
%b.caret
%ul.dropdown-menu
%li
= link_to projects_dashboard_filter_path(sort: sort_value_recently_created) do
= sort_title_recently_created
= link_to projects_dashboard_filter_path(sort: sort_value_oldest_created) do
= sort_title_oldest_created
= link_to projects_dashboard_filter_path(sort: sort_value_recently_updated) do
= sort_title_recently_updated
= link_to projects_dashboard_filter_path(sort: sort_value_oldest_updated) do
= sort_title_oldest_updated
= link_to projects_dashboard_filter_path(sort: sort_value_name) do
= sort_title_name
%ul.nav.nav-tabs.dash-sidebar-tabs = render "dashboard/projects", projects: @projects
%li.active
= link_to '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' do
Projects
%span.badge= @projects_count
%li
= link_to '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' do
Groups
%span.badge= @groups.count
.tab-content
.tab-pane.active#projects
= render "dashboard/projects", projects: @projects
.tab-pane#groups
= render "dashboard/groups", groups: @groups
.prepend-top-20 .prepend-top-20
= render 'shared/promo' = render 'shared/promo'
- publicish_project_count = Project.publicish(current_user).count
%h3.page-title Welcome to GitLab! %h3.page-title Welcome to GitLab!
%p.light Self hosted Git management application. %p.light Self hosted Git management application.
%hr %hr
...@@ -35,7 +36,7 @@ ...@@ -35,7 +36,7 @@
%i.fa.fa-plus %i.fa.fa-plus
New Group New Group
-if @publicish_project_count > 0 -if publicish_project_count > 0
%hr %hr
%div %div
.dashboard-intro-icon .dashboard-intro-icon
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
.dashboard-intro-text .dashboard-intro-text
%p.slead %p.slead
There are There are
%strong= @publicish_project_count %strong= publicish_project_count
public projects on this server. public projects on this server.
%br %br
Public projects are an easy way to allow everyone to have read-only access. Public projects are an easy way to allow everyone to have read-only access.
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
%i.fa.fa-sign-out %i.fa.fa-sign-out
Leave Leave
= image_tag group_icon(group.path), class: "avatar s40 avatar-tile"
= link_to group, class: 'group-name' do = link_to group, class: 'group-name' do
%strong= group.name %strong= group.name
......
%h3.page-title
My Projects
= link_to new_project_path, class: "btn btn-new pull-right" do
%i.fa.fa-plus
New Project
%p.light
All projects you have access to are listed here. Public projects are not included here unless you are a member
%hr
.side-filters
= render "projects_filter"
.dash-projects
%ul.bordered-list.my-projects.top-list
- @projects.each do |project|
%li.my-project-row
%h4.project-title
.pull-left
= project_icon(project, alt: '', class: 'avatar project-avatar s60')
.project-access-icon
= visibility_level_icon(project.visibility_level)
= link_to project_path(project), class: dom_class(project) do
%strong= project.name_with_namespace
- if project.forked_from_project
&nbsp;
%small
%i.fa.fa-code-fork
Forked from:
= link_to project.forked_from_project.name_with_namespace, namespace_project_path(project.namespace, project.forked_from_project)
- if current_user.can_leave_project?(project)
.pull-right
= link_to leave_namespace_project_team_members_path(project.namespace, project), data: { confirm: "Leave project?"}, method: :delete, remote: true, class: "btn-tiny btn remove-row", title: 'Leave project' do
%i.fa.fa-sign-out
Leave
.project-info
.pull-right
- if project.archived?
%span.label
%i.fa.fa-archive
Archived
- project.tags.each do |tag|
%span.label.label-info
%i.fa.fa-tag
= tag.name
- if project.description.present?
%p= truncate project.description, length: 100
.last-activity
%span.light Last activity:
%span.date= project_last_activity(project)
- if @projects.blank?
%li
.nothing-here-block There are no projects here.
.bottom
= paginate @projects, theme: "gitlab"
- if @has_authorized_projects - if @projects.any?
.dashboard.row .dashboard.row
%section.activities.col-md-8 %section.activities.col-md-8
= render 'activities' = render 'activities'
......
.pull-left
= form_tag explore_projects_filter_path, method: :get, class: 'form-inline form-tiny' do |f|
.form-group
= search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input input-mn-300", id: "projects_search"
.form-group
= button_tag 'Search', class: "btn btn-primary wide"
.pull-right.hidden-sm.hidden-xs
- if current_user
.dropdown.inline.append-right-10
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%i.fa.fa-globe
%span.light Visibility:
- if params[:visibility_level].present?
= visibility_level_label(params[:visibility_level].to_i)
- else
Any
%b.caret
%ul.dropdown-menu
%li
= link_to explore_projects_filter_path(visibility_level: nil) do
Any
- Gitlab::VisibilityLevel.values.each do |level|
%li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' }
= link_to explore_projects_filter_path(visibility_level: level) do
= visibility_level_icon(level)
= visibility_level_label(level)
- if @tags.present?
.dropdown.inline.append-right-10
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%i.fa.fa-tags
%span.light Tags:
- if params[:tag].present?
= params[:tag]
- else
Any
%b.caret
%ul.dropdown-menu
%li
= link_to explore_projects_filter_path(tag: nil) do
Any
- @tags.each do |tag|
%li{ class: (tag.name == params[:tag]) ? 'active' : 'light' }
= link_to explore_projects_filter_path(tag: tag.name) do
%i.fa.fa-tag
= tag.name
.dropdown.inline
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
%span.light sort:
- if @sort.present?
= sort_options_hash[@sort]
- else
= sort_title_recently_created
%b.caret
%ul.dropdown-menu
%li
= link_to explore_projects_filter_path(sort: sort_value_recently_created) do
= sort_title_recently_created
= link_to explore_projects_filter_path(sort: sort_value_oldest_created) do
= sort_title_oldest_created
= link_to explore_projects_filter_path(sort: sort_value_recently_updated) do
= sort_title_recently_updated
= link_to explore_projects_filter_path(sort: sort_value_oldest_updated) do
= sort_title_oldest_updated
.clearfix .clearfix
.pull-left = render 'filter'
= form_tag explore_projects_path, method: :get, class: 'form-inline form-tiny' do |f|
.form-group
= search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input input-mn-300", id: "projects_search"
.form-group
= button_tag 'Search', class: "btn btn-primary wide"
.pull-right
.dropdown.inline
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
%span.light sort:
- if @sort.present?
= sort_options_hash[@sort]
- else
= sort_title_recently_created
%b.caret
%ul.dropdown-menu
%li
= link_to explore_projects_path(sort: sort_value_recently_created) do
= sort_title_recently_created
= link_to explore_projects_path(sort: sort_value_oldest_created) do
= sort_title_oldest_created
= link_to explore_projects_path(sort: sort_value_recently_updated) do
= sort_title_recently_updated
= link_to explore_projects_path(sort: sort_value_oldest_updated) do
= sort_title_oldest_updated
%hr %hr
.public-projects .public-projects
......
...@@ -3,12 +3,7 @@ ...@@ -3,12 +3,7 @@
= link_to root_path, title: 'Home', class: 'shortcuts-activity' do = link_to root_path, title: 'Home', class: 'shortcuts-activity' do
%i.fa.fa-dashboard %i.fa.fa-dashboard
%span %span
Activity Your Projects
= nav_link(path: 'dashboard#projects') do
= link_to projects_dashboard_path, title: 'Projects', class: 'shortcuts-projects' do
%i.fa.fa-cube
%span
Projects
= nav_link(path: 'projects#starred') do = nav_link(path: 'projects#starred') do
= link_to starred_dashboard_projects_path, title: 'Starred Projects' do = link_to starred_dashboard_projects_path, title: 'Starred Projects' do
%i.fa.fa-star %i.fa.fa-star
...@@ -41,4 +36,3 @@ ...@@ -41,4 +36,3 @@
%i.fa.fa-question-circle %i.fa.fa-question-circle
%span %span
Help Help
...@@ -208,7 +208,6 @@ Gitlab::Application.routes.draw do ...@@ -208,7 +208,6 @@ Gitlab::Application.routes.draw do
# #
resource :dashboard, controller: 'dashboard', only: [:show] do resource :dashboard, controller: 'dashboard', only: [:show] do
member do member do
get :projects
get :issues get :issues
get :merge_requests get :merge_requests
end end
......
...@@ -10,8 +10,3 @@ Feature: Dashboard Archived Projects ...@@ -10,8 +10,3 @@ Feature: Dashboard Archived Projects
Scenario: I should see non-archived projects on dashboard Scenario: I should see non-archived projects on dashboard
Then I should see "Shop" project link Then I should see "Shop" project link
And I should not see "Forum" project link And I should not see "Forum" project link
Scenario: I should see all projects on projects page
And I visit dashboard projects page
Then I should see "Shop" project link
And I should see "Forum" project link
...@@ -46,3 +46,11 @@ Feature: Dashboard Group ...@@ -46,3 +46,11 @@ Feature: Dashboard Group
When I visit dashboard groups page When I visit dashboard groups page
Then I should see group "Owned" in group list Then I should see group "Owned" in group list
Then I should not see group "Guest" in group list Then I should not see group "Guest" in group list
Scenario: Create a group from dasboard
And I visit dashboard groups page
And I click new group link
And submit form with new group "Samurai" info
Then I should be redirected to group "Samurai" page
And I should see newly created group "Samurai"
@dashboard
Feature: Dashboard Projects
Background:
Given I sign in as a user
And I own project "Shop"
And I visit dashboard projects page
Scenario: I should see projects list
Then I should see projects list
...@@ -10,14 +10,6 @@ Feature: Groups ...@@ -10,14 +10,6 @@ Feature: Groups
Then I should see group "Owned" projects list Then I should see group "Owned" projects list
And I should see projects activity feed And I should see projects activity feed
Scenario: Create a group from dasboard
When I visit group "Owned" page
And I visit dashboard page
And I click new group link
And submit form with new group "Samurai" info
Then I should be redirected to group "Samurai" page
And I should see newly created group "Samurai"
Scenario: I should see group "Owned" issues list Scenario: I should see group "Owned" issues list
Given project from group "Owned" has issues assigned to me Given project from group "Owned" has issues assigned to me
When I visit group "Owned" issues page When I visit group "Owned" issues page
......
...@@ -14,15 +14,6 @@ Feature: Project Archived ...@@ -14,15 +14,6 @@ Feature: Project Archived
And I visit project "Forum" page And I visit project "Forum" page
Then I should see "Archived" Then I should see "Archived"
Scenario: I should not see archived on projects page with no archived projects
And I visit dashboard projects page
Then I should not see "Archived"
Scenario: I should see archived on projects page with archived projects
And project "Forum" is archived
And I visit dashboard projects page
Then I should see "Archived"
Scenario: I archive project Scenario: I archive project
When project "Shop" has push event When project "Shop" has push event
And I visit project "Shop" page And I visit project "Shop" page
......
...@@ -41,4 +41,23 @@ class Spinach::Features::DashboardGroup < Spinach::FeatureSteps ...@@ -41,4 +41,23 @@ class Spinach::Features::DashboardGroup < Spinach::FeatureSteps
step 'I should not see group "Guest" in group list' do step 'I should not see group "Guest" in group list' do
page.should_not have_content("Guest") page.should_not have_content("Guest")
end end
step 'I click new group link' do
click_link "New Group"
end
step 'submit form with new group "Samurai" info' do
fill_in 'group_path', with: 'Samurai'
fill_in 'group_description', with: 'Tokugawa Shogunate'
click_button "Create group"
end
step 'I should be redirected to group "Samurai" page' do
current_path.should == group_path(Group.find_by(name: 'Samurai'))
end
step 'I should see newly created group "Samurai"' do
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
end
end end
class Spinach::Features::DashboardProjects < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
step 'I should see projects list' do
@user.authorized_projects.all.each do |project|
page.should have_link project.name_with_namespace
end
end
end
...@@ -72,25 +72,6 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -72,25 +72,6 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
author: current_user author: current_user
end end
When 'I click new group link' do
click_link "New group"
end
step 'submit form with new group "Samurai" info' do
fill_in 'group_path', with: 'Samurai'
fill_in 'group_description', with: 'Tokugawa Shogunate'
click_button "Create group"
end
step 'I should be redirected to group "Samurai" page' do
current_path.should == group_path(Group.find_by(name: 'Samurai'))
end
step 'I should see newly created group "Samurai"' do
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
end
step 'I change group "Owned" name to "new-name"' do step 'I change group "Owned" name to "new-name"' do
fill_in 'group_name', with: 'new-name' fill_in 'group_name', with: 'new-name'
fill_in 'group_path', with: 'new-name' fill_in 'group_path', with: 'new-name'
......
...@@ -26,7 +26,7 @@ module SharedActiveTab ...@@ -26,7 +26,7 @@ module SharedActiveTab
end end
step 'the active main tab should be Home' do step 'the active main tab should be Home' do
ensure_active_main_tab('Activity') ensure_active_main_tab('Your Projects')
end end
step 'the active main tab should be Projects' do step 'the active main tab should be Projects' do
......
...@@ -25,8 +25,8 @@ describe "Dashboard access", feature: true do ...@@ -25,8 +25,8 @@ describe "Dashboard access", feature: true do
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /dashboard/projects" do describe "GET /dashboard/projects/starred" do
subject { projects_dashboard_path } subject { starred_dashboard_projects_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { is_expected.to be_allowed_for :user } it { is_expected.to be_allowed_for :user }
......
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