{I" class:ETI"ProcessedAsset;FI"logical_path;TI"transponder/presenter.js;FI" pathname;TI"Š/Users/zacksiri/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/transponder-0.10.2/lib/assets/javascripts/transponder/presenter.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+ªà³RI" length;Ti,I" digest;TI"%97518249e12e94de9f7cbae81439691f;FI" source;TI",(function() { var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; Transponder.Presenter = (function() { Presenter.prototype.actions = ['new', 'index', 'show', 'update', 'edit', 'create', 'destroy']; Presenter.prototype.params = {}; Presenter.prototype.presenterName = null; Presenter.prototype.module = null; Presenter.prototype.modelName = null; Presenter.prototype.element = null; Presenter.prototype.response = null; function Presenter(options) { var action, doc, events, _i, _len, _ref; if (options == null) { options = {}; } this.runAction = __bind(this.runAction, this); if (!options.presenterName) { options.presenterName = this.presenterName; } if (!options.module) { options.module = this.module; } if (!options.actions) { options.actions = this.actions; } doc = $(document); events = []; _ref = options.actions; for (_i = 0, _len = _ref.length; _i < _len; _i++) { action = _ref[_i]; events.push(Transponder.buildEvent(['ujs', options.module, options.presenterName, action])); } doc.on(events.join(' '), this.runAction); } Presenter.prototype.elify = function(event, response) { if (this.response.errors) { if (this.response.id) { return "#" + this.response.model_name + "_" + this.response.id; } else { return "#new_" + this.response.model_name; } } else { return "" + event.target.localName + "#" + event.target.id; } }; Presenter.prototype.beforeFilter = function(event, response) { this.response = response; this.element = this.elify(event, response); return this.params = Transponder.req.objectifyParams(); }; Presenter.prototype.runAction = function(event, response) { this.beforeFilter(event, response); if (this.response.errors) { this.errorOut(this.response.action); } else { this[event.type.split(':').pop()](); } return this.afterFilter(event, response); }; Presenter.prototype.afterFilter = function(event, response) {}; Presenter.prototype.triggerEmpty = function(eventName) { return console.log("" + eventName + " triggered! Override this action in your own presenter"); }; Presenter.prototype.errorOut = function(action) { return this.error[action](this.response.errors, this.element); }; Presenter.prototype.index = function() { return this.triggerEmpty('Index'); }; Presenter.prototype.show = function() { return this.triggerEmpty('Show'); }; Presenter.prototype["new"] = function() { return this.triggerEmpty('New'); }; Presenter.prototype.edit = function() { return this.triggerEmpty('Edit'); }; Presenter.prototype.update = function() { return this.triggerEmpty('Update'); }; Presenter.prototype.create = function() { return this.triggerEmpty('Create'); }; Presenter.prototype.destroy = function() { return this.triggerEmpty('Destroy'); }; Presenter.prototype.error = { triggerEmptyError: function(eventName) { return console.log("Error " + eventName + " triggered! Override this action in your own presenter"); }, index: function(errors, element) { return this.triggerEmptyError('Index'); }, show: function(errors, element) { return this.triggerEmptyError('Show'); }, "new": function(errors, element) { return this.triggerEmptyError('New'); }, edit: function(errors, element) { return this.triggerEmptyError('Edit'); }, update: function(errors, element) { return this.triggerEmptyError('Update'); }, create: function(errors, element) { return this.triggerEmptyError('Create'); }, destroy: function(errors, element) { return this.triggerEmptyError('Destroy'); } }; return Presenter; })(); }).call(this); ;TI"dependency_digest;TI"%6456733b0f17d663bcfca6114b658271;FI"required_paths;T[I"Š/Users/zacksiri/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/transponder-0.10.2/lib/assets/javascripts/transponder/presenter.coffee;FI"dependency_paths;T[{I" path;TI"Š/Users/zacksiri/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/transponder-0.10.2/lib/assets/javascripts/transponder/presenter.coffee;FI" mtime;TI"2013-12-20T13:16:10+07:00;TI" digest;TI"%f4ece5f0855fa7ca3f53d50496d33666;FI" _version;TI"%a56df69ef97ba4d9f1a23bf9b0add58a;F