Refactored navigation

This commit is contained in:
Dmitriy Zaporozhets 2012-07-03 20:52:48 +03:00
parent 51f174b97f
commit 031ae7756e
9 changed files with 152 additions and 72 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View file

@ -74,7 +74,7 @@ header {
font-size:24px; font-size:24px;
line-height:36px; line-height:36px;
font-weight:500; font-weight:500;
color:#567; color:$style_color;
text-shadow: 0 1px 1px #FFF; text-shadow: 0 1px 1px #FFF;
} }
@ -82,7 +82,9 @@ header {
float: right; float: right;
margin-right:10px; margin-right:10px;
.btn { .btn {
margin-left:8px; margin-left:7px;
background: #F1F1F1;
border: 1px solid #CCC;
} }
} }
@ -97,7 +99,7 @@ header {
margin-right: 55px; margin-right: 55px;
.search-input { .search-input {
width:130px; @extend .span2;
background-image: url("icon-search.png"); background-image: url("icon-search.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 10px; background-position: 10px;

View file

@ -2,7 +2,7 @@
* Main Menu of Application * Main Menu of Application
* *
*/ */
nav.main_menu { ul.main_menu {
border-radius: 4px; border-radius: 4px;
margin: auto; margin: auto;
margin:30px 0; margin:30px 0;
@ -13,9 +13,7 @@ nav.main_menu {
background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf); background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf);
display:table; position:relative;
table-layout:fixed;
width:100%;
@include shade; @include shade;
.count { .count {
position: relative; position: relative;
@ -39,10 +37,14 @@ nav.main_menu {
text-shadow:none; text-shadow:none;
color:$style_color; color:$style_color;
} }
a { li {
list-style-type: none;
margin: 0;
display: table-cell; display: table-cell;
text-align:center; width: 1%;
font-weight:bold; border-right: 1px solid #DDD;
border-left: 1px solid #EEE;
&:first-child{ &:first-child{
-webkit-border-top-left-radius: 4px; -webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-left-radius: 4px;
@ -52,22 +54,7 @@ nav.main_menu {
border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;
border-left: 0; border-left: 0;
} }
padding: 9px 2px;
color: $style_color;
position: relative;
margin: 0;
text-shadow:0 1px 1px white;
border-right: 1px solid #DDD;
border-left: 1px solid #EEE;
&.home {
background: url(home_icon.PNG) no-repeat center center;
text-indent:-9999px;
img {
position:relative;
top:4px;
}
}
&.current { &.current {
background-color:#D5D5D5; background-color:#D5D5D5;
border-bottom: 1px solid #567; border-bottom: 1px solid #567;
@ -80,12 +67,29 @@ nav.main_menu {
} }
} }
&.wide { &.home {
width:185px; a {
@media (min-width: 1080px) and (max-width: 1200px) { width:160px; } background: url(home_icon.PNG) no-repeat center center;
text-indent:-9999px;
min-width:20px;
img {
position:relative;
top:4px;
} }
} }
} }
}
a {
display: block;
text-align: center;
font-weight:bold;
height:35px;
line-height:36px;
color: $style_color;
text-shadow:0 1px 1px white;
}
}
/* /*
* End of Main Menu * End of Main Menu
* *

View file

@ -9,19 +9,21 @@
* *
*/ */
.ui_modern { .ui_modern {
nav.main_menu { ul.main_menu {
background:none; background:none;
box-shadow:none; box-shadow:none;
@include border-radius(0px); @include border-radius(0px);
border:none; border:none;
border-bottom:2px solid #456; border-bottom:2px solid #456;
a { li {
border:none; border:none;
&.current { &.current {
border-bottom:2px solid #f90; border-bottom:2px solid #f90;
background-color:#fff; background-color:#fff;
position:relative;
top:1px;
} }
} }
} }

View file

@ -96,4 +96,41 @@ module ApplicationHelper
event.project && event.project &&
event.project.merge_requests_enabled event.project.merge_requests_enabled
end end
def tab_class(tab_key)
active = case tab_key
# Project Area
when :wall; wall_tab?
when :wiki; controller.controller_name == "wikis"
when :issues; issues_tab?
when :network; current_page?(:controller => "projects", :action => "graph", :id => @project)
when :merge_requests; controller.controller_name == "merge_requests"
# Dashboard Area
when :help; controller.controller_name == "help"
when :search; current_page?(search_path)
when :dash_issues; current_page?(dashboard_issues_path)
when :dash_mr; current_page?(dashboard_merge_requests_path)
when :root; current_page?(dashboard_path) || current_page?(root_path)
# Profile Area
when :profile; current_page?(:controller => "profile", :action => :show)
when :password; current_page?(:controller => "profile", :action => :password)
when :token; current_page?(:controller => "profile", :action => :token)
when :design; current_page?(:controller => "profile", :action => :design)
when :ssh_keys; controller.controller_name == "keys"
# Admin Area
when :admin_root; controller.controller_name == "dashboard"
when :admin_users; controller.controller_name == 'users'
when :admin_projects; controller.controller_name == "projects"
when :admin_emails; controller.controller_name == 'mailer'
when :admin_resque; controller.controller_name == 'resque'
else
false
end
active ? "current" : nil
end
end end

View file

@ -1,11 +1,19 @@
%nav.main_menu %ul.main_menu
= link_to "Home", root_path, :class => "home #{"current" if current_page?(dashboard_path) || current_page?(root_path)}", :title => "Home" %li.home{:class => tab_class(:root)}
= link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do = link_to "Home", root_path, :title => "Home"
%li{:class => tab_class(:dash_issues)}
= link_to dashboard_issues_path do
Issues Issues
%span.count= current_user.assigned_issues.opened.count %span.count= current_user.assigned_issues.opened.count
= link_to dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" do
Requests %li{:class => tab_class(:dash_mr)}
= link_to dashboard_merge_requests_path do
Merge Requests
%span.count= current_user.cared_merge_requests.count %span.count= current_user.cared_merge_requests.count
= link_to search_path, :class => "#{"current" if current_page?(search_path)}" do
Search %li{:class => tab_class(:search)}
= link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}" = link_to "Search", search_path
%li{:class => tab_class(:help)}
= link_to "Help", help_path

View file

@ -1,25 +1,36 @@
%nav.main_menu %ul.main_menu
= link_to @project.code, project_path(@project), :class => "home #{project_tab_class}", :title => "Project" %li.home{:class => project_tab_class}
= link_to @project.code, project_path(@project), :title => "Project"
- if @project.repo_exists? - if @project.repo_exists?
- if can? current_user, :download_code, @project - if can? current_user, :download_code, @project
= link_to tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class do %li{:class => tree_tab_class}
= link_to tree_project_ref_path(@project, @project.root_ref) do
Files Files
= link_to "Commits", project_commits_path(@project), :class => commit_tab_class %li{:class => commit_tab_class}
= link_to "Commits", project_commits_path(@project)
%li{:class => tab_class(:network)}
= link_to "Network", graph_project_path(@project)
= link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
- if @project.issues_enabled - if @project.issues_enabled
= link_to project_issues_filter_path(@project), :class => issues_tab? ? "current" : nil do %li{:class => tab_class(:issues)}
= link_to project_issues_filter_path(@project) do
Issues Issues
%span.count= @project.issues.opened.count %span.count= @project.issues.opened.count
- if @project.merge_requests_enabled - if @project.merge_requests_enabled
= link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current wide" : "wide" do %li{:class => tab_class(:merge_requests)}
= link_to project_merge_requests_path(@project) do
Merge Requests Merge Requests
%span.count= @project.merge_requests.opened.count %span.count= @project.merge_requests.opened.count
- if @project.wall_enabled - if @project.wall_enabled
= link_to wall_project_path(@project), :class => wall_tab? ? "current" : nil do %li{:class => tab_class(:wall)}
= link_to wall_project_path(@project) do
Wall Wall
- if @project.wiki_enabled - if @project.wiki_enabled
= link_to project_wiki_path(@project, :index), :class => (controller.controller_name == "wikis") ? "current" : nil do %li{:class => tab_class(:wiki)}
= link_to project_wiki_path(@project, :index) do
Wiki Wiki

View file

@ -5,11 +5,16 @@
= render "layouts/flash" = render "layouts/flash"
= render "layouts/head_panel", :title => "Admin area" = render "layouts/head_panel", :title => "Admin area"
.container .container
%nav.main_menu %ul.main_menu
= link_to "Stats", admin_root_path, :class => "home #{'current' if controller.controller_name == "dashboard"}" %li.home{:class => tab_class(:admin_root)}
= link_to "Projects", admin_projects_path, :class => ('current' if controller.controller_name == "projects") = link_to "Stats", admin_root_path
= link_to "Users", admin_users_path, :class => ('current' if controller.controller_name == 'users') %li{:class => tab_class(:admin_projects)}
= link_to "Emails", admin_emails_path, :class => ('current' if controller.controller_name == 'mailer') = link_to "Projects", admin_projects_path
= link_to "Resque", admin_resque_path, :class => ('current' if controller.controller_name == 'resque') %li{:class => tab_class(:admin_users)}
= link_to "Users", admin_users_path
%li{:class => tab_class(:admin_emails)}
= link_to "Emails", admin_emails_path
%li{:class => tab_class(:admin_resque)}
= link_to "Resque", admin_resque_path
.content= yield .content= yield

View file

@ -5,12 +5,23 @@
= render "layouts/flash" = render "layouts/flash"
= render "layouts/head_panel", :title => "Profile" = render "layouts/head_panel", :title => "Profile"
.container .container
%nav.main_menu %ul.main_menu
= link_to "Profile", profile_path, :class => "home #{current_page?(:controller => "profile", :action => :show) ? "current" : nil}" %li.home{:class => tab_class(:profile)}
= link_to "Password", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil = link_to "Profile", profile_path
= link_to "Token", profile_token_path, :class => current_page?(:controller => "profile", :action => :token) ? "current" : nil
= link_to "Design", profile_design_path, :class => current_page?(:controller => "profile", :action => :design) ? "current" : nil %li{:class => tab_class(:password)}
= link_to keys_path, :class => controller.controller_name == "keys" ? "current" : nil do = link_to "Password", profile_password_path
%li{:class => tab_class(:token)}
= link_to "Token", profile_token_path
%li{:class => tab_class(:design)}
= link_to "Design", profile_design_path
%li{:class => tab_class(:ssh_keys)}
= link_to keys_path do
SSH Keys SSH Keys
%span.count= current_user.keys.count
.content .content
= yield = yield