1 |
85ad3d82
|
Assos Assos
|
(function ($) {
|
2 |
|
|
|
3 |
|
|
Drupal.behaviors.menuFieldsetSummaries = {
|
4 |
|
|
attach: function (context) {
|
5 |
|
|
$('fieldset.menu-link-form', context).drupalSetSummary(function (context) {
|
6 |
|
|
if ($('.form-item-menu-enabled input', context).is(':checked')) {
|
7 |
|
|
return Drupal.checkPlain($('.form-item-menu-link-title input', context).val());
|
8 |
|
|
}
|
9 |
|
|
else {
|
10 |
|
|
return Drupal.t('Not in menu');
|
11 |
|
|
}
|
12 |
|
|
});
|
13 |
|
|
}
|
14 |
|
|
};
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
Drupal.behaviors.menuLinkAutomaticTitle = {
|
20 |
|
|
attach: function (context) {
|
21 |
|
|
$('fieldset.menu-link-form', context).each(function () {
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
var $checkbox = $('.form-item-menu-enabled input', this);
|
25 |
|
|
var $link_title = $('.form-item-menu-link-title input', context);
|
26 |
|
|
var $title = $(this).closest('form').find('.form-item-title input');
|
27 |
|
|
|
28 |
|
|
if (!($checkbox.length && $link_title.length && $title.length)) {
|
29 |
|
|
return;
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
if ($checkbox.is(':checked') && $link_title.val().length) {
|
34 |
|
|
$link_title.data('menuLinkAutomaticTitleOveridden', true);
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
$link_title.keyup(function () {
|
38 |
|
|
$link_title.data('menuLinkAutomaticTitleOveridden', true);
|
39 |
|
|
});
|
40 |
|
|
|
41 |
|
|
$checkbox.change(function () {
|
42 |
|
|
if ($checkbox.is(':checked')) {
|
43 |
|
|
if (!$link_title.data('menuLinkAutomaticTitleOveridden')) {
|
44 |
|
|
$link_title.val($title.val());
|
45 |
|
|
}
|
46 |
|
|
}
|
47 |
|
|
else {
|
48 |
|
|
$link_title.val('');
|
49 |
|
|
$link_title.removeData('menuLinkAutomaticTitleOveridden');
|
50 |
|
|
}
|
51 |
|
|
$checkbox.closest('fieldset.vertical-tabs-pane').trigger('summaryUpdated');
|
52 |
|
|
$checkbox.trigger('formUpdated');
|
53 |
|
|
});
|
54 |
|
|
|
55 |
|
|
$title.keyup(function () {
|
56 |
|
|
if (!$link_title.data('menuLinkAutomaticTitleOveridden') && $checkbox.is(':checked')) {
|
57 |
|
|
$link_title.val($title.val());
|
58 |
|
|
$link_title.val($title.val()).trigger('formUpdated');
|
59 |
|
|
}
|
60 |
|
|
});
|
61 |
|
|
});
|
62 |
|
|
}
|
63 |
|
|
};
|
64 |
|
|
|
65 |
|
|
})(jQuery); |