Skip to content

Commit

Permalink
correcting bug with sharedas on program digests
Browse files Browse the repository at this point in the history
  • Loading branch information
dyoo committed Dec 23, 2012
1 parent 9566075 commit 405a2b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
6 changes: 2 additions & 4 deletions war-src/js/programdigest.js
Expand Up @@ -44,14 +44,12 @@ goog.require("plt.wescheme.SharedAs");

plt.wescheme.ProgramDigest.prototype.hasSharingUrls = function() {
return (this.getSharedAsEntries().length > 0);
//return this.dom.find('sharedAs Entry').length > 0;
};


// getSharedAsEntries: -> [{publicId: string, title: string, modified: string} ...]
plt.wescheme.ProgramDigest.prototype.getSharedAsEntries = function() {
return new plt.wescheme.SharedAs(
this.dom.children('sharedAs')).getEntries();
return plt.wescheme.SharedAs.fromDom(this.dom.children('sharedAs')).getEntries();
};


Expand All @@ -60,4 +58,4 @@ goog.require("plt.wescheme.SharedAs");
};


}());
}());
20 changes: 17 additions & 3 deletions war-src/js/sharedas.js
@@ -1,11 +1,25 @@
goog.provide("plt.wescheme.SharedAs");


plt.wescheme.SharedAs = function(json) {
this.json = json;
plt.wescheme.SharedAs = function(entries) {
this.entries = entries;
};


plt.wescheme.SharedAs.fromDom = function(dom) {
var entries = [];
jQuery(dom).children("Entry").each(
function() {
var publicId = jQuery(this).children("publicId").text();
var title = jQuery(this).children("title").text();
var modified = parseInt(jQuery(this).children("modified").text());
entries.push({ publicId : publicId,
title: title,
modified: modified });
});
return new plt.wescheme.SharedAs(entries);
};

plt.wescheme.SharedAs.prototype.getEntries = function() {
return this.json;
return this.entries;
};

0 comments on commit 405a2b8

Please sign in to comment.