Skip to content

Commit

Permalink
fixed buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyang committed Apr 30, 2013
1 parent 6848a4b commit cf419e8
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 97 deletions.
11 changes: 2 additions & 9 deletions static/desktop/css/login.css
Expand Up @@ -5,13 +5,14 @@

#loginOverlay {
background: black;
opacity: 0.7;
opacity: 0.85;
position: fixed;
top: 50px;
width: 100%;
height: 100%;
padding: 20px 0px;
text-align: center;
z-index: 1000;
}


Expand Down Expand Up @@ -53,11 +54,3 @@
text-align: center;

}








11 changes: 3 additions & 8 deletions static/desktop/css/style.css
Expand Up @@ -296,27 +296,26 @@ Each Event


.myevents .star {
background-image: url('img/favorites.png');
display: inline;
float: left;
background-size: contain;
height: 30px;
width: 30px;
margin: 0px 5px;
background-image: url('img/favorites.png');
}

.myevents .starred {
background-image: url('img/favorites-starred.png');
display: inline;
float: left;
background-size: contain;
height: 30px;
width: 30px;
margin: 0px 5px;
background-image: url('img/favorites-starred.png');
}

.myevents .more {
background-image: url("img/arrow.png");
display: inline-block;
vertical-align: middle;
float: right;
Expand All @@ -327,7 +326,7 @@ Each Event
position: absolute;
right: 10px;
top: 30%;

background-image: url("img/arrow.png");
}

.myevents .more:hover {
Expand Down Expand Up @@ -434,7 +433,3 @@ More Info
.initiallyHidden {
display: none;
}




7 changes: 5 additions & 2 deletions static/desktop/index.html
Expand Up @@ -38,6 +38,7 @@
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<script>
window.addEventListener('load', function(){
login_app = new Login_app();
org_app = new org_app();
search_app = new Search_app();
notification_app = new Notification_app();
Expand All @@ -56,12 +57,14 @@
<div id = "clearfix"> </div>
<div id = "rest">
<div id = "loginOverlay" class = "login_fields login_hidden">
<div id="message"></div>
<div id="loginWrapper">
<div id="message"></div>
<input type="text" name="name" id="username" class = "login" placeholder = "Username"><br>
<input type="password" name="password" id="password" class = "login" placeholder = "Password"><br>
<input type="submit" class = "top_button" value="Login" id="login_button">
<input type="button" class = "top_button" value="Register" id="register_button" >
</div>
</div>
</div>
<div id="overlay" class="transition hidden"> </div>
<div id="overlay-content" class="initiallyHidden">
<h2>My Subscriptions</h2>
Expand Down
3 changes: 0 additions & 3 deletions static/desktop/js/login_UI.js
Expand Up @@ -19,9 +19,6 @@ Login_UI.prototype =
back: $('#left_button')
};

if(window.app_API.isLoggedIn() !== false) {
this.logoutAction();
}
},

showMessage: function(message) {
Expand Down
94 changes: 45 additions & 49 deletions static/desktop/js/login_app.js
Expand Up @@ -2,54 +2,7 @@
self loading login manager
=============================================*/

window.addEventListener('load', function(){
var ui;


(function(){

var g = {
handleLogoutResult: function(err, result){
window.location = '/index.html';
}
}

//==================
// API
//==================

window.LogoutManager = {
setHangleLogoutResult: function(callback){
g.handleLogoutResult = callback;
},
}

//==================
// DOM
//==================

Login_UI.prototype.logoutAction = function(){
var request = $.ajax({ type: 'post', url: '/auth/logout'});
setupCallback(request, g.handleLogoutResult);
};

function setupCallback(request, done){
request.done(function(data) {
if (data.err !== undefined)
done(data.err, null);
else
done(null, data);
});
request.fail(function(jqXHR, textStatus, err){
done(err, null);
});
}
})();

var ui = new Login_UI();


var Login_app = function() {
(function(){

var g = {
Expand Down Expand Up @@ -192,4 +145,47 @@ window.addEventListener('load', function(){
})();


});
(function(){

var g = {
handleLogoutResult: function(err, result){
window.location = '/index.html';
}
}

//==================
// API
//==================

window.LogoutManager = {
setHangleLogoutResult: function(callback){
g.handleLogoutResult = callback;
},
}

//==================
// DOM
//==================

Login_UI.prototype.logoutAction = function(){
var request = $.ajax({ type: 'post', url: '/auth/logout'});
setupCallback(request, g.handleLogoutResult);
};

function setupCallback(request, done){
request.done(function(data) {
if (data.err !== undefined)
done(data.err, null);
else
done(null, data);
});
request.fail(function(jqXHR, textStatus, err){
done(err, null);
});
}
})();

this.ui = new Login_UI();


}
2 changes: 0 additions & 2 deletions static/desktop/js/notification_UI.js
Expand Up @@ -6,8 +6,6 @@ var Notification_UI = function(config) {


this.bindTabs();
search_app.ui.bindTabs();
org_app.ui.bindTabs();


}
Expand Down
35 changes: 22 additions & 13 deletions static/desktop/js/org_UI.js
Expand Up @@ -13,7 +13,6 @@ var UI = function(config){
this.org_app = config.events;

//on clicking the tab show all events BIND THIS?
this.bindTabs();
}

UI.prototype =
Expand Down Expand Up @@ -48,7 +47,8 @@ UI.prototype =
topleft_button: $('#left_button'),
topright_button: $('#right_button'),
eventInfo: $("#eventInfo"),
loginOverlay: $("#loginOverlay")
loginOverlay: $("#loginOverlay"),
loginWrapper: $('#loginWrapper')
};

},
Expand All @@ -70,13 +70,6 @@ UI.prototype =
}
}.bind(this));

},

//for events of a particular org
showEvents: function(events){
this.dom.loginOverlay.addClass("login_hidden");
//initiate DOM in case it was over written
this.initDom();
//bind left/right buttons
this.dom.topleft_button.unbind('click');
this.dom.topleft_button.html('settings');
Expand All @@ -86,10 +79,22 @@ UI.prototype =
this.dom.topright_button.unbind('click');
if(window.app_API.isLoggedIn() === false) {
this.dom.topright_button.html("Login");
this.dom.topright_button.click(this.loginPage.bind(this));
} else {
this.dom.topright_button.html("Logout");
this.dom.topright_button.click(login_app.ui.logoutAction);
}
this.dom.topright_button.click(this.loginPage.bind(this));



},

//for events of a particular org
showEvents: function(events){
this.dom.loginOverlay.addClass("login_hidden");
//initiate DOM in case it was over written
this.initDom();
this.bindTabs();

allEvents = events['events'];
console.log(allEvents);
Expand Down Expand Up @@ -379,13 +384,17 @@ UI.prototype =

loginPage: function() {
if (this.dom.loginOverlay.is(":hidden")) {
console.log("it's 4 AM #cmulyfeeeee");
(this.dom.loginOverlay).slideDown("slow");
$("#app").html("");
this.dom.loginWrapper.click(function(e) {
console.log("herp");
e.stopPropagation();
});
this.dom.loginOverlay.click(function() {
this.dom.loginOverlay.hide();
}.bind(this));
} else {
(this.dom.loginOverlay).hide();
}
this.dom.loginOverlay.removeClass("login_hidden");
//window.location = 'login.html';
}
}
3 changes: 1 addition & 2 deletions static/desktop/js/search_UI.js
Expand Up @@ -10,7 +10,6 @@ var Search_UI = function(config) {

//Bind all the tabs relavent to events.
this.bindTabs();
org_app.ui.bindTabs();


}
Expand All @@ -25,7 +24,7 @@ Search_UI.prototype = {
$('#app').html("").append(page);
if($('#searchbar').length === 0)
page.append($('<div class = "search_container"> <input type="text" id="searchbar"> </div>'));
if($('#searchbarDate').length === 0)
if($('#searchbarDate').length === 0)
$('.search_container').append($('<input type="date" id="searchbarDate"> '));
if($('#searchSubmit').length === 0)
$(".search_container").append($('<button id="searchSubmit"> Go </button>'));
Expand Down
17 changes: 8 additions & 9 deletions static/desktop/js/subscription_UI.js
Expand Up @@ -6,9 +6,9 @@ var Subscription_UI = function(config) {

this.subscription_app = config.events;

notification_app.ui.bindTabs();
search_app.ui.bindTabs();
org_app.ui.bindTabs();
// notification_app.ui.bindTabs();
// search_app.ui.bindTabs();
// org_app.ui.bindTabs();
this.bindTabs();
}

Expand Down Expand Up @@ -44,11 +44,10 @@ Subscription_UI.prototype = {
var results = $('#subscription_results');

var left_button = $('#left_button');
var right_button = $('#right_button');
// var right_button = $('#right_button');
var headline = $('#topbar');
var tags = $('#subscription_tags');
var orgs = $('#subscription_orgs');
console.log(overlay)

this.dom = {
overlay: overlay,
Expand All @@ -61,7 +60,7 @@ Subscription_UI.prototype = {
settings_button: org_app.ui.dom.topleft_button,
rest: $('#rest'),
topleft_button: left_button,
topright_button: right_button,
topright_button: org_app.ui.dom.topright_button,
}

this.dom.overlay_content.removeClass('initiallyHidden');
Expand Down Expand Up @@ -90,7 +89,7 @@ Subscription_UI.prototype = {
"subscription settings");
}
}.bind(this));
console.log('binding tabs');

},

showSubscriptions: function(results) {
Expand Down Expand Up @@ -151,8 +150,6 @@ Subscription_UI.prototype = {
showOverlay: function(overlay) {

console.log('Showing Overlay');
this.dom.topleft_button.html("Back");
this.dom.topright_button.html("Edit");
// this.dom.append($('<div class = "search_container"> <input type="text" id="searchbar"> </div>'));

this.dom.overlay.append(overlay);
Expand All @@ -162,6 +159,7 @@ Subscription_UI.prototype = {

//toggling of showing overlay
this.dom.settings_button.unbind('click');
this.dom.settings_button.html('Back');
this.dom.settings_button.click(function() {
this.hideOverlay(overlay);
}.bind(this));
Expand All @@ -185,6 +183,7 @@ Subscription_UI.prototype = {
this.dom.rest.css('overflow', 'auto');
});
this.dom.settings_button.unbind('click');
this.dom.settings_button.html('Settings');
this.dom.settings_button.click(function() {
this.showOverlay(overlay);
}.bind(this));
Expand Down

0 comments on commit cf419e8

Please sign in to comment.