Changeset 2277
- Timestamp:
- 01/12/2016 04:36:29 PM (9 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php
r2274 r2277 12 12 add_action( 'init', array( __CLASS__, 'register_post_statuses' ) ); 13 13 add_action( 'add_meta_boxes', array( $this, 'init_meta_boxes' ) ); 14 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ), 11 ); 14 15 15 16 // Miscellaneous … … 169 170 add_meta_box( 'wcp_log', __( 'Log', 'wordcamporg' ), array( $this, 'render_log_metabox' ), 170 171 self::POST_TYPE, 'normal', 'high' ); 172 } 173 174 /** 175 * Enqueue scripts and stylesheets 176 */ 177 public function enqueue_assets() { 178 global $post; 179 180 // Register our assets 181 wp_register_script( 182 'payment-requests', 183 plugins_url( 'javascript/payment-requests.js', __DIR__ ), 184 array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ), 185 WordCamp_Budgets::VERSION, 186 true 187 ); 188 189 wp_register_script( 190 'wcp-attached-files', 191 plugins_url( 'javascript/attached-files.js', __DIR__ ), 192 array( 'payment-requests', 'backbone', 'wp-util' ), 193 WordCamp_Budgets::VERSION, 194 true 195 ); 196 197 // Enqueue our assets if they're needed on the current screen 198 $current_screen = get_current_screen(); 199 200 if ( 'wcp_payment_request' !== $current_screen->id ) { 201 return; 202 } 203 204 wp_enqueue_script( 'payment-requests' ); 205 wp_enqueue_style( 'wordcamp-budgets' ); 206 207 if ( isset( $post->ID ) ) { 208 wp_enqueue_media( array( 'post' => $post->ID ) ); 209 wp_enqueue_script( 'wcp-attached-files' ); 210 } 211 212 wp_localize_script( 213 'payment-requests', 214 'wcpLocalizedStrings', // todo merge into paymentRequests var 215 array( 216 'uploadModalTitle' => __( 'Attach Supporting Documentation', 'wordcamporg' ), 217 'uploadModalButton' => __( 'Attach Files', 'wordcamporg' ), 218 ) 219 ); 171 220 } 172 221 -
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.