Add drawer menu to mobile version

- Added basic drawer menu with JS code working on /stream
This commit is contained in:
Erwan Guyader 2013-11-09 02:21:30 -08:00 committed by flaburgan
parent 4a3869cda8
commit 1e159a027e
3 changed files with 151 additions and 53 deletions

View file

@ -26,6 +26,23 @@ $(document).ready(function(){
.toggleClass('inactive'); .toggleClass('inactive');
}; };
/* Drawer menu */
$('#menu_badge').click(function(evt){
evt.preventDefault();
toggleDrawerMenu();
});
var toggleDrawerMenu = function(){
var app = $("#app");
if (app.hasClass('draw')){
app.removeClass('draw');
}
else {
app.addClass('draw');
}
};
/* Heart toggle */ /* Heart toggle */
$(".like_action", ".stream").bind("tap click", function(evt){ $(".like_action", ".stream").bind("tap click", function(evt){
evt.preventDefault(); evt.preventDefault();

View file

@ -17,6 +17,11 @@ body {
/* scale background image down for iOS retina display */ /* scale background image down for iOS retina display */
size: 200px; size: 200px;
} }
padding-left: 0px;
padding-right: 0px;
}
#main.container {
padding-top: 55px; padding-top: 55px;
} }
@ -28,6 +33,74 @@ h3 {
clear: both; clear: both;
} }
#menu_badge {
float: right;
display: inline-block;
padding: 0px 10px 0px 12px;
img.menu {
height: 40px;
}
}
#app {
position: relative;
left: 0;
-moz-transition:left 0.35s;
-webkit-transition:left 0.35s;
-o-transition:left 0.35s;
transition:left 0.35s;
}
#main_nav {
-moz-transition:left 0.35s;
-webkit-transition:left 0.35s;
-o-transition:left 0.35s;
transition:left 0.35s;
height: 45px;
}
#drawer {
position: fixed;
top: 0;
bottom: 0;
width: 80%;
left: 100%;
background-color: #444;
-moz-transition:left 0.35s;
-webkit-transition:left 0.35s;
-o-transition:left 0.35s;
transition:left 0.35s;
.navbar {
.navbar-inner {
height: 45px;
border: none;
border-radius: 0;
@include box-shadow(0,1px,2px,#333);
background: {
image: image-url("header-bg-long.jpg");
}
width: 100%;
}
}
}
#app.draw {
left: -80%;
#main_nav {
left: -80%;
}
#drawer {
left: 20%;
}
}
.message { .message {
padding-left: 2px; padding-left: 2px;
} }
@ -174,8 +247,8 @@ h3 {
#main_stream { #main_stream {
margin-left: -10px; margin-left: 10px;
margin-right: -10px; margin-right: 10px;
.from { .from {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -327,7 +400,7 @@ header {
top: 0px; top: 0px;
left: 0px; left: 0px;
right: 0px; right: 0px;
min-width: 250px; width: 100%;
z-index: 10; z-index: 10;
background: url("header-bg-long.jpg") rgb(40,35,35); background: url("header-bg-long.jpg") rgb(40,35,35);
@include box-shadow(0, 1px, 2px, #333); @include box-shadow(0, 1px, 2px, #333);
@ -338,6 +411,7 @@ header {
#nav_badges { #nav_badges {
float: right; float: right;
margin: 4px 12px; margin: 4px 12px;
display: inline-block;
.badge { .badge {
display: inline; display: inline;

View file

@ -46,8 +46,10 @@
= yield(:head) = yield(:head)
%body %body
%header #app
%header#main_nav
= link_to(image_tag('branding/header-logo2x.png', height: 40, width: 40), stream_path, id: 'header_title') = link_to(image_tag('branding/header-logo2x.png', height: 40, width: 40), stream_path, id: 'header_title')
= link_to(image_tag('icons/menu.png', :class => 'menu'),"#", id: "menu_badge")
- if user_signed_in? - if user_signed_in?
#nav_badges #nav_badges
@ -68,6 +70,7 @@
= link_to(image_tag('icons/compose_mobile2.png', class: 'compose_icon'), new_status_message_path) = link_to(image_tag('icons/compose_mobile2.png', class: 'compose_icon'), new_status_message_path)
#main.container{:role => "main"} #main.container{:role => "main"}
.row
- if current_page?(:activity_stream) - if current_page?(:activity_stream)
%h3 %h3
= t('streams.activity.title') = t('streams.activity.title')
@ -76,6 +79,10 @@
- if user_signed_in? - if user_signed_in?
= render :partial =>'shared/footer' = render :partial =>'shared/footer'
#drawer
.navbar
.navbar-inner
/ javascripts at the bottom / javascripts at the bottom
= jquery_include_tag = jquery_include_tag
= javascript_include_tag :mobile = javascript_include_tag :mobile