Added query param for email design settings modal

no issue

- allows for easier development because modal stays open when refreshing as UI state is stored in the URL
This commit is contained in:
Kevin Ansfield 2021-06-03 17:22:46 +01:00
parent bf700c5d98
commit c10f8d014a
3 changed files with 20 additions and 12 deletions

View File

@ -7,7 +7,7 @@
<h4 class="gh-expandable-title">Email design</h4>
<p class="gh-expandable-description">Customize the look and feel of email newsletters</p>
</div>
<button type="button" class="gh-btn gh-btn-green" {{action (toggle "showEmailDesignSettings" this)}} data-test-toggle-membersFrom><span> Customize </span></button>
<button type="button" class="gh-btn gh-btn-green" {{on "click" @toggleEmailDesignSettings}} data-test-toggle-membersFrom><span> Customize </span></button>
</div>
</div>
</section>
@ -197,12 +197,4 @@
</div>
{{/unless}}
</section>
</div>
{{#if this.showEmailDesignSettings}}
<GhFullscreenModal @modifier="full-overlay portal-settings">
<ModalEmailDesignSettings
@closeModal={{action "closeEmailDesignSettings"}}
/>
</GhFullscreenModal>
{{/if}}
</div>

View File

@ -9,13 +9,14 @@ export default class MembersEmailController extends Controller {
@service session;
@service settings;
queryParams = ['emailRecipientsOpen']
queryParams = ['emailRecipientsOpen', 'showEmailDesignSettings']
// from/supportAddress are set here so that they can be reset to saved values on save
// to avoid it looking like they've been saved when they have a separate update process
@tracked fromAddress = '';
@tracked supportAddress = '';
@tracked showEmailDesignSettings = false;
@tracked emailRecipientsOpen = false;
@tracked showLeaveSettingsModal = false;
@ -24,6 +25,11 @@ export default class MembersEmailController extends Controller {
this[property] = email;
}
@action
toggleEmailDesignSettings() {
this.showEmailDesignSettings = !this.showEmailDesignSettings;
}
@action
toggleEmailRecipientsOpen() {
this.emailRecipientsOpen = !this.emailRecipientsOpen;
@ -35,6 +41,7 @@ export default class MembersEmailController extends Controller {
this.leaveSettingsTransition = transition;
this.showLeaveSettingsModal = true;
}
this.showEmailDesignSettings = false;
}
@action

View File

@ -25,6 +25,7 @@
@supportAddress={{this.supportAddress}}
@setEmailAddress={{this.setEmailAddress}}
@emailRecipientsExpanded={{this.emailRecipientsOpen}}
@toggleEmailDesignSettings={{this.toggleEmailDesignSettings}}
@toggleEmailRecipientsExpansion={{this.toggleEmailRecipientsOpen}}
/>
</div>
@ -40,4 +41,12 @@
@modifier="action wide"
/>
{{/if}}
</section>
</section>
{{#if this.showEmailDesignSettings}}
<GhFullscreenModal @modifier="full-overlay portal-settings">
<ModalEmailDesignSettings
@closeModal={{this.toggleEmailDesignSettings}}
/>
</GhFullscreenModal>
{{/if}}