first import
This commit is contained in:
61
sites/all/modules/search_api/search_api.admin.js
Normal file
61
sites/all/modules/search_api/search_api.admin.js
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
// Copied from filter.admin.js
|
||||
(function ($) {
|
||||
|
||||
Drupal.behaviors.searchApiStatus = {
|
||||
attach: function (context, settings) {
|
||||
$('.search-api-status-wrapper input.form-checkbox', context).once('search-api-status', function () {
|
||||
var $checkbox = $(this);
|
||||
// Retrieve the tabledrag row belonging to this processor.
|
||||
var $row = $('#' + $checkbox.attr('id').replace(/-status$/, '-weight'), context).closest('tr');
|
||||
// Retrieve the vertical tab belonging to this processor.
|
||||
var $tab = $('#' + $checkbox.attr('id').replace(/-status$/, '-settings'), context).data('verticalTab');
|
||||
|
||||
// Bind click handler to this checkbox to conditionally show and hide the
|
||||
// filter's tableDrag row and vertical tab pane.
|
||||
$checkbox.bind('click.searchApiUpdate', function () {
|
||||
if ($checkbox.is(':checked')) {
|
||||
$row.show();
|
||||
if ($tab) {
|
||||
$tab.tabShow().updateSummary();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$row.hide();
|
||||
if ($tab) {
|
||||
$tab.tabHide().updateSummary();
|
||||
}
|
||||
}
|
||||
// Restripe table after toggling visibility of table row.
|
||||
Drupal.tableDrag['search-api-' + $checkbox.attr('id').replace(/^edit-([^-]+)-.*$/, '$1') + '-order-table'].restripeTable();
|
||||
});
|
||||
|
||||
// Attach summary for configurable items (only for screen-readers).
|
||||
if ($tab) {
|
||||
$tab.fieldset.drupalSetSummary(function (tabContext) {
|
||||
return $checkbox.is(':checked') ? Drupal.t('Enabled') : Drupal.t('Disabled');
|
||||
});
|
||||
}
|
||||
|
||||
// Trigger our bound click handler to update elements to initial state.
|
||||
$checkbox.triggerHandler('click.searchApiUpdate');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Drupal.behaviors.searchApiEditMenu = {
|
||||
attach: function (context, settings) {
|
||||
$('.search-api-edit-menu-toggle', context).click(function (e) {
|
||||
$menu = $(this).parent().find('.search-api-edit-menu');
|
||||
if ($menu.is('.collapsed')) {
|
||||
$menu.removeClass('collapsed');
|
||||
}
|
||||
else {
|
||||
$menu.addClass('collapsed');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user