From 0e9a2040960d9d390c3255be7261600d371ebb9e Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Thu, 14 Aug 2014 20:55:29 -0700 Subject: [PATCH 1/3] Correct inaccurate usage jQueryUI CSS instructions Fixes #5 --- readme.md | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 5ba5be8..ce9a9aa 100644 --- a/readme.md +++ b/readme.md @@ -21,7 +21,7 @@ This project includes CSS/LESS/Sass for the following prepackaged WordPress admi ###Initial Setup -Be sure to enqueue WordPress' prepackaged jQuery UI CSS file using ````wp_enqueue_style( 'jquery-ui' )```` and the related javascript files using ````wp_enqueue_script( 'jquery' )```` and ````wp_enqueue_script( 'jquery-ui-datepicker' )````. +Be sure to enqueue [the jQuery UI base CSS file](https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.min.css) with your own ````wp_enqueue_style()```` call, and the related javascript files using ````wp_enqueue_script( 'jquery' )```` and ````wp_enqueue_script( 'jquery-ui-datepicker' )````. Help with configuring jQuery UI's Datepicker can be found at http://jqueryui.com/datepicker/. @@ -29,6 +29,48 @@ Help with configuring jQuery UI's Datepicker can be found at http://jqueryui.com To include the WP jQuery Datepicker stylesheet, simply copy the CSS file located at ````css/datepicker.css```` to your project and enqueue it using the ````admin_enqueue_scripts```` WordPress action hook. + +###Complete Example + +```php +function myplugin_enqueue_scripts() { + wp_register_script( + 'myplugin-js', + plugins_url( 'javascript/myplugin.js', __FILE__ ), + array( 'jquery', 'jquery-ui-datepicker' ), + $myplugin_version, + true + ); + + // Can remove this when #18909-core is committed + wp_register_style( + 'jquery-ui', + plugins_url( 'css/jquery-ui.min.css', __FILE__ ), + array(), + '1.11.1' + ); + + // https://github.com/x-team/wp-jquery-ui-datepicker-skins + wp_register_style( + 'wp-datepicker-skins', + plugins_url( 'css/datepicker.css', __FILE__ ), + array( 'jquery-ui' ), + '1712f05a1c6a76ef0ac0b0a9bf79224e52e461ab' + ); + + wp_register_style( + 'myplugin-css', + plugins_url( 'css/myplugin.css', __FILE__ ), + array( 'wp-datepicker-skins' ), + $myplugin_version + ); + + wp_enqueue_script( 'myplugin-js' ); + wp_enqueue_style( 'myplugin-css' ); +} +add_action( 'admin_enqueue_scripts', 'myplugin_enqueue_scripts' ); +``` + ###Generating Custom LESS Styles 1. Copy and rename one of the .less files in ````less/schemes/```` (e.g., blue.less). From a5afbe55aa6e61ce46626e3c5c10215c2d4cee05 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Fri, 7 Nov 2014 10:54:42 -0800 Subject: [PATCH 2/3] Style the optional year and month dropdowns. * Remove the border * Add some spacing in-between them --- css/datepicker.css | 5 +++++ less/datepicker.less | 6 ++++++ sass/datepicker.scss | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/css/datepicker.css b/css/datepicker.css index e7119e5..f3a4271 100644 --- a/css/datepicker.css +++ b/css/datepicker.css @@ -66,6 +66,11 @@ .ui-datepicker .ui-datepicker-prev span { background-position: -96px 0; } +.ui-datepicker select.ui-datepicker-year, +.ui-datepicker select.ui-datepicker-month { + border: none; + margin-left: 6px; +} .ui-datepicker th { padding: 0.75em 0; color: #fff; diff --git a/less/datepicker.less b/less/datepicker.less index ebe3ac0..747acb3 100644 --- a/less/datepicker.less +++ b/less/datepicker.less @@ -77,6 +77,12 @@ background-position: -96px 0; } + select.ui-datepicker-year, + select.ui-datepicker-month { + border: none; + margin-left: 6px; + } + th { padding: 0.75em 0; color: #fff; diff --git a/sass/datepicker.scss b/sass/datepicker.scss index 685c20c..7258ea9 100644 --- a/sass/datepicker.scss +++ b/sass/datepicker.scss @@ -77,6 +77,12 @@ background-position: -96px 0; } + select.ui-datepicker-year, + select.ui-datepicker-month { + border: none; + margin-left: 6px; + } + th { padding: 0.75em 0; color: #fff; From a2f5396f0e332ea694b1445d122248e432e6a2b6 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Fri, 7 Nov 2014 10:58:03 -0800 Subject: [PATCH 3/3] Revert "Style the optional year and month dropdowns." This reverts commit a5afbe55aa6e61ce46626e3c5c10215c2d4cee05. That should have been done against a branch. --- css/datepicker.css | 5 ----- less/datepicker.less | 6 ------ sass/datepicker.scss | 6 ------ 3 files changed, 17 deletions(-) diff --git a/css/datepicker.css b/css/datepicker.css index f3a4271..e7119e5 100644 --- a/css/datepicker.css +++ b/css/datepicker.css @@ -66,11 +66,6 @@ .ui-datepicker .ui-datepicker-prev span { background-position: -96px 0; } -.ui-datepicker select.ui-datepicker-year, -.ui-datepicker select.ui-datepicker-month { - border: none; - margin-left: 6px; -} .ui-datepicker th { padding: 0.75em 0; color: #fff; diff --git a/less/datepicker.less b/less/datepicker.less index 747acb3..ebe3ac0 100644 --- a/less/datepicker.less +++ b/less/datepicker.less @@ -77,12 +77,6 @@ background-position: -96px 0; } - select.ui-datepicker-year, - select.ui-datepicker-month { - border: none; - margin-left: 6px; - } - th { padding: 0.75em 0; color: #fff; diff --git a/sass/datepicker.scss b/sass/datepicker.scss index 7258ea9..685c20c 100644 --- a/sass/datepicker.scss +++ b/sass/datepicker.scss @@ -77,12 +77,6 @@ background-position: -96px 0; } - select.ui-datepicker-year, - select.ui-datepicker-month { - border: none; - margin-left: 6px; - } - th { padding: 0.75em 0; color: #fff;