summaryrefslogtreecommitdiffstats
path: root/js/public
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-15 13:52:56 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-15 13:52:56 +0200
commit506dc652ff9fd76fde684f621cda2fa2783313a4 (patch)
tree1315991537367b014534903786041a53a8fc650f /js/public
parent360966ab4bdafd15cdef21e34492f5d7d3151b74 (diff)
add support for relative dates, fix #28
Diffstat (limited to 'js/public')
-rw-r--r--js/public/app.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/js/public/app.js b/js/public/app.js
index 0f4912af6..f9ae29d48 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -371,6 +371,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return '';
}
};
+ this._$scope.getRelativeDate = function(date) {
+ if (date) {
+ return _this._language.getMomentFromTimestamp(date).fromNow();
+ } else {
+ return '';
+ }
+ };
}
return ItemController;
@@ -1401,13 +1408,17 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}
Language.prototype.handle = function(data) {
- return this._language = data.language;
+ return this._language = data.split('_')[0];
};
Language.prototype.getLanguage = function() {
return this._language;
};
+ Language.prototype.getMomentFromTimestamp = function(timestamp) {
+ return moment.unix(timestamp).lang(this._language);
+ };
+
return Language;
})();
@@ -1926,6 +1937,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
// Generated by CoffeeScript 1.6.2
+(function() {
+
+
+}).call(this);
+
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -2784,4 +2801,4 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-})(window.angular, jQuery, hex_md5, moment); \ No newline at end of file
+})(window.angular, window.jQuery, window.hex_md5, window.moment); \ No newline at end of file