Skip to content
Snippets Groups Projects
Commit 0abd1bb2 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2452381 by lanchez, googletorp, PieterJanPut: Use Drupal.theme for progress.js

parent e3573a2a
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
(function ($) { (function ($, Drupal) {
"use strict"; "use strict";
/**
* Theme function for the progress bar.
*
* @return
* The HTML for the progress bar.
*/
Drupal.theme.progressBar = function (id) {
return '<div id="' + id + '" class="progress" aria-live="polite">' +
'<div class="progress__label">&nbsp;</div>' +
'<div class="progress__track"><div class="progress__bar"></div></div>' +
'<div class="progress__percentage"></div>' +
'<div class="progress__description">&nbsp;</div>' +
'</div>';
};
/** /**
* A progressbar object. Initialized with the given id. Must be inserted into * A progressbar object. Initialized with the given id. Must be inserted into
* the DOM afterwards through progressBar.element. * the DOM afterwards through progressBar.element.
...@@ -20,11 +35,7 @@ ...@@ -20,11 +35,7 @@
// The WAI-ARIA setting aria-live="polite" will announce changes after users // The WAI-ARIA setting aria-live="polite" will announce changes after users
// have completed their current activity and not interrupt the screen reader. // have completed their current activity and not interrupt the screen reader.
this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); this.element = $(Drupal.theme(id));
this.element.html('<div class="progress__label">&nbsp;</div>' +
'<div class="progress__track"><div class="progress__bar"></div></div>' +
'<div class="progress__percentage"></div>' +
'<div class="progress__description">&nbsp;</div>');
}; };
$.extend(Drupal.ProgressBar.prototype, { $.extend(Drupal.ProgressBar.prototype, {
...@@ -109,4 +120,4 @@ ...@@ -109,4 +120,4 @@
} }
}); });
})(jQuery); })(jQuery, Drupal);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment