Sha256: a5aecffa1a9fc9e3788cdb44c11ef5b3cdcf8ca22ffc3f96d4598b11bd87088c
Contents?: true
Size: 1.32 KB
Versions: 12
Compression:
Stored size: 1.32 KB
Contents
(function() { "use strict"; App.PostsNewRoute = Ember.Route.extend({ actions: { willTransition: function(transition) { var record = this.get('controller.content'); // Allow transition if nothing is entered if (Ember.isEmpty(record.get('title')) && Ember.isEmpty(record.get('bodyMarkdown')) ) { record.destroyRecord(); return true; } // Confirm transition if there are unsaved changes if (record.get('isNew')) { if (confirm("Are you sure you want to lose unsaved changes?")) { record.destroyRecord(); return true; } else { transition.abort(); } } else { if (record.get('isDirty')) { if (confirm("Are you sure you want to lose unsaved changes?")) { record.rollback(); return true; } else { transition.abort(); } } else { return true; } } } }, model: function() { return this.store.createRecord('post'); }, renderTemplate: function() { this.render(); this.render('posts/_form_action_bar', { into: 'application', outlet: 'footer' }); } }); })();
Version data entries
12 entries across 12 versions & 1 rubygems