WordPress.org

Plugin Directory

Changeset 339305


Ignore:
Timestamp:
01/31/11 18:49:21 (3 years ago)
Author:
lessbloat
Message:

Moved form CSS to enqueue, Fixed shortcode insert bug, filtered out new lines that were being made into BR tags in HTML mode.

Location:
grunion-contact-form/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • grunion-contact-form/trunk/grunion-contact-form.php

    r337705 r339305  
    256256    } 
    257257     
    258     $r .= "\n<style>\n"; 
    259     $r .= "\t\t .textwidget input[type='text'], .textwidget textarea { width: 100% !important; }\n"; 
    260     $r .= "\t\t .contact-form .clear-form { clear: both; }\n"; 
    261     $r .= "\t\t .contact-form input[type='text'] { width: 300px; margin-bottom: 13px; }\n"; 
    262     $r .= "\t\t .contact-form select { margin-bottom: 13px; }\n"; 
    263     $r .= "\t\t .contact-form textarea { height: 200px; width: 80%; float: none; margin-bottom: 13px; }\n"; 
    264     $r .= "\t\t .contact-form input[type='radio'], .contact-form input[type='checkbox'] { float: none; margin-bottom: 13px; }\n"; 
    265     $r .= "\t\t .contact-form label { margin-bottom: 3px; float: none; font-weight: bold; display: block; }\n"; 
    266     $r .= "\t\t .contact-form label.checkbox, .contact-form label.radio { margin-bottom: 3px; float: none; font-weight: bold; display: inline-block; }\n"; 
    267     $r .= "\t\t .contact-form label span { color: #AAA; margin-left: 4px; font-weight: normal; }\n"; 
    268     $r .= "\n</style>\n"; 
    269258    $r .= "<form action='#contact-form-$id' method='post' class='contact-form commentsblock'>\n"; 
    270259    $r .= $body; 
     
    602591        '_builtin'      => FALSE 
    603592    ) ); 
     593     
     594    /* Can be dequeued by placing the following in wp-content/themes/yourtheme/functions.php 
     595     * 
     596     *  function remove_grunion_style() { 
     597     *      wp_dequeue_style('grunion.css'); 
     598     *  } 
     599     *  add_action('wp_print_styles', 'remove_grunion_style'); 
     600     */ 
     601     
     602    wp_register_style('grunion.css', GRUNION_PLUGIN_URL . 'css/grunion.css'); 
     603    wp_enqueue_style('grunion.css'); 
    604604} 
    605605add_action( 'init', 'contact_form_init' ); 
  • grunion-contact-form/trunk/grunion-form-view.php

    r337705 r339305  
    1414    var ajax_nonce_json = '<?php echo wp_create_nonce( 'grunion_shortcode_to_json' ); ?>'; 
    1515</script> 
    16 <script type="text/javascript" src="<?php echo GRUNION_PLUGIN_URL; ?>js/grunion.js?00002"></script> 
     16<script type="text/javascript" src="<?php echo GRUNION_PLUGIN_URL; ?>js/grunion.js?00004"></script> 
    1717<script type="text/javascript"> 
    1818    jQuery(document).ready(function () { 
  • grunion-contact-form/trunk/js/grunion.js

    r337531 r339305  
    345345                var regexp = new RegExp("\\[contact-form\\b.*?\\/?\\](?:[\\s\\S]+?\\[\\/contact-form\\])?"); 
    346346                 
     347                // Remove new lines that cause BR tags to show up 
     348                response = response.replace(/\n/g,' '); 
     349                 
    347350                // Add new shortcode 
    348351                if (currentCode.match(regexp)) { 
     
    352355                        // looks like the visual editor is disabled, 
    353356                        // update the contents of the post directly 
    354                         jQuery( '#content', window.parent.document ).html( currentCode.replace( regexp, response ) ); 
     357                        jQuery( '#content', window.parent.document ).val( currentCode.replace( regexp, response ) ); 
    355358                    } 
    356359                } else { 
     
    360363                        // looks like the visual editor is disabled, 
    361364                        // update the contents of the post directly 
    362                         jQuery( '#content', window.parent.document ).html( currentCode + response ); 
     365                        jQuery( '#content', window.parent.document ).val( currentCode + response ); 
    363366                    } 
    364367                } 
  • grunion-contact-form/trunk/readme.txt

    r337531 r339305  
    9191* Use the correct bulk action filter to limit the list to supported actions only 
    9292* Removed inline styles 
     93* Moved basic form CSS to include 
     94* Changed HTML shortcode insert from .html() to .val() 
    9395 
    9496= 1.2 = 
Note: See TracChangeset for help on using the changeset viewer.