Commit 8cadeb67502d9f674dc69c0b05341269c2baeb8f

Authored by Dmitriy Zaporozhets
1 parent 19ab03f4

nav views refactoring

app/assets/stylesheets/sections/nav.scss
1   -/*
2   - * Main Menu of Application
3   - *
4   - */
5   -ul.main_menu {
6   - margin: auto;
  1 +.main-nav {
7 2 margin: 30px 0;
8 3 margin-top: 10px;
9   - height: 38px;
10   - position: relative;
11   - overflow: hidden;
12   - .count {
  4 + border-bottom: 1px solid #E1E1E1;
  5 +
  6 + ul {
  7 + margin: auto;
  8 + height: 39px;
13 9 position: relative;
14   - top: -1px;
15   - display: inline-block;
16   - height: 15px;
17   - margin: 0 0 0 5px;
18   - padding: 0 8px 1px 8px;
19   - height: auto;
20   - font-size: 0.82em;
21   - line-height: 14px;
22   - text-align: center;
23   - color: #777;
24   - }
25   - .label {
26   - background: $hover;
27   - text-shadow: none;
28   - color: $style_color;
29   - }
30   - li {
31   - list-style-type: none;
32   - margin: 0;
33   - display: table-cell;
34   - width: 1%;
35   - border-bottom: 2px solid #EEE;
36   - &.active {
37   - border-bottom: 2px solid #474D57;
38   - a {
39   - color: $style_color;
40   - }
  10 + top: 3px;
  11 + overflow: hidden;
  12 + .count {
  13 + position: relative;
  14 + top: -1px;
  15 + display: inline-block;
  16 + height: 15px;
  17 + margin: 0 0 0 5px;
  18 + padding: 0 8px 1px 8px;
  19 + height: auto;
  20 + font-size: 0.82em;
  21 + line-height: 14px;
  22 + text-align: center;
  23 + color: #777;
  24 + }
  25 + .label {
  26 + background: $hover;
  27 + text-shadow: none;
  28 + color: $style_color;
41 29 }
  30 + li {
  31 + list-style-type: none;
  32 + margin: 0;
  33 + display: table-cell;
  34 + width: 1%;
  35 + &.active {
  36 + border-bottom: 3px solid #777;
  37 + a {
  38 + color: $style_color;
  39 + font-weight: bolder;
  40 + }
  41 + }
42 42  
43   - &.home {
44   - a {
45   - i {
46   - font-size: 20px;
47   - position: relative;
48   - top: 4px;
  43 + &.home {
  44 + a {
  45 + i {
  46 + font-size: 20px;
  47 + position: relative;
  48 + top: 4px;
  49 + }
49 50 }
50 51 }
51 52 }
52   - }
53   - a {
54   - display: block;
55   - text-align: center;
56   - font-weight: normal;
57   - height: 36px;
58   - line-height: 36px;
59   - color: #777;
60   - text-shadow: 0 1px 1px white;
61   - padding: 0 10px;
  53 + a {
  54 + display: block;
  55 + text-align: center;
  56 + font-weight: normal;
  57 + height: 36px;
  58 + line-height: 34px;
  59 + color: #777;
  60 + text-shadow: 0 1px 1px white;
  61 + padding: 0 10px;
  62 + }
62 63 }
63 64 }
64   -/*
65   - * End of Main Menu
66   - *
67   - */
68   -
... ...
app/views/layouts/admin.html.haml
... ... @@ -4,24 +4,8 @@
4 4 %body{class: "#{app_theme} admin"}
5 5 = render "layouts/head_panel", title: "Admin area"
6 6 = render "layouts/flash"
7   - .container
8   - %ul.main_menu
9   - = nav_link(controller: :dashboard, html_options: {class: 'home'}) do
10   - = link_to admin_root_path, title: "Stats" do
11   - %i.icon-home
12   - = nav_link(controller: :projects) do
13   - = link_to "Projects", admin_projects_path
14   - = nav_link(controller: :teams) do
15   - = link_to "Teams", admin_teams_path
16   - = nav_link(controller: :groups) do
17   - = link_to "Groups", admin_groups_path
18   - = nav_link(controller: :users) do
19   - = link_to "Users", admin_users_path
20   - = nav_link(controller: :logs) do
21   - = link_to "Logs", admin_logs_path
22   - = nav_link(controller: :hooks) do
23   - = link_to "Hooks", admin_hooks_path
24   - = nav_link(controller: :resque) do
25   - = link_to "Background Jobs", admin_resque_path
  7 + %nav.main-nav
  8 + .container= render 'layouts/nav/admin'
26 9  
  10 + .container
27 11 .content= yield
... ...
app/views/layouts/application.html.haml
... ... @@ -4,25 +4,8 @@
4 4 %body{class: "#{app_theme} application"}
5 5 = render "layouts/head_panel", title: "Dashboard"
6 6 = render "layouts/flash"
7   - .container
8   - %ul.main_menu
9   - = nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do
10   - = link_to root_path, title: "Home" do
11   - %i.icon-home
12   - = nav_link(path: 'dashboard#projects') do
13   - = link_to projects_dashboard_path do
14   - Projects
15   - = nav_link(path: 'dashboard#issues') do
16   - = link_to issues_dashboard_path do
17   - Issues
18   - %span.count= current_user.assigned_issues.opened.count
19   - = nav_link(path: 'dashboard#merge_requests') do
20   - = link_to merge_requests_dashboard_path do
21   - Merge Requests
22   - %span.count= current_user.cared_merge_requests.opened.count
23   - = nav_link(path: 'search#show') do
24   - = link_to "Search", search_path
25   - = nav_link(controller: :help) do
26   - = link_to "Help", help_path
  7 + %nav.main-nav
  8 + .container= render 'layouts/nav/dashboard'
27 9  
  10 + .container
28 11 .content= yield
... ...
app/views/layouts/group.html.haml
... ... @@ -4,25 +4,8 @@
4 4 %body{class: "#{app_theme} application"}
5 5 = render "layouts/head_panel", title: "group: #{@group.name}"
6 6 = render "layouts/flash"
7   - .container
8   - %ul.main_menu
9   - = nav_link(path: 'groups#show', html_options: {class: 'home'}) do
10   - = link_to group_path(@group), title: "Home" do
11   - %i.icon-home
12   - = nav_link(path: 'groups#issues') do
13   - = link_to issues_group_path(@group) do
14   - Issues
15   - %span.count= current_user.assigned_issues.opened.of_group(@group).count
16   - = nav_link(path: 'groups#merge_requests') do
17   - = link_to merge_requests_group_path(@group) do
18   - Merge Requests
19   - %span.count= current_user.cared_merge_requests.opened.of_group(@group).count
20   - = nav_link(path: 'groups#people') do
21   - = link_to "People", people_group_path(@group)
22   -
23   - - if can?(current_user, :manage_group, @group)
24   - = nav_link(path: 'groups#edit') do
25   - = link_to edit_group_path(@group), class: "tab " do
26   - Settings
  7 + %nav.main-nav
  8 + .container= render 'layouts/nav/group'
27 9  
  10 + .container
28 11 .content= yield
... ...
app/views/layouts/nav/_admin.html.haml 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +%ul
  2 + = nav_link(controller: :dashboard, html_options: {class: 'home'}) do
  3 + = link_to admin_root_path, title: "Stats" do
  4 + %i.icon-home
  5 + = nav_link(controller: :projects) do
  6 + = link_to "Projects", admin_projects_path
  7 + = nav_link(controller: :teams) do
  8 + = link_to "Teams", admin_teams_path
  9 + = nav_link(controller: :groups) do
  10 + = link_to "Groups", admin_groups_path
  11 + = nav_link(controller: :users) do
  12 + = link_to "Users", admin_users_path
  13 + = nav_link(controller: :logs) do
  14 + = link_to "Logs", admin_logs_path
  15 + = nav_link(controller: :hooks) do
  16 + = link_to "Hooks", admin_hooks_path
  17 + = nav_link(controller: :resque) do
  18 + = link_to "Background Jobs", admin_resque_path
  19 +
... ...
app/views/layouts/nav/_dashboard.html.haml 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +%ul
  2 + = nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do
  3 + = link_to root_path, title: "Home" do
  4 + %i.icon-home
  5 + = nav_link(path: 'dashboard#projects') do
  6 + = link_to projects_dashboard_path do
  7 + Projects
  8 + = nav_link(path: 'dashboard#issues') do
  9 + = link_to issues_dashboard_path do
  10 + Issues
  11 + %span.count= current_user.assigned_issues.opened.count
  12 + = nav_link(path: 'dashboard#merge_requests') do
  13 + = link_to merge_requests_dashboard_path do
  14 + Merge Requests
  15 + %span.count= current_user.cared_merge_requests.opened.count
  16 + = nav_link(path: 'search#show') do
  17 + = link_to "Search", search_path
  18 + = nav_link(controller: :help) do
  19 + = link_to "Help", help_path
  20 +
... ...
app/views/layouts/nav/_group.html.haml 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +%ul
  2 + = nav_link(path: 'groups#show', html_options: {class: 'home'}) do
  3 + = link_to group_path(@group), title: "Home" do
  4 + %i.icon-home
  5 + = nav_link(path: 'groups#issues') do
  6 + = link_to issues_group_path(@group) do
  7 + Issues
  8 + %span.count= current_user.assigned_issues.opened.of_group(@group).count
  9 + = nav_link(path: 'groups#merge_requests') do
  10 + = link_to merge_requests_group_path(@group) do
  11 + Merge Requests
  12 + %span.count= current_user.cared_merge_requests.opened.of_group(@group).count
  13 + = nav_link(path: 'groups#people') do
  14 + = link_to "People", people_group_path(@group)
  15 +
  16 + - if can?(current_user, :manage_group, @group)
  17 + = nav_link(path: 'groups#edit') do
  18 + = link_to edit_group_path(@group), class: "tab " do
  19 + Settings
  20 +
... ...
app/views/layouts/nav/_profile.html.haml 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +%ul
  2 + = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
  3 + = link_to profile_path, title: "Profile" do
  4 + %i.icon-home
  5 + = nav_link(path: 'profiles#account') do
  6 + = link_to "Account", account_profile_path
  7 + = nav_link(controller: :notifications) do
  8 + = link_to "Notifications", profile_notifications_path
  9 + = nav_link(controller: :keys) do
  10 + = link_to keys_path do
  11 + SSH Keys
  12 + %span.count= current_user.keys.count
  13 + = nav_link(path: 'profiles#design') do
  14 + = link_to "Design", design_profile_path
  15 + = nav_link(path: 'profiles#history') do
  16 + = link_to "History", history_profile_path
  17 +
... ...
app/views/layouts/nav/_project.html.haml 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +%ul
  2 + = nav_link(path: 'projects#show', html_options: {class: "home"}) do
  3 + = link_to project_path(@project), title: "Project" do
  4 + %i.icon-home
  5 +
  6 + - unless @project.empty_repo?
  7 + - if can? current_user, :download_code, @project
  8 + = nav_link(controller: %w(tree blob blame)) do
  9 + = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref)
  10 + = nav_link(controller: %w(commit commits compare repositories protected_branches)) do
  11 + = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref)
  12 + = nav_link(controller: %w(graph)) do
  13 + = link_to "Network", project_graph_path(@project, @ref || @repository.root_ref)
  14 +
  15 + - if @project.issues_enabled
  16 + = nav_link(controller: %w(issues milestones labels)) do
  17 + = link_to url_for_project_issues do
  18 + Issues
  19 + - if @project.used_default_issues_tracker?
  20 + %span.count.issue_counter= @project.issues.opened.count
  21 +
  22 + - if @project.repo_exists? && @project.merge_requests_enabled
  23 + = nav_link(controller: :merge_requests) do
  24 + = link_to project_merge_requests_path(@project) do
  25 + Merge Requests
  26 + %span.count.merge_counter= @project.merge_requests.opened.count
  27 +
  28 + - if @project.wiki_enabled
  29 + = nav_link(controller: :wikis) do
  30 + = link_to 'Wiki', project_wiki_path(@project, :home)
  31 +
  32 + - if @project.wall_enabled
  33 + = nav_link(controller: :walls) do
  34 + = link_to 'Wall', project_wall_path(@project)
  35 +
  36 + - if @project.snippets_enabled
  37 + = nav_link(controller: :snippets) do
  38 + = link_to 'Snippets', project_snippets_path(@project)
  39 +
  40 + - if can? current_user, :admin_project, @project
  41 + = nav_link(html_options: {class: "#{project_tab_class}"}) do
  42 + = link_to edit_project_path(@project), class: "stat-tab tab " do
  43 + Settings
... ...
app/views/layouts/nav/_team.html.haml 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +%ul
  2 + = nav_link(path: 'teams#show', html_options: {class: 'home'}) do
  3 + = link_to team_path(@team), title: "Home" do
  4 + %i.icon-home
  5 +
  6 + = nav_link(path: 'teams#issues') do
  7 + = link_to issues_team_path(@team) do
  8 + Issues
  9 + %span.count= Issue.opened.of_user_team(@team).count
  10 +
  11 + = nav_link(path: 'teams#merge_requests') do
  12 + = link_to merge_requests_team_path(@team) do
  13 + Merge Requests
  14 + %span.count= MergeRequest.opened.of_user_team(@team).count
  15 +
  16 + = nav_link(controller: [:members]) do
  17 + = link_to team_members_path(@team), class: "team-tab tab" do
  18 + Members
  19 + %span.count= @team.members.count
  20 +
  21 + - if can? current_user, :admin_user_team, @team
  22 + = nav_link(path: 'teams#edit') do
  23 + = link_to edit_team_path(@team), class: "stat-tab tab " do
  24 + Settings
  25 +
... ...
app/views/layouts/profile.html.haml
... ... @@ -4,22 +4,8 @@
4 4 %body{class: "#{app_theme} profile"}
5 5 = render "layouts/head_panel", title: "Profile"
6 6 = render "layouts/flash"
7   - .container
8   - %ul.main_menu
9   - = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
10   - = link_to profile_path, title: "Profile" do
11   - %i.icon-home
12   - = nav_link(path: 'profiles#account') do
13   - = link_to "Account", account_profile_path
14   - = nav_link(controller: :notifications) do
15   - = link_to "Notifications", profile_notifications_path
16   - = nav_link(controller: :keys) do
17   - = link_to keys_path do
18   - SSH Keys
19   - %span.count= current_user.keys.count
20   - = nav_link(path: 'profiles#design') do
21   - = link_to "Design", design_profile_path
22   - = nav_link(path: 'profiles#history') do
23   - = link_to "History", history_profile_path
  7 + %nav.main-nav
  8 + .container= render 'layouts/nav/profile'
24 9  
  10 + .container
25 11 .content= yield
... ...
app/views/layouts/project_resource.html.haml
... ... @@ -7,49 +7,8 @@
7 7 - if can?(current_user, :download_code, @project)
8 8 = render 'shared/no_ssh'
9 9  
10   - .container
11   - %ul.main_menu
12   - = nav_link(path: 'projects#show', html_options: {class: "home"}) do
13   - = link_to project_path(@project), title: "Project" do
14   - %i.icon-home
15   -
16   - - unless @project.empty_repo?
17   - - if can? current_user, :download_code, @project
18   - = nav_link(controller: %w(tree blob blame)) do
19   - = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref)
20   - = nav_link(controller: %w(commit commits compare repositories protected_branches)) do
21   - = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref)
22   - = nav_link(controller: %w(graph)) do
23   - = link_to "Network", project_graph_path(@project, @ref || @repository.root_ref)
24   -
25   - - if @project.issues_enabled
26   - = nav_link(controller: %w(issues milestones labels)) do
27   - = link_to url_for_project_issues do
28   - Issues
29   - - if @project.used_default_issues_tracker?
30   - %span.count.issue_counter= @project.issues.opened.count
31   -
32   - - if @project.repo_exists? && @project.merge_requests_enabled
33   - = nav_link(controller: :merge_requests) do
34   - = link_to project_merge_requests_path(@project) do
35   - Merge Requests
36   - %span.count.merge_counter= @project.merge_requests.opened.count
37   -
38   - - if @project.wiki_enabled
39   - = nav_link(controller: :wikis) do
40   - = link_to 'Wiki', project_wiki_path(@project, :home)
41   -
42   - - if @project.wall_enabled
43   - = nav_link(controller: :walls) do
44   - = link_to 'Wall', project_wall_path(@project)
45   -
46   - - if @project.snippets_enabled
47   - = nav_link(controller: :snippets) do
48   - = link_to 'Snippets', project_snippets_path(@project)
49   -
50   - - if can? current_user, :admin_project, @project
51   - = nav_link(html_options: {class: "#{project_tab_class}"}) do
52   - = link_to edit_project_path(@project), class: "stat-tab tab " do
53   - Settings
  10 + %nav.main-nav
  11 + .container= render 'layouts/nav/project'
54 12  
  13 + .container
55 14 .content= yield
... ...
app/views/layouts/user_team.html.haml
... ... @@ -4,30 +4,8 @@
4 4 %body{class: "#{app_theme} application"}
5 5 = render "layouts/head_panel", title: "team: #{@team.name}"
6 6 = render "layouts/flash"
7   - .container
8   - %ul.main_menu
9   - = nav_link(path: 'teams#show', html_options: {class: 'home'}) do
10   - = link_to team_path(@team), title: "Home" do
11   - %i.icon-home
12   -
13   - = nav_link(path: 'teams#issues') do
14   - = link_to issues_team_path(@team) do
15   - Issues
16   - %span.count= Issue.opened.of_user_team(@team).count
17   -
18   - = nav_link(path: 'teams#merge_requests') do
19   - = link_to merge_requests_team_path(@team) do
20   - Merge Requests
21   - %span.count= MergeRequest.opened.of_user_team(@team).count
22   -
23   - = nav_link(controller: [:members]) do
24   - = link_to team_members_path(@team), class: "team-tab tab" do
25   - Members
26   - %span.count= @team.members.count
27   -
28   - - if can? current_user, :admin_user_team, @team
29   - = nav_link(path: 'teams#edit') do
30   - = link_to edit_team_path(@team), class: "stat-tab tab " do
31   - Settings
  7 + %nav.main-nav
  8 + .container= render 'layouts/nav/team'
32 9  
  10 + .container
33 11 .content= yield
... ...