{I" class:ETI"ProcessedAsset;FI"logical_path;TI"&chaskiq/manage/campaign_wizard.js;FI" pathname;TI"t/Users/michelsonmartinez/Documents/ruby/chaskiq/app/assets/javascripts/chaskiq/manage/campaign_wizard.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+´UI" length;Ti2GI" digest;TI"%698808c2fc7ad685a2a8bc06c6206c2d;FI" source;TI"2G /* window.SetContentTo = function(id, content){ $(id).val(content); } window.GetContent = function(id){ $(id).val(content); } */ (function() { var extend = 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; }, hasProp = {}.hasOwnProperty; window.Editor = (function(superClass) { extend(Editor, superClass); function Editor() { return Editor.__super__.constructor.apply(this, arguments); } Editor.prototype.el = '#editor-container'; Editor.prototype.events = function() { return { 'keypress .note-editable': 'copyToFocusedElement', 'drag .blocks li a': 'drag', "dragover #bodyTable": "displaySections", "dragleave #bodyTable": "hideSections", "drop #bodyTable": "hideSections", "dragover #templateBody": "allowDrop", "dragover #templatePreheader": "allowDrop", "dragover #templateHeader": "allowDrop", "dragover #templateBody": "allowDrop", "dragover #templateFooter": "allowDrop", 'drop #templateBody': "drop", 'drop #templatePreheader': "drop", 'drop #templateHeader': "drop", 'drop #templateBody': "drop", "drop #templateFooter": "drop", "click .tpl-block": "setFocus", "click #editor-controls #save": "displayBlockButtons", "click .imagePlaceholder .button-small": "displayUploaderList", "click .tpl-block-delete": "deleteBloc" }; }; Editor.prototype.initialize = function() { return this.textarea = $(this.el).find('#campaign_html_content'); }; Editor.prototype.copyToEditor = function(ev) { var $this; $this = $(ev.currentTarget); return window.setTimeout((function(_this) { return function() { return $(_this.el).find('#mail-editor').html($this.val()); }; })(this), 0); }; Editor.prototype.copyToTextArea = function() { var $this; $this = $("#mail-editor"); return window.setTimeout((function(_this) { return function() { return $(_this.el).find('textarea').val($this.html()); }; })(this), 0); }; Editor.prototype.copyToFocusedElement = function(ev) { console.log("soji"); this.currentFocused().find('.mcnTextContent').html($(ev.currentTarget).html()); return this.copyToTextArea(); }; Editor.prototype.template = function() { return '

dsfsd

'; }; Editor.prototype.render = function() { return $(this.el).find('#mail-editor').html(this.textarea.val()); }; Editor.prototype.displaySections = function() { $('.tpl-container').addClass("over"); return _.each($('.tpl-container'), function(n) { if ($(n).find(".legend").length > 0) { return; } return $(n).append("
" + ($(n).attr("mc:container")) + "
"); }); }; Editor.prototype.hideSections = function() { $('.tpl-container').removeClass("over"); return _.each($('.tpl-container'), function(n) { return $(n).find(".legend").remove(); }); }; Editor.prototype.drag = function(ev) { return this.dragged = $(ev.currentTarget); }; Editor.prototype.allowDrop = function(ev) { console.log("allos drop"); return ev.preventDefault(); }; Editor.prototype.drop = function(ev) { var container, tmpl; ev.preventDefault(); console.log(this.dragged.data('block'), ev.target.id); container = $(ev.currentTarget); tmpl = this.handleBlock(this.dragged.data('block')); container.find(".tpl-container").append(tmpl); $(container).find('.mojoMcContainerEmptyMessage').hide(); return this.copyToTextArea(); }; Editor.prototype.displayWysiwyg = function() { $('.block-settings').show(); $('.main-settings').hide(); this.initWysiwyg(); return false; }; Editor.prototype.displayBlockButtons = function() { $('.block-settings').hide(); $('.main-settings').show(); return false; }; Editor.prototype.currentFocused = function() { return $(".tpl-block.focus"); }; Editor.prototype.setFocus = function(ev) { $(".tpl-block").removeClass("focus"); $(ev.currentTarget).addClass("focus"); this.displayWysiwyg(); return false; }; Editor.prototype.initWysiwyg = function() { $('.summernote').destroy(); InitSummernote(); return $('.summernote').code(this.currentFocused().find('.mcnTextContent').html()); }; Editor.prototype.handleBlock = function(block_type) { var html; html = ""; switch (block_type) { case "boxed": html = this.boxedBlock(); break; case "text": html = this.textBlock(); break; case "separator": html = this.separatorBlock(); break; case "image": html = this.imageBlock(); break; case "image_group": html = this.imageGroupBlock(); break; case "image_card": html = this.imageCardBlock(); break; default: console.log("Nada"); } return this.wrapBlock(html); }; Editor.prototype.deleteBloc = function(ev) { var container, target; target = $(ev.currentTarget); container = target.parents(".tpl-container"); target.parents(".tpl-block").remove(); if (container.find(".tpl-block").length === 0) { container.find(".mojoMcContainerEmptyMessage").show(); } return false; }; Editor.prototype.wrapBlock = function(content) { return "
" + content + "
" + (this.templateBlockControls()) + "
"; }; Editor.prototype.templateBlockControls = function() { return "
"; }; Editor.prototype.baseTemplate = function() { return "
Drop Content Blocks Here
Drop Content Blocks Here
Drop Content Blocks Here
Drop Content Blocks Here
" + (this.wrapBlock(this.subscriptionBlock())) + "
"; }; Editor.prototype.boxedBlock = function() { return "
This is a Text Block. Use this to provide text...
"; }; Editor.prototype.textBlock = function() { return "
This is a Text Block. Use this to provide text...
"; }; Editor.prototype.separatorBlock = function() { return "
"; }; Editor.prototype.imageBlock = function() { return "
Drop an image here
or
"; }; Editor.prototype.imageGroupBlock = function() { return "
Drop an image here
or
Drop an image here
or
"; }; Editor.prototype.imageCardBlock = function() { return "
Drop an image here
or
Your text caption goes here
"; }; Editor.prototype.subscriptionBlock = function() { return "
© {{campaign_description}}

Our mailing address is:
{{campaign_url}}

unsubscribe from this list    update subscription preferences 

"; }; Editor.prototype.displayUploaderList = function(ev) { var placeholder; placeholder = $(ev.currentTarget).parents('.imagePlaceholder'); this.checkExistentImages(placeholder); return false; }; Editor.prototype.checkExistentImages = function(placeholder) { return $.ajax({ url: $("#editor-container").data("attachments-path"), dataType: "json", success: (function(_this) { return function(data) { Chaskiq.Helpers.showModal(_this.templateForAttachments(data), "dsdsda"); _this = _this; return $('.image-selector').on("click", function() { var html, url; html = placeholder.parents(".mcpreview-image-uploader"); url = $(this).data('image-url'); _this.replaceImagePreview(html, url); return false; }); }; })(this), error: function(err) { return alert("error retrieving files"); } }); }; Editor.prototype.replaceImagePreview = function(html_to_replace, url) { html_to_replace.replaceWith(""); Chaskiq.Helpers.hideModal(); return this.copyToTextArea(); }; Editor.prototype.templateForAttachments = function(data) { var html; html = ""; }; return Editor; })(Backbone.View); }).call(this); ;TI"dependency_digest;TI"%ab518e039f6e5c232e48a8bf1db76b20;FI"required_paths;T[I"t/Users/michelsonmartinez/Documents/ruby/chaskiq/app/assets/javascripts/chaskiq/manage/campaign_wizard.js.coffee;FI"dependency_paths;T[{I" path;TI"t/Users/michelsonmartinez/Documents/ruby/chaskiq/app/assets/javascripts/chaskiq/manage/campaign_wizard.js.coffee;FI" mtime;TI"2015-03-23T21:47:22-03:00;TI" digest;TI"%779a2647f0759332aa228bffc804ad98;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F