aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/models/draft.js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-04-17 17:11:47 +0100
committerStruan Donald <struan@exo.org.uk>2013-04-17 17:14:46 +0100
commit8931b0f009a9cee182d83ddf84ce198d0cd7cd70 (patch)
tree659a15dc1af8befa900d5e027a89268d084f8362 /www/js/models/draft.js
parentbbda3fcd8defa43e2a45aea93a7d90667f6543a7 (diff)
use moment to add created date to drafts and display them
Diffstat (limited to 'www/js/models/draft.js')
-rw-r--r--www/js/models/draft.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/www/js/models/draft.js b/www/js/models/draft.js
index 3917ba9..8ef260f 100644
--- a/www/js/models/draft.js
+++ b/www/js/models/draft.js
@@ -1,4 +1,4 @@
-(function(FMS, Backbone, _, $) {
+(function(FMS, Backbone, _, $, moment) {
_.extend( FMS, {
Draft: Backbone.Model.extend({
localStorage: new Backbone.LocalStorage(CONFIG.NAMESPACE + '-drafts'),
@@ -12,11 +12,26 @@
category: '',
phone: '',
pc: '',
- file: ''
+ file: '',
+ created: moment.utc()
+ },
+
+ description: function() {
+ var desc = '';
+ if ( this.get('title') ) {
+ desc += this.get('title');
+ }
+ desc += ', ' + this.createdDate();
+
+ return desc;
+ },
+
+ createdDate: function() {
+ return moment.utc( this.get('created') ).format( 'H:m Mo MMM' );
}
})
});
-})(FMS, Backbone, _, $);
+})(FMS, Backbone, _, $, moment);
(function(FMS, Backbone, _, $) {
_.extend( FMS, {