Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -4163,15 +4163,6 @@ ul.wu-widget-list > li:first-child {
margin-right: -0.8em;
}

/* Primary domain toggle: red when checked to signal danger */
.wu-primary-domain-field .wu-tgl-ios:checked + .wu-tgl-btn {
background: #e53e3e;
border-color: #c53030;
}
.wu-primary-domain-field .wu-tgl-ios:checked + .wu-tgl-btn:active {
box-shadow: inset 0 0 0 2em #c53030;
}

.wu-styling .wu-spin {
-moz-animation: wu_spin 2s infinite linear;
-o-animation: wu_spin 2s infinite linear;
Expand Down
2 changes: 1 addition & 1 deletion assets/css/admin.min.css

Large diffs are not rendered by default.

31 changes: 1 addition & 30 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global wu_on_load, wp */
/* global wu_on_load */
(function($) {

// eslint-disable-next-line no-undef
Expand All @@ -11,35 +11,6 @@

wu_on_load();

/**
* Primary domain toggle: show a confirmation dialog before enabling.
*
* Uses event delegation so it works for both the edit-domain page and
* the "Add Domain" modal which is injected into the DOM after page load.
*/
$(document).on('change', '[data-wu-primary-domain-toggle]', function() {
var $toggle = $(this);

// Only prompt when the user is turning the toggle ON.
if ( ! $toggle.is(':checked')) {
return;
}

// eslint-disable-next-line no-alert
var confirmed = window.confirm(
// translators: Confirmation dialog shown before setting a domain as the main WaaS domain.
wp.i18n.__(
'Are you sure you want to change the main domain used for this WP Multisite WaaS website?\n\nThis will affect all URLs across your entire network and may cause a temporary disruption. Ensure your DNS is correctly configured before proceeding.',
'ultimate-multisite'
)
);

if ( ! confirmed) {
// Revert the checkbox state and trigger 'change' so Vue v-model stays in sync.
$toggle.prop('checked', false).trigger('change');
}
});

});

}(jQuery));
2 changes: 1 addition & 1 deletion assets/js/admin.min.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(i=>{wu={tables:{},configs:{}},i(document).ready(function(){wu_on_load(),i(document).on("change","[data-wu-primary-domain-toggle]",function(){var e=i(this);e.is(":checked")&&!window.confirm(wp.i18n.__("Are you sure you want to change the main domain used for this WP Multisite WaaS website?\n\nThis will affect all URLs across your entire network and may cause a temporary disruption. Ensure your DNS is correctly configured before proceeding.","ultimate-multisite"))&&e.prop("checked",!1).trigger("change")})})})(jQuery);
(n=>{wu={tables:{},configs:{}},n(document).ready(function(){wu_on_load()})})(jQuery);
24 changes: 11 additions & 13 deletions inc/admin-pages/class-domain-edit-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,20 +322,18 @@ public function register_widgets(): void {
'state' => [
'primary_domain' => $this->get_object()->is_primary_domain(),
],
'fields' => [
'primary_domain' => [
'type' => 'toggle',
'title' => __('Main WP Multisite WaaS Domain', 'ultimate-multisite'),
'desc' => __('Set this as the main WaaS website domain.', 'ultimate-multisite'),
'tooltip' => __('Warning: Changing the main WaaS domain will affect all URLs across your entire WP Multisite WaaS network. This is different from host-level "Primary Domain" settings (e.g. www vs non-www). Only change this if you intend to move your entire WaaS network to a new domain.', 'ultimate-multisite'),
'value' => $this->get_object()->is_primary_domain(),
'wrapper_classes' => 'wu-primary-domain-field',
'html_attr' => [
'v-model' => 'primary_domain',
'data-wu-primary-domain-toggle' => 'true',
'fields' => [
'primary_domain' => [
'type' => 'toggle',
'title' => __('Is Primary Domain?', 'ultimate-multisite'),
'desc' => __('Set as the primary domain.', 'ultimate-multisite'),
'tooltip' => __('Setting this as the primary domain will remove any other domain mapping marked as the primary domain for this site.', 'ultimate-multisite'),
'value' => $this->get_object()->is_primary_domain(),
'html_attr' => [
'v-model' => 'primary_domain',
],
],
],
'primary_note' => [
'primary_note' => [
'type' => 'note',
'desc' => __('By making this the primary domain, we will convert the previous primary domain for this site, if one exists, into an alias domain.', 'ultimate-multisite'),
'wrapper_html_attr' => [
Expand Down
13 changes: 5 additions & 8 deletions inc/admin-pages/class-domain-list-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,11 @@ public function render_add_new_domain_modal(): void {
'value' => Domain_Stage::CHECKING_DNS,
],
'primary_domain' => [
'type' => 'toggle',
'title' => __('Main WP Multisite WaaS Domain', 'ultimate-multisite'),
'desc' => __('Set this as the main WaaS website domain.', 'ultimate-multisite'),
'tooltip' => __('Warning: Changing the main WaaS domain will affect all URLs across your entire WP Multisite WaaS network. This is different from host-level "Primary Domain" settings (e.g. www vs non-www). Only change this if you intend to move your entire WaaS network to a new domain.', 'ultimate-multisite'),
'wrapper_classes' => 'wu-primary-domain-field',
'html_attr' => [
'v-model' => 'primary_domain',
'data-wu-primary-domain-toggle' => 'true',
'type' => 'toggle',
'title' => __('Primary Domain', 'ultimate-multisite'),
'desc' => __('Check to set this domain as the primary', 'ultimate-multisite'),
'html_attr' => [
'v-model' => 'primary_domain',
],
],
'primary_note' => [
Expand Down
Loading