{I" class:ETI"BundledAsset;FI"logical_path;TI":blogelator/controllers/posts/posts_edit_controller.js;FI" pathname;TI"{/Users/brian/github/codelation/blogelator/app/assets/javascripts/blogelator/controllers/posts/posts_edit_controller.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+SI" length;TiI" digest;TI"%9ef7fddfa384b60eff5e01d96b817861;FI" source;TI"(function() { "use strict"; App.PostsEditController = Ember.ObjectController.extend({ needs: ['posts'], secondsPassed: 0, actions: { destroy: function(defer) { var post = this.get('content'), controller = this.get('controllers.posts'); if (Ember.isNone(defer)) { post.destroyRecord(); return post; } post.destroyRecord().then(function() { defer.resolve(); Ember.run.later(function() { controller.transitionToRoute('posts.index'); }, 900); }, function() { defer.reject(); }); return post; }, save: function(defer) { var post = this.get('content'); if (Ember.isNone(defer)) { post.save(); return post; } if (!post.get('isDirty')) { defer.resolve(); } else { post.save().then(function() { defer.resolve(); }, function() { defer.reject(); }); } return post; }, togglePublished: function(defer) { var post = this.get('content'); if (Ember.isNone(post.get('publishedAt'))) { post.set('publishedAt', new Date()); } else { post.set('publishedAt', null); } if (Ember.isNone(defer)) { post.save(); return post; } if (!post.get('isDirty')) { defer.resolve(); } else { post.save().then(function() { defer.resolve(); }, function() { defer.reject(); }); } return post; } }, init: function() { this._super(); this.updateSecondsPassed(); }, isClean: function() { return !this.get('isDirty'); }.property('isDirty'), updateSecondsPassed: function() { var self = this; this.incrementProperty('secondsPassed', 1); Ember.run.later(function() { self.updateSecondsPassed(); }, 1000); } }); })(); ;TI"required_assets_digest;TI"%e9f9359531ab8ede02abaf09aa1eb50c;FI" _version;TI"%361c512b9086418778df946c0d278f91;F