Commit 267a86ae authored by webchick's avatar webchick

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

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