### window.SetContentTo = function(id, content){ $(id).val(content); } window.GetContent = function(id){ $(id).val(content); } ### class window.Editor extends Backbone.View el: '#editor-container' events: -> 'keypress .note-editable': 'copyToFocusedElement' #'keypress #mail-editor': 'copyToTextArea' '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" initialize: -> @textarea = $(@el).find('#campaign_html_content') copyToEditor: (ev)-> $this = $(ev.currentTarget); window.setTimeout ()=> $(@el).find('#mail-editor').html($this.val()); , 0 copyToTextArea: ()-> $this = $("#mail-editor"); window.setTimeout ()=> $(@el).find('textarea').val($this.html()); , 0 copyToFocusedElement: (ev)-> console.log "soji" @currentFocused().find('.mcnTextContent').html($(ev.currentTarget).html()) @copyToTextArea() template: -> '
dsfsd
' render: -> #$(@el).find('#mail-editor').html(@template()) $(@el).find('#mail-editor').html(@textarea.val()); #init from saved content #$(@el).find('#mail-editor').html(@baseTemplate()) #init from base js tamplarte displaySections: ()-> $('.tpl-container').addClass("over") _.each $('.tpl-container'), (n)-> return if $(n).find(".legend").length > 0 $(n).append("
|
|
|
|
|
|
|
|