Commit 8b6dd9d4a802eeba5fa4f7e10d738a2af5e87d98
1 parent
a5cbb4cb
Exists in
spb-stable
and in
2 other branches
responsive sidebar
Showing
7 changed files
with
74 additions
and
1 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,27 @@ |
1 | +responsive_resize = -> | |
2 | + current_width = $(window).width() | |
3 | + if current_width < 985 | |
4 | + $('.side').addClass("ui right wide sidebar") | |
5 | + else | |
6 | + $('.side').removeClass("ui right wide sidebar") | |
7 | + | |
8 | +$ -> | |
9 | + responsive_resize() | |
10 | + | |
11 | + $('.ui.sidebar') | |
12 | + .sidebar() | |
13 | + | |
14 | + $('.sidebar-expand-button').click -> | |
15 | + $('.ui.sidebar') | |
16 | + .sidebar({overlay: true}) | |
17 | + .sidebar('toggle') | |
18 | + | |
19 | + # Hide sidebar on click outside of sidebar | |
20 | + $(document).mouseup (e) -> | |
21 | + container = $(".ui.sidebar") | |
22 | + container.sidebar "hide" if not container.is(e.target) and container.has(e.target).length is 0 | |
23 | + return | |
24 | + | |
25 | +$(window).resize -> | |
26 | + responsive_resize() | |
27 | + return | ... | ... |
app/assets/stylesheets/application.scss
... | ... | @@ -0,0 +1,31 @@ |
1 | +.ui.sidebar { | |
2 | + z-index: 1000 !important; | |
3 | + background: #fff; | |
4 | + padding: 10px; | |
5 | + border-left: 1px solid #e1e1e1; | |
6 | + width: 285px; | |
7 | +} | |
8 | + | |
9 | +.sidebar-expand-button { | |
10 | + background: #fff; | |
11 | + color: #555; | |
12 | + padding: 10px 15px; | |
13 | + border: 1px solid #E1E1E1; | |
14 | + border-right: 0; | |
15 | + border-radius: 3px; | |
16 | + position: fixed; | |
17 | + top: 108px; | |
18 | + right: 0px; | |
19 | + margin-right: 0; | |
20 | + cursor: pointer; | |
21 | + transition: all 0.4s; | |
22 | + -moz-transition: all 0.4s; | |
23 | + -webkit-transition: all 0.4s; | |
24 | + | |
25 | + | |
26 | + &:hover { | |
27 | + background: #ddd; | |
28 | + color: #333; | |
29 | + padding-right: 25px; | |
30 | + } | |
31 | +} | ... | ... |
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 | |
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" | ... | ... |