2015-06-05 20:17:55 +00:00
|
|
|
/**
|
2017-05-19 22:12:53 +00:00
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* All changes should be applied to ./modules/menu_ui/menu_ui.es6.js
|
|
|
|
* See the following change record for more information,
|
|
|
|
* https://www.drupal.org/node/2873849
|
|
|
|
* @preserve
|
|
|
|
**/
|
2015-06-05 20:17:55 +00:00
|
|
|
|
2016-02-29 03:25:57 +00:00
|
|
|
(function ($, Drupal) {
|
2009-04-11 22:19:46 +00:00
|
|
|
|
2015-10-13 22:37:56 +00:00
|
|
|
'use strict';
|
2012-05-08 02:57:33 +00:00
|
|
|
|
2014-04-13 19:04:02 +00:00
|
|
|
Drupal.behaviors.menuUiDetailsSummaries = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context) {
|
2014-01-27 21:41:32 +00:00
|
|
|
$(context).find('.menu-link-form').drupalSetSummary(function (context) {
|
|
|
|
var $context = $(context);
|
2015-09-20 16:57:36 +00:00
|
|
|
if ($context.find('.js-form-item-menu-enabled input').is(':checked')) {
|
|
|
|
return Drupal.checkPlain($context.find('.js-form-item-menu-title input').val());
|
2017-05-19 22:12:53 +00:00
|
|
|
} else {
|
2014-01-27 21:41:32 +00:00
|
|
|
return Drupal.t('Not in menu');
|
2010-11-05 19:47:20 +00:00
|
|
|
}
|
|
|
|
});
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-13 19:04:02 +00:00
|
|
|
Drupal.behaviors.menuUiLinkAutomaticTitle = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context) {
|
2014-01-27 21:41:32 +00:00
|
|
|
var $context = $(context);
|
|
|
|
$context.find('.menu-link-form').each(function () {
|
|
|
|
var $this = $(this);
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2015-09-20 16:57:36 +00:00
|
|
|
var $checkbox = $this.find('.js-form-item-menu-enabled input');
|
|
|
|
var $link_title = $context.find('.js-form-item-menu-title input');
|
|
|
|
var $title = $this.closest('form').find('.js-form-item-title-0-value input');
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
if (!($checkbox.length && $link_title.length && $title.length)) {
|
|
|
|
return;
|
|
|
|
}
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
if ($checkbox.is(':checked') && $link_title.val().length) {
|
2015-05-12 23:54:27 +00:00
|
|
|
$link_title.data('menuLinkAutomaticTitleOverridden', true);
|
2010-11-05 19:47:20 +00:00
|
|
|
}
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
$link_title.on('keyup', function () {
|
2015-05-12 23:54:27 +00:00
|
|
|
$link_title.data('menuLinkAutomaticTitleOverridden', true);
|
2014-01-27 21:41:32 +00:00
|
|
|
});
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
$checkbox.on('change', function () {
|
|
|
|
if ($checkbox.is(':checked')) {
|
2015-05-12 23:54:27 +00:00
|
|
|
if (!$link_title.data('menuLinkAutomaticTitleOverridden')) {
|
2014-01-27 21:41:32 +00:00
|
|
|
$link_title.val($title.val());
|
|
|
|
}
|
2017-05-19 22:12:53 +00:00
|
|
|
} else {
|
2014-01-27 21:41:32 +00:00
|
|
|
$link_title.val('');
|
2015-05-12 23:54:27 +00:00
|
|
|
$link_title.removeData('menuLinkAutomaticTitleOverridden');
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
|
|
|
$checkbox.closest('.vertical-tabs-pane').trigger('summaryUpdated');
|
|
|
|
$checkbox.trigger('formUpdated');
|
|
|
|
});
|
2017-05-19 22:12:53 +00:00
|
|
|
|
2014-01-27 21:41:32 +00:00
|
|
|
$title.on('keyup', function () {
|
2015-05-12 23:54:27 +00:00
|
|
|
if (!$link_title.data('menuLinkAutomaticTitleOverridden') && $checkbox.is(':checked')) {
|
2014-01-27 21:41:32 +00:00
|
|
|
$link_title.val($title.val());
|
|
|
|
$link_title.val($title.val()).trigger('formUpdated');
|
|
|
|
}
|
|
|
|
});
|
2010-11-05 19:47:20 +00:00
|
|
|
});
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
|
|
|
};
|
2017-05-19 22:12:53 +00:00
|
|
|
})(jQuery, Drupal);
|