Skip to content
Snippets Groups Projects
Commit 34078b72 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2058843 by rteijeiro, jessebeach: Be consistent with respect to which...

Issue #2058843 by rteijeiro, jessebeach: Be consistent with respect to which strings within JS code should be overriddable via drupalSettings.
parent 79b57a95
No related branches found
No related tags found
No related merge requests found
......@@ -7,12 +7,15 @@
"use strict";
var options = $.extend({
strings: {
open: Drupal.t('open'),
close: Drupal.t('close')
var options = $.extend(drupalSettings.contextual,
// Merge strings on top of drupalSettings so that they are not mutable.
{
strings: {
open: Drupal.t('Open'),
close: Drupal.t('Close')
}
}
}, drupalSettings.contextual);
);
/**
* Initializes a contextual link: updates its DOM, sets up model and views
......
......@@ -7,12 +7,10 @@
"use strict";
var options = {
strings: {
tabbingReleased: Drupal.t('Tabbing is no longer constrained by the Contextual module.'),
tabbingConstrained: Drupal.t('Tabbing is constrained to a set of @contextualsCount and the edit mode toggle.'),
pressEsc: Drupal.t('Press the esc key to exit.')
}
var strings = {
tabbingReleased: Drupal.t('Tabbing is no longer constrained by the Contextual module.'),
tabbingConstrained: Drupal.t('Tabbing is constrained to a set of @contextualsCount and the edit mode toggle.'),
pressEsc: Drupal.t('Press the esc key to exit.')
};
/**
......@@ -25,10 +23,11 @@ function initContextualToolbar (context) {
var contextualToolbar = Drupal.contextualToolbar;
var model = contextualToolbar.model = new contextualToolbar.Model();
var viewOptions = $.extend({
var viewOptions = {
el: $('.toolbar .toolbar-bar .contextual-toolbar-tab'),
model: model
}, options);
model: model,
strings: strings
};
new contextualToolbar.VisualView(viewOptions);
new contextualToolbar.AuralView(viewOptions);
......
......@@ -20,11 +20,14 @@
"use strict";
var options = $.extend({
strings: {
quickEdit: Drupal.t('Quick edit')
var options = $.extend(drupalSettings.edit,
// Merge strings on top of drupalSettings so that they are not mutable.
{
strings: {
quickEdit: Drupal.t('Quick edit')
}
}
}, drupalSettings.edit);
);
/**
* Tracks fields without metadata. Contains objects with the following keys:
......
......@@ -8,17 +8,23 @@
"use strict";
// Merge run-time settings with the defaults.
var options = $.extend({
breakpoints: {
'module.toolbar.narrow': '',
'module.toolbar.standard': '',
'module.toolbar.wide': ''
var options = $.extend(
{
breakpoints: {
'module.toolbar.narrow': '',
'module.toolbar.standard': '',
'module.toolbar.wide': ''
},
},
strings: {
horizontal: Drupal.t('Horizontal orientation'),
vertical: Drupal.t('Vertical orientation')
drupalSettings.toolbar,
// Merge strings on top of drupalSettings so that they are not mutable.
{
strings: {
horizontal: Drupal.t('Horizontal orientation'),
vertical: Drupal.t('Vertical orientation')
}
}
}, drupalSettings.toolbar);
);
/**
* Registers tabs with the toolbar.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment