Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: beetlebox/firefoxos-001
base: 0a93850f92
...
head fork: beetlebox/firefoxos-001
compare: b2d1e22678
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 30 additions and 11 deletions.
  1. +3 −2 js/api.js
  2. +24 −8 js/events.js
  3. +3 −1 js/user.js
View
5 js/api.js
@@ -15,7 +15,7 @@ this.api = (function() {
// callback(false);
// }
// })
-
+
$.ajax({
url: APIURL+'event/list/?limit=10&token='+token,
dataType:'json',
@@ -165,7 +165,7 @@ this.api = (function() {
}
function setAttend(token,eid,type,callback) {
- var url = type == 'attend' ? APIURL+'user/attend' : APIURL+'user/unattend';
+ var url = type == 'attend' ? APIURL+'user/setattend' : APIURL+'user/setunattend';
data = {
eid : eid,
@@ -176,6 +176,7 @@ this.api = (function() {
mozSystem: true
});
xhr.open('POST', url, true);
+ xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.onload = function() {
if(xhr.readyState == 200) {
if($.isFunction(callback)) {
View
32 js/events.js
@@ -23,11 +23,15 @@ this.events = (function() {
}
else {
if(window.navigator.onLine) {
- api.items('', function(data) {
- if(data) {
- add(data);
- showList();
- }
+ $('#view-event-list-status').show();
+ user.getToken(function(token) {
+ api.items('', token, function(data) {
+ if(data) {
+ add(data);
+ showList();
+ $('#view-event-list-status').hide();
+ }
+ });
});
}
else {
@@ -126,6 +130,8 @@ this.events = (function() {
$('#detail-description').text(data.description);
+ console.log(data.is_attend);
+
if(data.is_attend) {
$('#detail-meta input[type="checkbox"]').attr('checked','checked');
}
@@ -379,12 +385,22 @@ $(function() {
$('#detail-attend').click(function() {
var type = $(this).is(':checked') ? 'attend' : 'unattend';
- user.setAttend($('#view-event-detail').attr('data-eventid'),type,function() {
+ user.setAttend($('#view-event-detail').attr('data-eventid'),type,function(ret) {
if(type == 'attend') {
- $('#detail-attend').attr('checked');
+ if(ret) {
+ $('#detail-attend').attr('checked','checked');
+ }
+ else {
+ $('#detail-attend').removeAttr('checked');
+ }
}
else {
- $('#detail-attend').removeAttr('checked');
+ if(ret) {
+ $('#detail-attend').removeAttr('checked');
+ }
+ else {
+ $('#detail-attend').attr('checked','checked');
+ }
}
})
})
View
4 js/user.js
@@ -183,7 +183,9 @@ this.user = (function() {
})
}
else {
- callback('');
+ if($.isFunction(callback)) {
+ callback('');
+ }
}
});
}

No commit comments for this range

Something went wrong with that request. Please try again.