mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-30 05:09:06 +02:00
MINOR Rendering DateField instances with button by default in CMS
This commit is contained in:
parent
f0c94696c9
commit
9a595fbd25
@ -236,6 +236,9 @@ class LeftAndMain extends Controller {
|
|||||||
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js');
|
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js');
|
||||||
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js');
|
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js');
|
||||||
|
|
||||||
|
// Handled by LeftAndMain.js
|
||||||
|
Requirements::block(SAPPHIRE_DIR . '/javascript/DateField.js');
|
||||||
|
|
||||||
Requirements::themedCSS('typography');
|
Requirements::themedCSS('typography');
|
||||||
|
|
||||||
foreach (self::$extra_requirements['javascript'] as $file) {
|
foreach (self::$extra_requirements['javascript'] as $file) {
|
||||||
|
@ -276,6 +276,29 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duplicates functionality in DateField.js, but due to using entwine we can match
|
||||||
|
* the DOM element on creation, rather than onclick - which allows us to decorate
|
||||||
|
* the field with a calendar icon
|
||||||
|
*/
|
||||||
|
$('.LeftAndMain .field.date input.text').entwine({
|
||||||
|
onmatch: function() {
|
||||||
|
var holder = $(this).parents('.field.date:first'), config = holder.metadata({type: 'class'});
|
||||||
|
if(!config.showcalendar) return;
|
||||||
|
|
||||||
|
config.showOn = 'button';
|
||||||
|
if(config.locale && $.datepicker.regional[config.locale]) {
|
||||||
|
config = $.extend(config, $.datepicker.regional[config.locale], {});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).datepicker(config);
|
||||||
|
// // Unfortunately jQuery UI only allows configuration of icon images, not sprites
|
||||||
|
// this.next('button').button('option', 'icons', {primary : 'ui-icon-calendar'});
|
||||||
|
|
||||||
|
this._super();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user