aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts/refinery/blog/backend.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/refinery/blog/backend.js')
-rw-r--r--app/assets/javascripts/refinery/blog/backend.js73
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, '', '');
});