Commit 2d22d73a authored by webchick's avatar webchick

Issue #2531698 by nod_, eiriksm: JSDoc views_ui module

parent 225c65b8
......@@ -8,11 +8,16 @@
"use strict";
/**
* Ajax command for highlighting elements.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {string} response.selector
* The selector in question.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsHighlight = function (ajax, response, status) {
$('.hilited').removeClass('hilited');
......@@ -20,11 +25,16 @@
};
/**
* Ajax command to show certain buttons in the views edit form.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {bool} response.changed
* Whether the state changed for the buttons or not.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsShowButtons = function (ajax, response, status) {
$('div.views-edit-view div.form-actions').removeClass('js-hide');
......@@ -34,10 +44,14 @@
};
/**
* Ajax command for triggering preview.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} [response]
* The Ajax response.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsTriggerPreview = function (ajax, response, status) {
if ($('input#edit-displays-live-preview').is(':checked')) {
......@@ -46,12 +60,18 @@
};
/**
* Ajax command to replace the title of a page.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {string} response.siteName
* The site name.
* @param {string} response.title
* The new page title.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsReplaceTitle = function (ajax, response, status) {
var doc = document;
......@@ -72,6 +92,7 @@
* Get rid of irritating tabledrag messages.
*
* @return {Array}
* An array of messages. Always empty array, to get rid of the messages.
*/
Drupal.theme.tableDragChangedWarning = function () {
return [];
......@@ -81,6 +102,10 @@
* Trigger preview when the "live preview" checkbox is checked.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to trigger live preview if the live preview option is
* checked.
*/
Drupal.behaviors.livePreview = {
attach: function (context) {
......@@ -96,6 +121,9 @@
* Sync preview display.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to sync the preview display when needed.
*/
Drupal.behaviors.syncPreviewDisplay = {
attach: function (context) {
......@@ -110,8 +138,12 @@
};
/**
* Ajax behaviors for the views_ui module.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches ajax behaviors to the elements with the classes in question.
*/
Drupal.behaviors.viewsAjax = {
collapseReplaced: false,
......
......@@ -31,8 +31,14 @@
}
/**
* Functionality for views modals.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches modal functionality for views.
* @prop {Drupal~behaviorDetach} detach
* Detaches the modal functionality.
*/
Drupal.behaviors.viewsModalContent = {
attach: function (context) {
......
......@@ -16,6 +16,9 @@
* Improve the user experience of the views edit interface.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches toggling of SQL rewrite warning on the corresponding checkbox.
*/
Drupal.behaviors.viewsUiEditView = {
attach: function () {
......@@ -32,6 +35,10 @@
* as page title and menu link.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior for prepopulating page title and menu links, based on
* view name.
*/
Drupal.behaviors.viewsUiAddView = {
attach: function (context) {
......@@ -142,14 +149,18 @@
var self = this;
/**
* Populate the target form field with the altered source field value.
*
* @return {*}
* The result of the _populate call, which should be undefined.
*/
this.populate = function () { return self._populate.call(self); };
/**
* Stop prepopulating the form fields.
*
* @return {*}
* The result of the _unbind call, which should be undefined.
*/
this.unbind = function () { return self._unbind.call(self); };
......@@ -174,6 +185,7 @@
* Get the source form field value as altered by the passed-in parameters.
*
* @return {string}
* The source form field value.
*/
getTransliterated: function () {
var from = this.source.val();
......@@ -208,6 +220,7 @@
* Bind event handlers to new form fields, after they're replaced via Ajax.
*
* @param {jQuery} $fields
* Fields to rebind functionality to.
*/
rebind: function ($fields) {
this.target = $fields;
......@@ -216,8 +229,13 @@
});
/**
* Adds functionality for the add item form.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the functionality in {@link Drupal.viewsUi.AddItemForm} to the
* forms in question.
*/
Drupal.behaviors.addItemForm = {
attach: function (context) {
......@@ -236,10 +254,12 @@
};
/**
* Constructs a new AddItemForm.
*
* @constructor
*
* @param {jQuery} $form
* The form element used.
*/
Drupal.viewsUi.AddItemForm = function ($form) {
......@@ -264,8 +284,10 @@
};
/**
* Handles a checkbox check.
*
* @param {jQuery.Event} event
* The event triggered.
*/
Drupal.viewsUi.AddItemForm.prototype.handleCheck = function (event) {
var $target = $(event.target);
......@@ -311,6 +333,9 @@
* tabs.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Fixes the input elements needed.
*/
Drupal.behaviors.viewsUiRenderAddViewButton = {
attach: function (context) {
......@@ -359,7 +384,10 @@
};
/**
* Toggle menu visibility.
*
* @param {jQuery} $trigger
* The element where the toggle was triggered.
*
*
* @note [@jessebeach] I feel like the following should be a more generic
......@@ -372,8 +400,13 @@
};
/**
* Add search options to the views ui.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches {@link Drupal.viewsUi.OptionsSearch} to the views ui filter
* options.
*/
Drupal.behaviors.viewsUiSearchOptions = {
attach: function (context) {
......@@ -400,6 +433,7 @@
* @constructor
*
* @param {jQuery} $form
* The form element.
*/
Drupal.viewsUi.OptionsSearch = function ($form) {
......@@ -441,6 +475,7 @@
* shown and hidden depending on the user's search terms.
*
* @return {Array}
* An array of all the filterable options.
*/
getOptions: function ($allOptions) {
var $label;
......@@ -469,6 +504,7 @@
* options.
*
* @param {jQuery.Event} event
* The keyup event.
*/
handleKeyup: function (event) {
var found;
......@@ -514,8 +550,12 @@
});
/**
* Preview functionality in the views edit form.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the preview functionality to the view edit form.
*/
Drupal.behaviors.viewsUiPreview = {
attach: function (context) {
......@@ -544,8 +584,14 @@
};
/**
* Rearranges the filters.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attach handlers to make it possible to rearange the filters in the form
* in question.
* @see Drupal.viewsUi.RearrangeFilterHandler
*/
Drupal.behaviors.viewsUiRearrangeFilter = {
attach: function (context) {
......@@ -568,7 +614,9 @@
* @constructor
*
* @param {jQuery} $table
* The table in the filter form.
* @param {jQuery} $operator
* The filter groups operator element.
*/
Drupal.viewsUi.RearrangeFilterHandler = function ($table, $operator) {
......@@ -688,6 +736,7 @@
* Dynamically click the button that adds a new filter group.
*
* @param {jQuery.Event} event
* The event triggered.
*/
clickAddGroupButton: function (event) {
// Due to conflicts between Drupal core's AJAX system and the Views AJAX
......@@ -716,6 +765,7 @@
* duplicate it between any subsequent groups.
*
* @return {jQuery}
* An operator element.
*/
duplicateGroupsOperator: function () {
var dropdowns;
......@@ -778,6 +828,7 @@
* Forces all operator dropdowns to have the same value.
*
* @param {jQuery.Event} event
* The event triggered.
*/
operatorChangeHandler: function (event) {
var $target = $(event.target);
......@@ -804,15 +855,13 @@
* - The operator cells that span multiple rows need their rowspan
* attributes updated to reflect the number of rows in each group.
* - The operator labels that are displayed next to each filter need to
* be
* redrawn, to account for the row's new location.
* be redrawn, to account for the row's new location.
*/
tableDrag.row.prototype.onSwap = function () {
if (filterHandler.hasGroupOperator) {
// Make sure the row that just got moved (this.group) is inside one
// of
// the filter groups (i.e. below an empty marker row or a draggable).
// If it isn't, move it down one.
// of the filter groups (i.e. below an empty marker row or a
// draggable). If it isn't, move it down one.
var thisRow = $(this.group);
var previousRow = thisRow.prev('tr');
if (previousRow.length && !previousRow.hasClass('group-message') && !previousRow.hasClass('draggable')) {
......@@ -947,6 +996,9 @@
* Add a select all checkbox, which checks each checkbox at once.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches select all functionality to the views filter form.
*/
Drupal.behaviors.viewsFilterConfigSelectAll = {
attach: function (context) {
......@@ -978,6 +1030,9 @@
* Remove icon class from elements that are themed as buttons or dropbuttons.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Removes the icon class from certain views elements.
*/
Drupal.behaviors.viewsRemoveIconClass = {
attach: function (context) {
......@@ -989,6 +1044,9 @@
* Change "Expose filter" buttons into checkboxes.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Changes buttons into checkboxes via {@link Drupal.viewsUi.Checkboxifier}.
*/
Drupal.behaviors.viewsUiCheckboxify = {
attach: function (context, settings) {
......@@ -1006,6 +1064,9 @@
* selected widget for the exposed group.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Changes the default widget based on user input.
*/
Drupal.behaviors.viewsUiChangeDefaultWidget = {
attach: function (context) {
......@@ -1056,6 +1117,7 @@
* When the checkbox is checked or unchecked, simulate a button press.
*
* @param {jQuery.Event} e
* The event triggered.
*/
Drupal.viewsUi.Checkboxifier.prototype.clickHandler = function (e) {
this.$button
......@@ -1067,6 +1129,10 @@
* Change the Apply button text based upon the override select state.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to change the Apply button according to the current
* state.
*/
Drupal.behaviors.viewsUiOverrideSelect = {
attach: function (context) {
......@@ -1103,8 +1169,12 @@
};
/**
* Functionality for the remove link in the views UI.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior for the remove view and remove display links.
*/
Drupal.behaviors.viewsUiHandlerRemoveLink = {
attach: function (context) {
......
......@@ -15,6 +15,9 @@
* Source text: .views-table-filter-text-source
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the filter functionality to the views admin text search field.
*/
Drupal.behaviors.viewTableFilterByText = {
attach: function (context, settings) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment