{I" class:ETI"BundledAsset;FI"logical_path;TI"storytime/media.js;FI" pathname;TI"[/Users/ben/flyover/projects/storytime/app/assets/javascripts/storytime/media.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+˜.TI" length;Tiã I" digest;TI"%734aba45537766563cc116351a079b6c;FI" source;TI"ã (function() { Storytime.Dashboard.Media = (function() { function Media() {} Media.prototype.initIndex = function() { this.initUpload(); this.initPagination(); }; Media.prototype.initPagination = function() { $(document).on('ajax:success', '#media_gallery .pagination a', function(e, data, status, xhr) { $("#media_gallery").html(data); }); }; Media.prototype.initUpload = function() { var _ref; if (!this.uploadInitialized) { $('#media_file').fileupload({ dataType: 'json', done: function(e, data) { $("#media_gallery").prepend(data.result.html); }, progressall: function(e, data) { var progress; progress = parseInt(data.loaded / data.total * 100, 10); $('#progress .progress-bar').css('width', progress + '%'); } }).prop('disabled', !$.support.fileInput).parent().addClass((_ref = $.support.fileInput) != null ? _ref : { undefined: 'disabled' }); this.uploadInitialized = true; return; } }; Media.prototype.initInsert = function() { var self; self = this; $(document).on("click", ".insert-image-button", function(e) { var image_tag, node; e.preventDefault(); if (self.selectingFeatured) { $("#featured_media_id").val($(this).data("media-id")); if ($("#featured_media_image").length > 0) { $("#featured_media_image").attr("src", $(this).data("thumb-url")); } else { $("#featured_media_container").html(""); } $("#insertMediaModal").modal("hide"); } else { image_tag = ""; node = $(".summernote").data("range").createContextualFragment(image_tag); $(".summernote").data("range").insertNode(node); $(".note-image-dialog").modal("hide"); } }); }; Media.prototype.initFeaturedImageSelector = function() { var self; self = this; $(document).on("click", "#featured_media_button", function(e) { e.preventDefault(); self.selectingFeatured = true; $("#insertMediaModal").modal("show"); }); $(document).on('hidden.bs.modal', function() { self.selectingFeatured = false; }); }; return Media; })(); }).call(this); ;TI"required_assets_digest;TI"%5e05efb560b7f38a233ae2823ed22d2b;FI" _version;TI"%64b22cf9f770209c1e0beb31754a8cbc;F