Skip to content
Browse files

agregando funcionalidad faltante para la version movil

  • Loading branch information...
1 parent 4482090 commit 296017159f4533c5fb919bd00cc710ecbbe21b15 @pinguxx pinguxx committed Apr 11, 2012
Showing with 61 additions and 17 deletions.
  1. +44 −4 public/javascripts/mscript.js
  2. +13 −8 routes/dashboard.js
  3. +4 −5 views/dashboardm.jade
View
48 public/javascripts/mscript.js
@@ -90,7 +90,6 @@ function swipe(){
'href': '#'
});
// insert swipe div into list item
- //TODO: what to do on click function
$li.prepend($deleteBtn);
$li.prepend($voteBtn);
$deleteBtn.slideToggle();
@@ -234,7 +233,7 @@ $('#adduser').live('click', function(){
});
$('.doinvite').live('click', function(){
$.mobile.showPageLoadingMsg();
- $('.invite').show
+ $('.invite').show();
$.mobile.changePage( "#addf",
{
transition: "pop",
@@ -263,7 +262,7 @@ $('.invite').live('click', function(){
function(data) {
if (data){
history.back();
- showMsg('dashboard.warning', 'dashboard.invited');
+ //showMsg('dashboard.warning', 'dashboard.invited');
}else{
showMsg('dashboard.error', 'dashboard.warning_invited');
}
@@ -431,4 +430,45 @@ $('.aVoteBtn').live('click', function(ev){
});
$('.aVoteBtn').slideToggle();
$('.aDeleteBtn').slideToggle();
-});
+});
+
+//para remover al usuario actual de la nominacion
+$('#remove').click(function(ev){
+ $.mobile.showPageLoadingMsg();
+ ev.preventDefault();
+ var uid = $(this).attr('uid');
+ var details = $('#details');
+ var nid = details.find('#attd').attr('nid');
+ $.post("/nominations/eraseuser", { id: nid, user: 'eraseme' },
+ function(data) {
+ if (data){
+ //get the row of the user and erase it
+ $('.users').find('#'+uid).remove();
+ var usersl = details.find('.users');
+ usersl.listview('refresh');
+ }else{
+ showMsg('dashboard.error', 'dashboard.error_removing');
+ }
+ $.mobile.hidePageLoadingMsg();
+ }
+ ).error(function() {
+ $.mobile.hidePageLoadingMsg();
+ showMsg('dashboard.error', 'dashboard.error_removing');
+ });
+});
+//refresh the list of nominations
+$('.refresh').click(function (ev) {
+ $.mobile.showPageLoadingMsg();
+ ev.preventDefault();
+ //get the actual page id
+ var pageid = $.mobile.activePage.attr('id').split('-')[1];
+ //erase the actual list
+ var divider = $('#'+pageid).find('li')[0];
+ $('#'+pageid).find('li').remove();
+ //add the divider
+ $('#'+pageid).append(divider);
+ //reload the nominations
+ loadNominations(pageid);
+});
+
+
View
21 routes/dashboard.js
@@ -45,16 +45,21 @@ module.exports = function(app, log){
log.notice('landed on dashboard user: ' +
req.session.user.id + ' on: ' + new Date() );
var invited = req.param('invited');
- res.render('dashboard',
- {
- user: req.session.user,
- error : req.param('error'),
- type: 'dashboard',
- invited: invited
- });
+ var ua = req.header('user-agent');
+ if(/mobile/i.test(ua)) {
+ res.redirect('/dashboardm');
+ }else{
+ res.render('dashboard',
+ {
+ user: req.session.user,
+ error : req.param('error'),
+ type: 'dashboard',
+ invited: invited
+ });
+ }
});
/**
- * Dashboardm landing, TODO: erase this
+ * Dashboardm landing
*/
app.get('/dashboardm', function(req, res){
//log.notice('landed on dashboard user: ' +
View
9 views/dashboardm.jade
@@ -19,7 +19,7 @@
.ui-block-a
a.create(href="#", data-role="button", data-theme="b") Create
.ui-block-b
- a(href="#", data-role="button", data-theme="b", data-icon="refresh") Refresh
+ a.refresh(href="#", data-role="button", data-theme="b", data-icon="refresh") #{t('dashboard.refresh')}
br
ul#mine(data-role="listview")
li(data-role="list-divider") Select to see the details
@@ -51,7 +51,7 @@
.ui-block-a
a.create(href="#", data-role="button", data-theme="b") Create
.ui-block-b
- a(href="#", data-role="button", data-theme="b", data-icon="refresh") Refresh
+ a.refresh(href="#", data-role="button", data-theme="b", data-icon="refresh") #{t('dashboard.refresh')}
br
ul#voted(data-role="listview")
li(data-role="list-divider") Select to see the details
@@ -84,7 +84,7 @@
.ui-block-a
a.create(href="#", data-role="button", data-theme="b") Create
.ui-block-b
- a(href="#", data-role="button", data-theme="b", data-icon="refresh") Refresh
+ a.refresh(href="#", data-role="button", data-theme="b", data-icon="refresh") #{t('dashboard.refresh')}
br
ul#appear(data-role="listview")
li(data-role="list-divider") Select to see the details
@@ -173,8 +173,7 @@
div(data-role="controlgroup", data-type="horizontal")
a(href="#", data-rel="back", data-icon="back") Back
a#adduser(href="#", data-icon="plus") Add
- a(href="#", data-icon="refresh") Refresh
- a#remove(href="#", data-icon="minus") Remove Me
+ a#remove(href="#", data-icon="minus", uid="#{user.id}") #{t('dashboard.remove_me')}
///footer
///page details

0 comments on commit 2960171

Please sign in to comment.
Something went wrong with that request. Please try again.