Skip to content

Commit

Permalink
FIX Fix reloading subsite selector when updating subsites
Browse files Browse the repository at this point in the history
When a new subsite is added or an existing on is renamed, the subsite
selector needs to be reloaded. The code to do this broke at some stage.
  • Loading branch information
GuySartorelli committed Nov 12, 2024
1 parent b6ba2b8 commit ada2901
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/LeftAndMain_Subsites.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 8 additions & 14 deletions client/src/js/LeftAndMain_Subsites.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@
}
});

/*
* Reload subsites dropdown when links are processed
*/
$('.cms-container .cms-menu-list li a').entwine({
onclick(e) {
$('.cms-container').loadFragment('admin/subsite_xhr', 'SubsiteList');
this._super(e);
}
});

/*
* Reload subsites dropdown when the admin area reloads (for deleting sites)
*/
Expand All @@ -32,11 +22,15 @@
});

/*
* Reload subsites dropdown when subsites are added or names are modified
* Reload subsites dropdown when subsites are added or modified
*/
$('.cms-container .tab.subsite-model').entwine({
onadd(e) {
$('.cms-container').loadFragment('admin/subsite_xhr', 'SubsiteList');
$('#Form_ItemEditForm').entwine({
onaftersubmitform(e) {
// Only load the fragment if this form is the subsite form.
// We can't add a selector to the form itself so check for the tab we added a specific class to.
if (this.find('[role="tab"].subsite-model').length > 0) {
$('.cms-container').loadFragment('admin/subsite_xhr', 'SubsiteList');
}
this._super(e);
}
});
Expand Down

0 comments on commit ada2901

Please sign in to comment.