Skip to content

Commit 0ed05d7

Browse files
committed
Improve targeting of sidebar edit js.
1 parent 730c7da commit 0ed05d7

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

dist/js/edit_form.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ var $;
22

33
$ = jQuery, Backdrop.behaviors.ginEditForm = {
44
attach: function(context, settings) {
5+
const hideLabel = Backdrop.t("Hide sidebar panel");
56
$(".node-form").once("gin-edit-form").each((function() {
6-
$("> div", this).addClass("layout-region-node-main"), $(this).append('<div id="gin_sidebar" class="layout-region-node-secondary"></div>'),
7-
$(".layout-region-node-secondary").append($(".node-edit-settings")), $(".block-page-title-block").append($(".form-actions"));
8-
const hideLabel = Backdrop.t("Hide sidebar panel");
9-
$(".form-actions").prepend('<a href="#toggle-sidebar" class="meta-sidebar__trigger trigger" role="button" title="' + hideLabel + '" aria-controls="gin_sidebar"><span class="visually-hidden">' + hideLabel + "</span></a>"),
10-
$(".form-actions input").attr("form", $(this).attr("id"));
7+
$("> div:first-child", this).addClass("layout-region-node-main"), $("> .layout-region-node-main > .form-actions", this).prepend('<a href="#toggle-sidebar" class="meta-sidebar__trigger trigger" role="button" title="' + hideLabel + '" aria-controls="gin_sidebar"><span class="visually-hidden">' + hideLabel + "</span></a>"),
8+
$("> .layout-region-node-main > .form-actions input", this).attr("form", $(this).attr("id")),
9+
$(".block-page-title-block").append($("> .layout-region-node-main > .form-actions", this)),
10+
$(this).append('<div id="gin_sidebar" class="layout-region-node-secondary"></div>'),
11+
$(".layout-region-node-secondary", this).append($(".node-edit-settings"));
1112
}));
1213
}
1314
};

js/edit_form.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
Backdrop.behaviors.ginEditForm = {
77
attach: function (context, settings) {
8+
const hideLabel = Backdrop.t('Hide sidebar panel');
89
$('.node-form').once('gin-edit-form').each(function () {
9-
$('> div', this).addClass('layout-region-node-main');
10+
$('> div:first-child', this).addClass('layout-region-node-main');
11+
$('> .layout-region-node-main > .form-actions', this).prepend('<a href="#toggle-sidebar" class="meta-sidebar__trigger trigger" role="button" title="' + hideLabel + '" aria-controls="gin_sidebar"><span class="visually-hidden">' + hideLabel + '</span></a>');
12+
$('> .layout-region-node-main > .form-actions input', this).attr('form', $(this).attr('id'));
13+
$('.block-page-title-block').append($('> .layout-region-node-main > .form-actions', this));
1014
$(this).append('<div id="gin_sidebar" class="layout-region-node-secondary"></div>');
11-
$('.layout-region-node-secondary').append($('.node-edit-settings'));
12-
$('.block-page-title-block').append($('.form-actions'));
13-
const hideLabel = Backdrop.t('Hide sidebar panel');
14-
$('.form-actions').prepend('<a href="#toggle-sidebar" class="meta-sidebar__trigger trigger" role="button" title="' + hideLabel + '" aria-controls="gin_sidebar"><span class="visually-hidden">' + hideLabel + '</span></a>');
15-
$('.form-actions input').attr('form', $(this).attr('id'));
15+
$('.layout-region-node-secondary', this).append($('.node-edit-settings'));
1616
});
1717
}
1818
};

0 commit comments

Comments
 (0)