diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-20 10:59:05 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-20 10:59:05 +0200 |
commit | b1c1a3d3cc90de98f03482a4b41b39fe9a992cc6 (patch) | |
tree | 3a36233e0fee6fa22a9213732a44f65943c08ebe | |
parent | 55fc58bda4a5592f2f8deaecec9526fbe4eecd6f (diff) | |
download | gitlab-ce-b1c1a3d3cc90de98f03482a4b41b39fe9a992cc6.tar.gz |
Refactor sidebar navigation for dashboard
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/assets/stylesheets/generic/common.scss | 20 | ||||
-rw-r--r-- | app/controllers/snippets_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/tab_helper.rb | 2 | ||||
-rw-r--r-- | app/views/dashboard/_projects_head.html.haml | 10 | ||||
-rw-r--r-- | app/views/dashboard/projects/starred.html.haml | 2 | ||||
-rw-r--r-- | app/views/dashboard/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/layouts/header/_default.html.haml | 8 | ||||
-rw-r--r-- | app/views/layouts/nav/_dashboard.html.haml | 26 | ||||
-rw-r--r-- | app/views/snippets/_head.html.haml | 7 | ||||
-rw-r--r-- | app/views/snippets/current_user_index.html.haml | 1 | ||||
-rw-r--r-- | app/views/snippets/index.html.haml | 3 |
11 files changed, 68 insertions, 15 deletions
diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss index d36530169a9..081c8e2dd38 100644 --- a/app/assets/stylesheets/generic/common.scss +++ b/app/assets/stylesheets/generic/common.scss @@ -373,3 +373,23 @@ table { border-color: #EEE !important; } } + +.center-top-menu { + border-bottom: 1px solid #EEE; + list-style: none; + text-align: center; + padding-bottom: 15px; + margin-bottom: 10px; + + li { + display: inline-block; + + a { + padding: 10px; + } + + &.active a { + color: #666; + } + } +} diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 8e7e45c781f..e6ef636c4f3 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -9,7 +9,7 @@ class SnippetsController < ApplicationController skip_before_action :authenticate_user!, only: [:index, :user_index, :show, :raw] - layout 'snippets' + layout 'dashboard' respond_to :html def index diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb index 77727337f07..9c99de1c3fa 100644 --- a/app/helpers/tab_helper.rb +++ b/app/helpers/tab_helper.rb @@ -67,6 +67,8 @@ module TabHelper path.any? do |single_path| current_path?(single_path) end + elsif page = options.delete(:page) + current_page?(page) else c = options.delete(:controller) a = options.delete(:action) diff --git a/app/views/dashboard/_projects_head.html.haml b/app/views/dashboard/_projects_head.html.haml new file mode 100644 index 00000000000..7de9480fd8f --- /dev/null +++ b/app/views/dashboard/_projects_head.html.haml @@ -0,0 +1,10 @@ +%ul.center-top-menu + = nav_link(path: ['dashboard#show', 'root#show'], html_options: {class: 'home'}) do + = link_to dashboard_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do + Your Projects + = nav_link(path: 'projects#starred') do + = link_to starred_dashboard_projects_path, title: 'Starred Projects', data: {placement: 'right'} do + Starred Projects + = nav_link(controller: :explore) do + = link_to explore_root_path, title: 'Explore', data: {toggle: 'tooltip', placement: 'bottom'} do + Explore Projects diff --git a/app/views/dashboard/projects/starred.html.haml b/app/views/dashboard/projects/starred.html.haml index 8aaa0a7f071..98b8cde4766 100644 --- a/app/views/dashboard/projects/starred.html.haml +++ b/app/views/dashboard/projects/starred.html.haml @@ -1,4 +1,6 @@ - page_title "Starred Projects" += render 'dashboard/projects_head' + - if @projects.any? = render 'shared/show_aside' diff --git a/app/views/dashboard/show.html.haml b/app/views/dashboard/show.html.haml index 5001c2101e1..a3a32b6932f 100644 --- a/app/views/dashboard/show.html.haml +++ b/app/views/dashboard/show.html.haml @@ -2,6 +2,8 @@ - if current_user = auto_discovery_link_tag(:atom, dashboard_url(format: :atom, private_token: current_user.private_token), title: "All activity") += render 'dashboard/projects_head' + - if @projects.any? = render 'shared/show_aside' diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index b3cd7b0e37b..12ddbe6f1b7 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -17,13 +17,13 @@ %li.visible-sm.visible-xs = link_to search_path, title: 'Search', data: {toggle: 'tooltip', placement: 'bottom'} do = icon('search') - %li.hidden-xs + -#%li.hidden-xs = link_to help_path, title: 'Help', data: {toggle: 'tooltip', placement: 'bottom'} do = icon('question-circle fw') - %li + -#%li = link_to explore_root_path, title: 'Explore', data: {toggle: 'tooltip', placement: 'bottom'} do = icon('globe fw') - %li + -#%li = link_to user_snippets_path(current_user), title: 'Your snippets', data: {toggle: 'tooltip', placement: 'bottom'} do = icon('clipboard fw') - if current_user.is_admin? @@ -34,7 +34,7 @@ %li.hidden-xs = link_to new_project_path, title: 'New project', data: {toggle: 'tooltip', placement: 'bottom'} do = icon('plus fw') - %li + -#%li = link_to profile_path, title: 'Profile settings', data: {toggle: 'tooltip', placement: 'bottom'} do = icon('cog fw') %li diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index 687c1fc3dd2..a77d39acb8c 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -1,14 +1,14 @@ %ul.nav.nav-sidebar - = nav_link(path: ['dashboard#show', 'root#show'], html_options: {class: 'home'}) do - = link_to dashboard_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do + = nav_link(path: ['dashboard#show', 'root#show', 'projects#starred'], html_options: {class: 'home'}) do + = link_to root_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do = icon('dashboard fw') %span - Your Projects - = nav_link(path: 'projects#starred') do - = link_to starred_dashboard_projects_path, title: 'Starred Projects', data: {placement: 'right'} do - = icon('star fw') - %span - Starred Projects + Projects + -#= nav_link(path: 'projects#starred') do + -#= link_to starred_dashboard_projects_path, title: 'Starred Projects', data: {placement: 'right'} do + -#= icon('star fw') + -#%span + -#Starred Projects = nav_link(controller: :groups) do = link_to dashboard_groups_path, title: 'Groups', data: {placement: 'right'} do = icon('group fw') @@ -31,6 +31,16 @@ %span Merge Requests %span.count= current_user.assigned_merge_requests.opened.count + = nav_link(controller: :snippets) do + = link_to user_snippets_path(current_user), title: 'Your snippets', data: {placement: 'right'} do + = icon('dashboard fw') + %span + Snippets + = nav_link(controller: :profile) do + = link_to profile_path, title: 'Profile settings', data: {toggle: 'tooltip', placement: 'bottom'} do + = icon('user fw') + %span + Profile = nav_link(controller: :help) do = link_to help_path, title: 'Help', data: {placement: 'right'} do = icon('question-circle fw') diff --git a/app/views/snippets/_head.html.haml b/app/views/snippets/_head.html.haml new file mode 100644 index 00000000000..0adf6b91f2c --- /dev/null +++ b/app/views/snippets/_head.html.haml @@ -0,0 +1,7 @@ +%ul.center-top-menu + = nav_link(page: user_snippets_path(current_user), html_options: {class: 'home'}) do + = link_to user_snippets_path(current_user), title: 'Your snippets', data: {placement: 'right'} do + Your Snippets + = nav_link(page: snippets_path) do + = link_to snippets_path, title: 'Explore snippets', data: {placement: 'right'} do + Explore Snippets diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml index 0718f743828..a10069478f3 100644 --- a/app/views/snippets/current_user_index.html.haml +++ b/app/views/snippets/current_user_index.html.haml @@ -1,4 +1,5 @@ - page_title "Your Snippets" += render 'head' %h3.page-title Your Snippets .pull-right diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index e9bb6a908d3..dc45cfacd84 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -1,4 +1,5 @@ - page_title "Public Snippets" += render 'head' %h3.page-title Public snippets @@ -6,8 +7,6 @@ - if current_user = link_to new_snippet_path, class: "btn btn-new btn-grouped", title: "New Snippet" do Add new snippet - = link_to user_snippets_path(current_user), class: "btn btn-grouped" do - Your snippets %p.light Public snippets created by you and other users are listed here |