o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1336655373.438039: @value"â{I" class:EFI"ProcessedAsset;FI"logical_path;F"*ems/controllers/reports_controller.jsI" pathname;F"z/private/var/www/html/development/projects/rails/ems/app/assets/javascripts/ems/controllers/reports_controller.coffeeI"content_type;FI"application/javascript;FI" mtime;FI"2012-05-09T14:30:06+01:00;FI" length;FiYI" digest;F"%7756c9ef1d0a001b7d6db4a5e3618c9eI" source;FI"Y(function() { var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; Ems.ReportsController = (function(_super) { __extends(ReportsController, _super); ReportsController.name = 'ReportsController'; function ReportsController() { return ReportsController.__super__.constructor.apply(this, arguments); } ReportsController.prototype.report = null; ReportsController.prototype.channels = null; ReportsController.prototype.suggestTags = new Batman.Set; ReportsController.prototype.allTags = null; ReportsController.prototype.selectedChannels = []; ReportsController.prototype.tags = new Batman.Set; ReportsController.prototype.index = function(params) { var filters, _this = this; this.set('categorySlug', params.category); filters = { 'category_slug': params.category }; return Ems.Report.load({ 'filters': filters }, function(err, reports) { if (err) { throw err; } return _this.set('reports', Ems.Report.get('loaded')); }); }; ReportsController.prototype.show = function(params) {}; ReportsController.prototype["new"] = function(params) { var _this = this; this.set('report', new Ems.Report); return Ems.Category.load(function(err, cats) { var cat, found, _i, _len; if (err) { throw err; } found = false; for (_i = 0, _len = cats.length; _i < _len; _i++) { cat = cats[_i]; if (cat.get('slug') === params.category) { found = true; _this.get('report').set('category', cat); _this.set('channels', _this.get('report.category.channels')); } } if (!found) { return _this.redirect('/404'); } }); }; ReportsController.prototype.create = function(params) { var _this = this; return this.get('report').save(function(err) { if (err) { if (!(err instanceof Batman.ErrorsSet)) { throw err; } } else { return Ems.flashSuccess("Report " + (_this.get('report.name')) + " created successfully!"); } }); }; ReportsController.prototype.edit = function(params) { var _this = this; this.set('report', Ems.Report.find(parseInt(params.id), function(err) { if ((err != null ? err.status : void 0) === 404) { _this.redirect('/404'); } if (err) { throw err; } })); this.get('report.category').fetch(function(err, category) { if (err) { throw err; } return _this.set('channels', category.get('channels')); }); setTimeout(function() { return _this.set('tags', _this.get('report.tags')); }, 100); return setTimeout(function() { var channel, channels, _i, _len, _ref, _results; channels = _this.get('report.channels'); if (channels) { _ref = channels.toArray(); _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { channel = _ref[_i]; _results.push(_this.get('selectedChannels').push(channel.id)); } return _results; } }, 100); }; ReportsController.prototype.update = function() { var _this = this; return this.get('report').save(function(err) { if (err) { if (!(err instanceof Batman.ErrorsSet)) { throw err; } } else { Ems.flashSuccess("Report " + (_this.get('report.name')) + " updated successfully!"); return _this.redirect('/reports'); } }); }; ReportsController.prototype.toggleChannel = function(node, event) { var c, channel, channels, newChannels, _i, _len; channels = this.get('channels'); newChannels = new Batman.Set; for (_i = 0, _len = node.length; _i < _len; _i++) { c = node[_i]; if (!(c.nodeType === 1 && c.selected === true)) { continue; } channel = channels.indexedByUnique('id').get(parseInt(c.value)); if (channel) { newChannels.add(channel); } } return this.set('report.channels', newChannels); }; ReportsController.prototype.suggestTags = function(node, event) { var _this = this; if (node.value.length > 0) { if (!this.get('allTags')) { Ems.Tag.load(function(err, tags) { if (err) { throw err; } return _this.set('allTags', Ems.Tag.get('loaded')); }); } return setTimeout(function() { var suggestTags, tag, tags, _i, _len, _ref; suggestTags = new Batman.Set; tags = _this.get('allTags'); _ref = tags.toArray(); for (_i = 0, _len = _ref.length; _i < _len; _i++) { tag = _ref[_i]; if (tag.get('title').indexOf(node.value) >= 0) { suggestTags.add(tag); } } return _this.set('suggestTags', suggestTags); }, 100); } }; ReportsController.prototype.addTag = function(node, value) { var tag; tag = this.get('allTags').indexedByUnique('id').get(parseInt(node.id)); return this.get('report.tags').add(tag); }; ReportsController.prototype.removeTag = function(node, value) { var tag; tag = this.get('report.tags').indexedByUnique('id').get(parseInt(node.id)); return this.get('report.tags').remove(tag); }; return ReportsController; })(Batman.Controller); }).call(this); ;TI"dependency_digest;F"%b4029832a13d30160489511a4f585a48I"required_paths;F["z/private/var/www/html/development/projects/rails/ems/app/assets/javascripts/ems/controllers/reports_controller.coffeeI"dependency_paths;F[{I" path;F"z/private/var/www/html/development/projects/rails/ems/app/assets/javascripts/ems/controllers/reports_controller.coffeeI" mtime;FI"2012-05-09T14:30:06+01:00;FI" digest;F"%50c38fb282f48727fd6de3353bd78e18I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862