Commit 8812d9dee2340ba33d1272ed6ea0736c8eb371d0
1 parent
96c627ed
Exists in
master
and in
4 other branches
Move groups and teams to tabs on dashboard. Remember tab with cookie
Showing
5 changed files
with
44 additions
and
10 deletions
Show diff stats
app/assets/javascripts/dashboard.js.coffee
1 | window.dashboardPage = -> | 1 | window.dashboardPage = -> |
2 | Pager.init 20, true | 2 | Pager.init 20, true |
3 | + initSidebarTab() | ||
3 | $(".event_filter_link").bind "click", (event) -> | 4 | $(".event_filter_link").bind "click", (event) -> |
4 | event.preventDefault() | 5 | event.preventDefault() |
5 | toggleFilter $(this) | 6 | toggleFilter $(this) |
@@ -25,3 +26,14 @@ toggleFilter = (sender) -> | @@ -25,3 +26,14 @@ toggleFilter = (sender) -> | ||
25 | event_filters.splice index, 1 | 26 | event_filters.splice index, 1 |
26 | 27 | ||
27 | $.cookie "event_filter", event_filters.join(",") | 28 | $.cookie "event_filter", event_filters.join(",") |
29 | + | ||
30 | +initSidebarTab = -> | ||
31 | + key = "dashboard_sidebar_filter" | ||
32 | + | ||
33 | + # store selection in cookie | ||
34 | + $('.dash-sidebar-tabs a').on 'click', (e) -> | ||
35 | + $.cookie(key, $(e.target).attr('id')) | ||
36 | + | ||
37 | + # show tab from cookie | ||
38 | + sidebar_filter = $.cookie(key) | ||
39 | + $("#" + sidebar_filter).tab('show') if sidebar_filter |
app/assets/stylesheets/sections/projects.scss
app/views/dashboard/_groups.html.haml
app/views/dashboard/_sidebar.html.haml
1 | -- if @teams.present? | ||
2 | - = render "teams", teams: @teams | ||
3 | -- if @groups.present? | ||
4 | - = render "groups", groups: @groups | ||
5 | -= render "projects", projects: @projects | ||
6 | -%div | 1 | +%ul.nav.nav-tabs.dash-sidebar-tabs |
2 | + %li.active | ||
3 | + = link_to 'Projects', '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' | ||
4 | + %li | ||
5 | + = link_to 'Groups', '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' | ||
6 | + %li | ||
7 | + = link_to 'Teams', '#teams', 'data-toggle' => 'tab', id: 'sidebar-teams-tab' | ||
8 | + | ||
9 | +.tab-content | ||
10 | + .tab-pane.active#projects | ||
11 | + = render "projects", projects: @projects | ||
12 | + .tab-pane#groups | ||
13 | + = render "groups", groups: @groups | ||
14 | + .tab-pane#teams | ||
15 | + = render "teams", teams: @teams | ||
16 | + | ||
17 | +.prepend-top-20 | ||
7 | %span.rss-icon | 18 | %span.rss-icon |
8 | = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do | 19 | = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do |
9 | - = image_tag "rss_ui.png", title: "feed" | ||
10 | - %strong News Feed | 20 | + %strong |
21 | + %i.icon-rss | ||
22 | + News Feed | ||
11 | 23 | ||
12 | %hr | 24 | %hr |
13 | .gitlab-promo | 25 | .gitlab-promo |
app/views/dashboard/_teams.html.haml
@@ -2,13 +2,13 @@ | @@ -2,13 +2,13 @@ | ||
2 | %h5.title | 2 | %h5.title |
3 | Teams | 3 | Teams |
4 | %small | 4 | %small |
5 | - (#{@teams.count}) | 5 | + (#{teams.count}) |
6 | %span.pull-right | 6 | %span.pull-right |
7 | = link_to new_team_path, class: "btn btn-tiny info" do | 7 | = link_to new_team_path, class: "btn btn-tiny info" do |
8 | %i.icon-plus | 8 | %i.icon-plus |
9 | New Team | 9 | New Team |
10 | %ul.well-list | 10 | %ul.well-list |
11 | - - @teams.each do |team| | 11 | + - teams.each do |team| |
12 | %li | 12 | %li |
13 | = link_to team_path(id: team.path), class: dom_class(team) do | 13 | = link_to team_path(id: team.path), class: dom_class(team) do |
14 | %strong.well-title= truncate(team.name, length: 35) | 14 | %strong.well-title= truncate(team.name, length: 35) |
@@ -18,3 +18,6 @@ | @@ -18,3 +18,6 @@ | ||
18 | - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id) | 18 | - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id) |
19 | - if tm | 19 | - if tm |
20 | = tm.access_human | 20 | = tm.access_human |
21 | + - if teams.blank? | ||
22 | + %li | ||
23 | + %h3.nothing_here_message You have no teams yet. |