Permalink
Browse files

correcting bug with sharedas on program digests

  • Loading branch information...
1 parent 9566075 commit 405a2b8285b12666f909f4d7cee76468d4ca9043 @dyoo committed Dec 23, 2012
Showing with 19 additions and 7 deletions.
  1. +2 −4 war-src/js/programdigest.js
  2. +17 −3 war-src/js/sharedas.js
@@ -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();
};
@@ -60,4 +58,4 @@ goog.require("plt.wescheme.SharedAs");
};
-}());
+}());
View
@@ -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.