Changeset 2277 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
- Timestamp:
- 01/12/2016 04:36:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
r2276 r2277 11 11 */ 12 12 public function __construct() { 13 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_ assets' ), 11 );13 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_common_assets' ), 11 ); 14 14 } 15 15 16 16 /** 17 * Enqueue scripts and stylesheets 17 * Enqueue scripts and stylesheets common to all modules 18 18 */ 19 public function enqueue_assets( $hook ) { 20 global $post; 21 19 public function enqueue_common_assets() { 22 20 // todo setup grunt to concat/minify js and css? 23 24 // Register our assets25 wp_register_script(26 'payment-requests',27 plugins_url( 'javascript/payment-requests.js', __DIR__ ),28 array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ),29 self::VERSION,30 true31 );32 33 wp_register_script(34 'wcp-attached-files',35 plugins_url( 'javascript/attached-files.js', __DIR__ ),36 array( 'payment-requests', 'backbone', 'wp-util' ),37 self::VERSION,38 true39 );40 21 41 22 // Let's still include our .css file even if these are unavailable. … … 51 32 self::VERSION 52 33 ); 53 54 // Enqueue our assets if they're needed on the current screen55 $current_screen = get_current_screen();56 57 if ( in_array( $current_screen->id, array( 'edit-wcp_payment_request', 'wcp_payment_request' ) ) ) {58 wp_enqueue_script( 'payment-requests' );59 wp_enqueue_style( 'wordcamp-budgets' );60 61 if ( in_array( $current_screen->id, array( 'wcp_payment_request' ) ) && isset( $post->ID ) ) {62 wp_enqueue_media( array( 'post' => $post->ID ) );63 wp_enqueue_script( 'wcp-attached-files' );64 }65 66 wp_localize_script(67 'payment-requests',68 'wcpLocalizedStrings', // todo merge into wordcampBudgets var69 array(70 'uploadModalTitle' => __( 'Attach Supporting Documentation', 'wordcamporg' ),71 'uploadModalButton' => __( 'Attach Files', 'wordcamporg' ),72 )73 );74 }75 34 } 76 35
Note: See TracChangeset
for help on using the changeset viewer.