From 3694054a731cffe7d9fa637355e0f80e36100591 Mon Sep 17 00:00:00 2001 From: Stephan Hug <88476449+StephanH90@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:57:17 +0200 Subject: [PATCH] feat(form-builder): save the preference for "show advanced" settings (#2701) --- .../cfb-form-editor/cfb-advanced-settings.hbs | 2 +- .../cfb-form-editor/cfb-advanced-settings.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/form-builder/addon/components/cfb-form-editor/cfb-advanced-settings.hbs b/packages/form-builder/addon/components/cfb-form-editor/cfb-advanced-settings.hbs index 3fd9ab528..00cd4f9dd 100644 --- a/packages/form-builder/addon/components/cfb-form-editor/cfb-advanced-settings.hbs +++ b/packages/form-builder/addon/components/cfb-form-editor/cfb-advanced-settings.hbs @@ -1,6 +1,6 @@ {{#if this.showAdvanced}} diff --git a/packages/form-builder/addon/components/cfb-form-editor/cfb-advanced-settings.js b/packages/form-builder/addon/components/cfb-form-editor/cfb-advanced-settings.js index a76e673b4..d93ad282b 100644 --- a/packages/form-builder/addon/components/cfb-form-editor/cfb-advanced-settings.js +++ b/packages/form-builder/addon/components/cfb-form-editor/cfb-advanced-settings.js @@ -1,6 +1,20 @@ +import { action } from "@ember/object"; import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; - export default class CfbFormEditorCfbAdvancedSettings extends Component { @tracked showAdvanced = false; + + constructor(owner, args) { + super(owner, args); + + this.showAdvanced = + JSON.parse(localStorage.getItem("showAdvanced")) ?? false; + } + + @action + toggleAdvanced() { + this.showAdvanced = !this.showAdvanced; + + localStorage.setItem("showAdvanced", this.showAdvanced); + } }