o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1364984318.022999: @value" {I" class:EFI"ProcessedAsset;FI"logical_path;FI"0locomotive/views/theme_assets/index_view.js;TI" pathname;FI"w/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-04-03T11:01:13+02:00;FI" length;Fi†I" digest;F"%adf119920a49e4479ce5c24db76180a4I" source;FI"†(function() { var _base, _ref, __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; }; (_base = Locomotive.Views).ThemeAssets || (_base.ThemeAssets = {}); Locomotive.Views.ThemeAssets.IndexView = (function(_super) { __extends(IndexView, _super); function IndexView() { _ref = IndexView.__super__.constructor.apply(this, arguments); return _ref; } IndexView.prototype.el = '#content'; IndexView.prototype._lists_views = []; IndexView.prototype.initialize = function() { return _.bindAll(this, 'insert_asset'); }; IndexView.prototype.render = function() { this.build_uploader(); this.render_snippets(); this.render_images(); this.render_js_and_css(); this.render_fonts(); this.render_media(); this.render_others(); return this; }; IndexView.prototype.build_uploader = function() { var form, input, link, _this = this; form = this.$('#theme-assets-quick-upload'); input = form.find('input[type=file]'); link = form.find('a.new'); form.formSubmitNotification(); link.bind('click', function(event) { event.stopPropagation() & event.preventDefault(); return input.click(); }); return input.bind('change', function(event) { form.trigger('ajax:beforeSend'); return _.each(event.target.files, function(file) { var asset; asset = new Locomotive.Models.ThemeAsset({ source: file }); return asset.save({}, { success: function(model, response, xhr) { form.trigger('ajax:complete'); return _this.insert_asset(model); }, error: (function() { return form.trigger('ajax:complete'); }), headers: { 'X-Flash': true } }); }); }); }; IndexView.prototype.insert_asset = function(model) { var list_view; window.foo = model; list_view = this.pick_list_view(model.get('content_type')); if (list_view != null) { return list_view.collection.add(model); } }; IndexView.prototype.render_snippets = function() { return this.render_list('snippets', this.options.snippets, Locomotive.Views.Snippets.ListView); }; IndexView.prototype.render_images = function() { return this.render_list('images', this.options.images); }; IndexView.prototype.render_js_and_css = function() { return this.render_list('js-and-css', this.options.js_and_css_assets, Locomotive.Views.ThemeAssets.ListView, ich.js_and_css_list); }; IndexView.prototype.render_fonts = function() { return this.render_list('fonts', this.options.fonts, Locomotive.Views.ThemeAssets.ListView, ich.fonts_list); }; IndexView.prototype.render_media = function() { return this.render_list('media', this.options.media, Locomotive.Views.ThemeAssets.ListView, ich.media_list); }; IndexView.prototype.render_others = function() { return this.render_list('others', this.options.others, Locomotive.Views.ThemeAssets.ListView, ich.others_list); }; IndexView.prototype.render_list = function(type, collection, view_klass, template) { var view; if (this.$("#" + type + "-anchor").size() === 0) { return; } view_klass || (view_klass = Locomotive.Views.ThemeAssets.ListView); view = new view_klass({ collection: collection, type: type }); if (template != null) { view.template = function() { return template; }; } this.$("#" + type + "-anchor").replaceWith(view.render().el); return (this._lists_views || (this._lists_views = [])).push(view); }; IndexView.prototype.pick_list_view = function(content_type) { var type, _this = this; type = (function() { switch (content_type) { case 'image': return 'images'; case 'javascript': case 'stylesheet': return 'js-and-css'; case 'media': return 'media'; case 'font': return 'fonts'; case 'other': return 'others'; } })(); return _.find(this._lists_views, function(view) { return view.options.type === type; }); }; IndexView.prototype.remove = function() { var _this = this; _.each(this._lists_views, function(view) { return view.remove(); }); return IndexView.__super__.remove.apply(this, arguments); }; return IndexView; })(Backbone.View); }).call(this); ;TI"dependency_digest;F"%d43aec18de2d1d0dd44837a3d06beb63I"required_paths;F[I"w/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee;TI"dependency_paths;F[{I" path;FI"w/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee;TI" mtime;FI"2013-04-03T11:01:13+02:00;FI" digest;F"%aa44f6b25999c5b2b06860f3614323c3I" _version;F"%6776f581a4329e299531e1d52aa59832