diff options
author | Philip Arndt <p@arndt.io> | 2013-09-14 10:00:42 +1200 |
---|---|---|
committer | Philip Arndt <p@arndt.io> | 2013-09-16 04:56:47 +1200 |
commit | a8b5bce609089af8795768230c7dd3a9b87cd5e0 (patch) | |
tree | 22a2a154da2b48988c9c4e05600e52fa1b884bf1 /app/assets/javascripts | |
parent | 5ae082d79e554d3449083aa70ef64ef5d677759a (diff) | |
download | refinerycms-blog-a8b5bce609089af8795768230c7dd3a9b87cd5e0.tar.gz refinerycms-blog-a8b5bce609089af8795768230c7dd3a9b87cd5e0.tar.bz2 refinerycms-blog-a8b5bce609089af8795768230c7dd3a9b87cd5e0.zip |
Supported Rails 4 and Refinery 3.0.0.dev
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/refinery/blog/backend.js | 73 |
1 files changed, 14 insertions, 59 deletions
diff --git a/app/assets/javascripts/refinery/blog/backend.js b/app/assets/javascripts/refinery/blog/backend.js index 77529c5..d4869c1 100644 --- a/app/assets/javascripts/refinery/blog/backend.js +++ b/app/assets/javascripts/refinery/blog/backend.js @@ -48,68 +48,23 @@ $(document).ready(function(){ e.preventDefault(); }); - - $(function() { - $('#page-tabs').tabs(); - $('#copy_body_link').click(function(event) { - // Find the WYMEditor that maps to the custom_teaser field - var teaserTextArea = $('#post_custom_teaser')[0]; - var teaserEditor = null; - $.each(WYMeditor.INSTANCES, function(index, editor) { - if (editor._element[0] == teaserTextArea) { - teaserEditor = editor; - } - }); - - if (teaserEditor) { - teaserEditor.html($('#post_body').attr('value')); + $('#page-tabs').tabs(); + $('#copy_body_link').click(function(event) { + // Find the WYMEditor that maps to the custom_teaser field + var teaserTextArea = $('#post_custom_teaser')[0]; + var teaserEditor = null; + $.each(WYMeditor.INSTANCES, function(index, editor) { + if (editor._element[0] == teaserTextArea) { + teaserEditor = editor; } - - event.preventDefault(); }); - }); - - function split( val ) { - return val.split( /,\s*/ ); - } - function extractLast( term ) { - return split( term ).pop(); - } + if (teaserEditor) { + teaserEditor.html($('#post_body').attr('value')); + } - page_options.init(false, '', '') + event.preventDefault(); + }); - $('<%= dom_id %>').bind( "keydown", function( event ) { - if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { - event.preventDefault() - } - }).autocomplete({ - source: function( request, response ) { - $.getJSON( "<%= url %>", { - term: extractLast( request.term ) - }, response ); - }, - search: function() { - // custom minLength - var term = extractLast( this.value ); - if ( term.length < 2 ) { - return false; - } - }, - focus: function() { - // prevent value inserted on focus - return false; - }, - select: function( event, ui ) { - var terms = split( this.value ); - // remove the current input - terms.pop(); - // add the selected item - terms.push( ui.item.value ); - // add placeholder to get the comma-and-space at the end - terms.push( "" ); - this.value = terms.join( ", " ); - return false; - } - }) + page_options.init(false, '', ''); }); |