mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-06 01:31:22 +02:00
28 lines
608 B
JavaScript
28 lines
608 B
JavaScript
(function($) {
|
|
$.entwine('ss', function($) {
|
|
/**
|
|
* Takes form fields with a title attribute, extracts it, and displays
|
|
* it as inline help text below the field.
|
|
*/
|
|
$(".cms form .field .middleColumn > [title]").entwine({
|
|
onmatch: function() {
|
|
|
|
var title = this.prop("title");
|
|
var field = this.closest(".field");
|
|
|
|
if(title && title.length && field.has('.help').length == 0) {
|
|
var span = $("<span></span>", {
|
|
"class": "help",
|
|
"html": title
|
|
});
|
|
|
|
field.append(span);
|
|
this.removeProp("title");
|
|
}
|
|
|
|
this._super();
|
|
}
|
|
});
|
|
});
|
|
}(jQuery));
|