Commit 267a86ae authored by webchick's avatar webchick

Issue #2531694 by eiriksm, nod_, dawehner: JSDoc views module

parent 2d22d73a
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
"use strict"; "use strict";
/** /**
* Attaches the AJAX behavior to Views exposed filter forms and key View * Attaches the AJAX behavior to exposed filters forms and key View links.
* links.
* *
* @type {Drupal~behavior} * @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches ajaxView functionality to relevant elements.
*/ */
Drupal.behaviors.ViewsAjaxView = {}; Drupal.behaviors.ViewsAjaxView = {};
Drupal.behaviors.ViewsAjaxView.attach = function () { Drupal.behaviors.ViewsAjaxView.attach = function () {
...@@ -41,7 +43,9 @@ ...@@ -41,7 +43,9 @@
* @constructor * @constructor
* *
* @param {object} settings * @param {object} settings
* Settings object for the ajax view.
* @param {string} settings.view_dom_id * @param {string} settings.view_dom_id
* The DOM id of the view.
*/ */
Drupal.views.ajaxView = function (settings) { Drupal.views.ajaxView = function (settings) {
var selector = '.js-view-dom-id-' + settings.view_dom_id; var selector = '.js-view-dom-id-' + settings.view_dom_id;
...@@ -142,8 +146,10 @@ ...@@ -142,8 +146,10 @@
/** /**
* Attach the ajax behavior to a singe link. * Attach the ajax behavior to a singe link.
* *
* @param {string} id * @param {string} [id]
* The ID of the link.
* @param {HTMLElement} link * @param {HTMLElement} link
* The link element.
*/ */
Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function (id, link) { Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function (id, link) {
var $link = $(link); var $link = $(link);
...@@ -168,10 +174,14 @@ ...@@ -168,10 +174,14 @@
}; };
/** /**
* Views scroll to top ajax command.
* *
* @param {Drupal.Ajax} [ajax] * @param {Drupal.Ajax} [ajax]
* A {@link Drupal.ajax} object.
* @param {object} response * @param {object} response
* Ajax response.
* @param {string} response.selector * @param {string} response.selector
* Selector to use.
*/ */
Drupal.AjaxCommands.prototype.viewsScrollTop = function (ajax, response) { Drupal.AjaxCommands.prototype.viewsScrollTop = function (ajax, response) {
// Scroll to the top of the view. This will allow users // Scroll to the top of the view. This will allow users
......
...@@ -16,8 +16,10 @@ ...@@ -16,8 +16,10 @@
* Helper function to parse a querystring. * Helper function to parse a querystring.
* *
* @param {string} query * @param {string} query
* The querystring to parse.
* *
* @return {object} * @return {object}
* A map of query parameters.
*/ */
Drupal.Views.parseQueryString = function (query) { Drupal.Views.parseQueryString = function (query) {
var args = {}; var args = {};
...@@ -41,9 +43,12 @@ ...@@ -41,9 +43,12 @@
* Helper function to return a view's arguments based on a path. * Helper function to return a view's arguments based on a path.
* *
* @param {string} href * @param {string} href
* The href to check.
* @param {string} viewPath * @param {string} viewPath
* The views path to check.
* *
* @return {object} * @return {object}
* An object containing `view_args` and `view_path`.
*/ */
Drupal.Views.parseViewArgs = function (href, viewPath) { Drupal.Views.parseViewArgs = function (href, viewPath) {
var returnObj = {}; var returnObj = {};
...@@ -61,8 +66,10 @@ ...@@ -61,8 +66,10 @@
* Strip off the protocol plus domain from an href. * Strip off the protocol plus domain from an href.
* *
* @param {string} href * @param {string} href
* The href to strip.
* *
* @return {string} * @return {string}
* The href without the protocol and domain.
*/ */
Drupal.Views.pathPortion = function (href) { Drupal.Views.pathPortion = function (href) {
// Remove e.g. http://example.com if present. // Remove e.g. http://example.com if present.
...@@ -78,8 +85,10 @@ ...@@ -78,8 +85,10 @@
* Return the Drupal path portion of an href. * Return the Drupal path portion of an href.
* *
* @param {string} href * @param {string} href
* The href to check.
* *
* @return {string} * @return {string}
* An internal path.
*/ */
Drupal.Views.getPath = function (href) { Drupal.Views.getPath = function (href) {
href = Drupal.Views.pathPortion(href); href = Drupal.Views.pathPortion(href);
......
...@@ -8,8 +8,12 @@ ...@@ -8,8 +8,12 @@
"use strict"; "use strict";
/** /**
* Attaches contextual region classes to views elements.
* *
* @type {Drupal~behavior} * @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Adds class `contextual-region` to views elements.
*/ */
Drupal.behaviors.viewsContextualLinks = { Drupal.behaviors.viewsContextualLinks = {
attach: function (context) { attach: function (context) {
......
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