mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Generic .cms-help-toggle implementation to replace MemberDatetimeOptionsetField.js (which also didn't work when loaded via Ajax, and needed a rewrite to jQuery.entwine anyway)
This commit is contained in:
parent
851099d82d
commit
8da89c6f7c
@ -428,6 +428,23 @@ jQuery.noConflict();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Simple toggle link, which points to a DOm element by its ID selector
|
||||
* in the href attribute (which doubles as an anchor link to that element).
|
||||
*/
|
||||
$('.cms .cms-help-toggle').entwine({
|
||||
onmatch: function() {
|
||||
this._super();
|
||||
|
||||
$(this.attr('href')).hide();
|
||||
},
|
||||
onclick: function(e) {
|
||||
$(this.attr('href')).toggle();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
|
||||
var statusMessage = function(text, type) {
|
||||
|
@ -6,9 +6,6 @@
|
||||
class MemberDatetimeOptionsetField extends OptionsetField {
|
||||
|
||||
function Field() {
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/thirdparty/jquery/jquery.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/MemberDatetimeOptionsetField.js');
|
||||
|
||||
$options = '';
|
||||
$odd = 0;
|
||||
$source = $this->getSource();
|
||||
@ -45,8 +42,12 @@ class MemberDatetimeOptionsetField extends OptionsetField {
|
||||
_t('MemberDatetimeOptionsetField.Preview', 'Preview'),
|
||||
Zend_Date::now()->toString($value)
|
||||
) : '';
|
||||
$options .= "<a class=\"formattingHelpToggle\" href=\"#\">" . _t('MemberDatetimeOptionsetField.TOGGLEHELP', 'Toggle formatting help') . "</a>";
|
||||
$options .= "<div class=\"formattingHelpText\">";
|
||||
$options .= sprintf(
|
||||
'<a class="cms-help-toggle" href="#%s">%s</a>',
|
||||
$this->id() . '_Help',
|
||||
_t('MemberDatetimeOptionsetField.TOGGLEHELP', 'Toggle formatting help')
|
||||
);
|
||||
$options .= "<div id=\"" . $this->id() . "_Help\">";
|
||||
$options .= $this->getFormattingHelpText();
|
||||
$options .= "</div>";
|
||||
$options .= "</li>\n";
|
||||
|
@ -1,7 +0,0 @@
|
||||
(function($) {
|
||||
$('.formattingHelpText').hide();
|
||||
$('.formattingHelpToggle').click(function() {
|
||||
$(this).parent().find('.formattingHelpText').toggle();
|
||||
return false;
|
||||
})
|
||||
})(jQuery);
|
Loading…
Reference in New Issue
Block a user