responsive sidebar

This commit is contained in:
Job van der Voort 2014-06-14 11:17:11 +02:00
parent a5cbb4cb82
commit 8b6dd9d4a8
7 changed files with 74 additions and 1 deletions

View file

@ -156,6 +156,9 @@ gem "rack-attack"
# Ace editor
gem 'ace-rails-ap'
# Semantic UI Sass for Sidebar
gem 'semantic-ui-sass', '~> 0.16.1.0'
gem "sass-rails", '~> 4.0.2'
gem "coffee-rails"
gem "uglifier"

View file

@ -452,6 +452,8 @@ GEM
activesupport (>= 3.1, < 4.2)
select2-rails (3.5.2)
thor (~> 0.14)
semantic-ui-sass (0.16.1.0)
sass (~> 3.2)
settingslogic (2.0.9)
sexp_processor (4.4.0)
shoulda-matchers (2.1.0)
@ -656,6 +658,7 @@ DEPENDENCIES
sdoc
seed-fu
select2-rails
semantic-ui-sass (~> 0.16.1.0)
settingslogic
shoulda-matchers (~> 2.1.0)
sidekiq (= 2.17.0)

View file

@ -30,6 +30,7 @@
#= require nprogress
#= require nprogress-turbolinks
#= require dropzone
#= require semantic-ui/sidebar
#= require_tree .
window.slugify = (text) ->

View file

@ -0,0 +1,27 @@
responsive_resize = ->
current_width = $(window).width()
if current_width < 985
$('.side').addClass("ui right wide sidebar")
else
$('.side').removeClass("ui right wide sidebar")
$ ->
responsive_resize()
$('.ui.sidebar')
.sidebar()
$('.sidebar-expand-button').click ->
$('.ui.sidebar')
.sidebar({overlay: true})
.sidebar('toggle')
# Hide sidebar on click outside of sidebar
$(document).mouseup (e) ->
container = $(".ui.sidebar")
container.sidebar "hide" if not container.is(e.target) and container.has(e.target).length is 0
return
$(window).resize ->
responsive_resize()
return

View file

@ -51,3 +51,8 @@
* Styles for JS behaviors.
*/
@import "behaviors.scss";
/**
* Styles for responsive sidebar
*/
@import "semantic-ui/modules/sidebar"

View file

@ -0,0 +1,31 @@
.ui.sidebar {
z-index: 1000 !important;
background: #fff;
padding: 10px;
border-left: 1px solid #e1e1e1;
width: 285px;
}
.sidebar-expand-button {
background: #fff;
color: #555;
padding: 10px 15px;
border: 1px solid #E1E1E1;
border-right: 0;
border-radius: 3px;
position: fixed;
top: 108px;
right: 0px;
margin-right: 0;
cursor: pointer;
transition: all 0.4s;
-moz-transition: all 0.4s;
-webkit-transition: all 0.4s;
&:hover {
background: #ddd;
color: #333;
padding-right: 25px;
}
}

View file

@ -2,8 +2,11 @@
.dashboard.row
.activities.col-md-8
= render 'activities'
.side.col-md-4.hidden-sm.hidden-xs
.side.col-md-4
= render 'sidebar'
.sidebar-expand-button.hidden-lg.hidden-md
%i.icon-list.icon-2x
- else
= render "zero_authorized_projects"