Commit 1555146adf7e23085f04eda76f3c7f213a2e774c
Exists in
spb-stable
and in
2 other branches
Merge branch 'responsive-sidebar' into 'master'
Responsive sidebar Puts the sidebar on the dashboard in a off-screen sidebar that can be called by pressing a button with a fixed position. Any sidebar with the .responsive-sidebar class will follow this behavior. Button must be added manually.
Showing
16 changed files
with
119 additions
and
10 deletions
Show diff stats
Gemfile
Gemfile.lock
... | ... | @@ -452,6 +452,8 @@ GEM |
452 | 452 | activesupport (>= 3.1, < 4.2) |
453 | 453 | select2-rails (3.5.2) |
454 | 454 | thor (~> 0.14) |
455 | + semantic-ui-sass (0.16.1.0) | |
456 | + sass (~> 3.2) | |
455 | 457 | settingslogic (2.0.9) |
456 | 458 | sexp_processor (4.4.0) |
457 | 459 | shoulda-matchers (2.1.0) |
... | ... | @@ -656,6 +658,7 @@ DEPENDENCIES |
656 | 658 | sdoc |
657 | 659 | seed-fu |
658 | 660 | select2-rails |
661 | + semantic-ui-sass (~> 0.16.1.0) | |
659 | 662 | settingslogic |
660 | 663 | shoulda-matchers (~> 2.1.0) |
661 | 664 | sidekiq (= 2.17.0) | ... | ... |
app/assets/javascripts/application.js.coffee
... | ... | @@ -0,0 +1,31 @@ |
1 | +responsive_resize = -> | |
2 | + current_width = $(window).width() | |
3 | + if current_width < 985 | |
4 | + $('.responsive-side').addClass("ui right wide sidebar") | |
5 | + $('.responsive-side-left').addClass("ui left sidebar") | |
6 | + else | |
7 | + $('.responsive-side').removeClass("ui right wide sidebar") | |
8 | + $('.responsive-side-left').removeClass("ui left sidebar") | |
9 | + | |
10 | +$ -> | |
11 | + # Depending on window size, set the sidebar offscreen. | |
12 | + responsive_resize() | |
13 | + | |
14 | + $('.ui.sidebar') | |
15 | + .sidebar() | |
16 | + | |
17 | + $('.sidebar-expand-button').click -> | |
18 | + $('.ui.sidebar') | |
19 | + .sidebar({overlay: true}) | |
20 | + .sidebar('toggle') | |
21 | + | |
22 | + # Hide sidebar on click outside of sidebar | |
23 | + $(document).mouseup (e) -> | |
24 | + container = $(".ui.sidebar") | |
25 | + container.sidebar "hide" if not container.is(e.target) and container.has(e.target).length is 0 | |
26 | + return | |
27 | + | |
28 | +# On resize, check if sidebar should be offscreen. | |
29 | +$(window).resize -> | |
30 | + responsive_resize() | |
31 | + return | ... | ... |
app/assets/stylesheets/application.scss
... | ... | @@ -0,0 +1,49 @@ |
1 | +.ui.sidebar { | |
2 | + z-index: 1000 !important; | |
3 | + background: #fff; | |
4 | + padding: 10px; | |
5 | + width: 285px; | |
6 | +} | |
7 | + | |
8 | +.ui.left.sidebar { | |
9 | + border-right: 1px solid #e1e1e1; | |
10 | + border-left: 0; | |
11 | +} | |
12 | + | |
13 | +.ui.right.sidebar { | |
14 | + border-left: 1px solid #e1e1e1; | |
15 | + border-right: 0; | |
16 | +} | |
17 | + | |
18 | +.sidebar-expand-button { | |
19 | + background: #f9f9f9; | |
20 | + color: #555; | |
21 | + padding: 9px 12px 6px 14px; | |
22 | + border: 1px solid #E1E1E1; | |
23 | + border-right: 0; | |
24 | + position: fixed; | |
25 | + top: 108px; | |
26 | + right: 0px; | |
27 | + margin-right: 0; | |
28 | + cursor: pointer; | |
29 | + transition: all 0.4s; | |
30 | + -moz-transition: all 0.4s; | |
31 | + -webkit-transition: all 0.4s; | |
32 | + | |
33 | + &:hover { | |
34 | + background: #ddd; | |
35 | + color: #333; | |
36 | + padding-right: 25px; | |
37 | + } | |
38 | +} | |
39 | + | |
40 | +.left.sidebar-expand-button { | |
41 | + left: 0px; | |
42 | + right: auto; | |
43 | + border: 1px solid #E1E1E1; | |
44 | + border-left: 0; | |
45 | + &:hover { | |
46 | + padding-right: 14px; | |
47 | + padding-left: 25px; | |
48 | + } | |
49 | +} | ... | ... |
app/views/dashboard/issues.html.haml
app/views/dashboard/merge_requests.html.haml
... | ... | @@ -7,7 +7,9 @@ |
7 | 7 | List all merge requests from all projects you have access to. |
8 | 8 | %hr |
9 | 9 | .row |
10 | - .col-md-3 | |
10 | + .left.sidebar-expand-button.hidden-lg.hidden-md | |
11 | + %i.icon-list.icon-2x | |
12 | + .col-md-3.responsive-side-left | |
11 | 13 | = render 'shared/filter', entity: 'merge_request' |
12 | 14 | .col-md-9 |
13 | 15 | = render 'shared/merge_requests' | ... | ... |
app/views/dashboard/show.html.haml
... | ... | @@ -2,8 +2,11 @@ |
2 | 2 | .dashboard.row |
3 | 3 | .activities.col-md-8 |
4 | 4 | = render 'activities' |
5 | - .side.col-md-4.hidden-sm.hidden-xs | |
5 | + .side.col-md-4.left.responsive-side | |
6 | 6 | = render 'sidebar' |
7 | 7 | |
8 | + .sidebar-expand-button.hidden-lg.hidden-md | |
9 | + %i.icon-list.icon-2x | |
10 | + | |
8 | 11 | - else |
9 | 12 | = render "zero_authorized_projects" | ... | ... |
app/views/groups/issues.html.haml
app/views/groups/merge_requests.html.haml
... | ... | @@ -10,7 +10,9 @@ |
10 | 10 | To see all merge requests you should visit #{link_to 'dashboard', merge_requests_dashboard_path} page. |
11 | 11 | %hr |
12 | 12 | .row |
13 | - .col-md-3 | |
13 | + .left.sidebar-expand-button.hidden-lg.hidden-md | |
14 | + %i.icon-list.icon-2x | |
15 | + .col-md-3.responsive-side-left | |
14 | 16 | = render 'shared/filter', entity: 'merge_request' |
15 | 17 | .col-md-9 |
16 | 18 | = render 'shared/merge_requests' | ... | ... |
app/views/projects/issues/index.html.haml
1 | 1 | = render "head" |
2 | 2 | .row |
3 | - .col-md-3 | |
3 | + .left.sidebar-expand-button.hidden-lg.hidden-md | |
4 | + %i.icon-list.icon-2x | |
5 | + .col-md-3.responsive-side-left | |
4 | 6 | = render 'shared/project_filter', project_entities_path: project_issues_path(@project), |
5 | 7 | labels: true, redirect: 'issues' |
6 | 8 | .col-md-9.issues-holder | ... | ... |
app/views/projects/merge_requests/index.html.haml
... | ... | @@ -7,7 +7,9 @@ |
7 | 7 | %span (#{@merge_requests.total_count}) |
8 | 8 | %hr |
9 | 9 | .row |
10 | - .col-md-3 | |
10 | + .left.sidebar-expand-button.hidden-lg.hidden-md | |
11 | + %i.icon-list.icon-2x | |
12 | + .col-md-3.responsive-side-left | |
11 | 13 | = render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project), |
12 | 14 | labels: true, redirect: 'merge_requests' |
13 | 15 | .col-md-9 | ... | ... |
app/views/projects/milestones/index.html.haml
... | ... | @@ -8,7 +8,9 @@ |
8 | 8 | New Milestone |
9 | 9 | |
10 | 10 | .row |
11 | - .col-md-3.hidden-sm | |
11 | + .left.sidebar-expand-button.hidden-lg.hidden-md | |
12 | + %i.icon-list.icon-2x | |
13 | + .col-md-3.responsive-side-left | |
12 | 14 | %ul.nav.nav-pills.nav-stacked |
13 | 15 | %li{class: ("active" if (params[:f] == "active" || !params[:f]))} |
14 | 16 | = link_to project_milestones_path(@project, f: "active") do | ... | ... |
app/views/shared/_filter.html.haml
app/views/shared/_project_filter.html.haml