merged feedback submodule
This commit is contained in:
59
sites/all/modules/contrib/users/feedback/feedback.js
Executable file
59
sites/all/modules/contrib/users/feedback/feedback.js
Executable file
@@ -0,0 +1,59 @@
|
||||
(function ($) {
|
||||
|
||||
/**
|
||||
* Attach collapse behavior to the feedback form block.
|
||||
*/
|
||||
Drupal.behaviors.feedbackForm = {
|
||||
attach: function (context) {
|
||||
$('#block-feedback-form', context).once('feedback', function () {
|
||||
var $block = $(this);
|
||||
$block.find('span.feedback-link')
|
||||
.prepend('<span id="feedback-form-toggle">[ + ]</span> ')
|
||||
.css('cursor', 'pointer')
|
||||
.toggle(function () {
|
||||
Drupal.feedbackFormToggle($block, false);
|
||||
},
|
||||
function() {
|
||||
Drupal.feedbackFormToggle($block, true);
|
||||
}
|
||||
);
|
||||
$block.find('form').hide();
|
||||
$block.show();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Re-collapse the feedback form after every successful form submission.
|
||||
*/
|
||||
Drupal.behaviors.feedbackFormSubmit = {
|
||||
attach: function (context) {
|
||||
var $context = $(context);
|
||||
if (!$context.is('#feedback-status-message')) {
|
||||
return;
|
||||
}
|
||||
// Collapse the form.
|
||||
$('#block-feedback-form .feedback-link').click();
|
||||
// Blend out and remove status message.
|
||||
window.setTimeout(function () {
|
||||
$context.fadeOut('slow', function () {
|
||||
$context.remove();
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Collapse or uncollapse the feedback form block.
|
||||
*/
|
||||
Drupal.feedbackFormToggle = function ($block, enable) {
|
||||
$block.find('form').slideToggle('medium');
|
||||
if (enable) {
|
||||
$('#feedback-form-toggle', $block).html('[ + ]');
|
||||
}
|
||||
else {
|
||||
$('#feedback-form-toggle', $block).html('[ − ]');
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
Reference in New Issue
Block a user