From fed3054db6f0059353a7bff9df4c755a9eacda1b Mon Sep 17 00:00:00 2001 From: Chirag Chhatrala Date: Fri, 8 Nov 2024 14:49:43 +0530 Subject: [PATCH 1/2] Right to left mode --- api/app/Http/Requests/UserFormRequest.php | 1 + api/app/Http/Resources/FormResource.php | 1 + api/app/Models/Forms/Form.php | 1 + ...8_091638_add_layout_rtl_to_forms_table.php | 27 +++++++++++++++++++ .../open/forms/OpenCompleteForm.vue | 4 +-- .../form-components/FormCustomization.vue | 8 ++++++ .../form-components/FormEditorPreview.vue | 3 ++- client/composables/forms/initForm.js | 1 + client/pages/forms/[slug]/index.vue | 3 ++- 9 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 api/database/migrations/2024_11_08_091638_add_layout_rtl_to_forms_table.php diff --git a/api/app/Http/Requests/UserFormRequest.php b/api/app/Http/Requests/UserFormRequest.php index b79bd8eb..9596e092 100644 --- a/api/app/Http/Requests/UserFormRequest.php +++ b/api/app/Http/Requests/UserFormRequest.php @@ -33,6 +33,7 @@ public function rules() 'theme' => ['required', Rule::in(Form::THEMES)], 'width' => ['required', Rule::in(Form::WIDTHS)], 'size' => ['required', Rule::in(Form::SIZES)], + 'layout_rtl' => 'boolean', 'border_radius' => ['required', Rule::in(Form::BORDER_RADIUS)], 'cover_picture' => 'url|nullable', 'logo_picture' => 'url|nullable', diff --git a/api/app/Http/Resources/FormResource.php b/api/app/Http/Resources/FormResource.php index 6686fcbd..878dd3f6 100644 --- a/api/app/Http/Resources/FormResource.php +++ b/api/app/Http/Resources/FormResource.php @@ -74,6 +74,7 @@ private function getProtectedForm() 'is_password_protected' => true, 'has_password' => $this->has_password, 'width' => 'centered', + 'layout_rtl' => $this->layout_rtl, 'no_branding' => $this->no_branding, 'properties' => [], 'logo_picture' => $this->logo_picture, diff --git a/api/app/Models/Forms/Form.php b/api/app/Models/Forms/Form.php index d6d50a35..ee8df7f4 100644 --- a/api/app/Models/Forms/Form.php +++ b/api/app/Models/Forms/Form.php @@ -58,6 +58,7 @@ class Form extends Model implements CachableAttributes 'border_radius', 'theme', 'width', + 'layout_rtl', 'cover_picture', 'logo_picture', 'dark_mode', diff --git a/api/database/migrations/2024_11_08_091638_add_layout_rtl_to_forms_table.php b/api/database/migrations/2024_11_08_091638_add_layout_rtl_to_forms_table.php new file mode 100644 index 00000000..10dee2a3 --- /dev/null +++ b/api/database/migrations/2024_11_08_091638_add_layout_rtl_to_forms_table.php @@ -0,0 +1,27 @@ +boolean('layout_rtl')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('forms', function (Blueprint $table) { + $table->dropColumn('layout_rtl'); + }); + } +}; diff --git a/client/components/open/forms/OpenCompleteForm.vue b/client/components/open/forms/OpenCompleteForm.vue index cde381d1..266b6f2c 100644 --- a/client/components/open/forms/OpenCompleteForm.vue +++ b/client/components/open/forms/OpenCompleteForm.vue @@ -2,7 +2,7 @@
- + + Logo Picture
diff --git a/client/composables/forms/initForm.js b/client/composables/forms/initForm.js index cd2e1b01..ee80b138 100644 --- a/client/composables/forms/initForm.js +++ b/client/composables/forms/initForm.js @@ -13,6 +13,7 @@ export const initForm = (defaultValue = {}, withDefaultProperties = false) => { font_family: null, theme: "default", width: "centered", + layout_rtl: false, dark_mode: "auto", color: DEFAULT_COLOR, hide_title: false, diff --git a/client/pages/forms/[slug]/index.vue b/client/pages/forms/[slug]/index.vue index c793f1e5..d415c3e1 100644 --- a/client/pages/forms/[slug]/index.vue +++ b/client/pages/forms/[slug]/index.vue @@ -20,12 +20,13 @@ v-if="form.logo_picture" class="w-full p-5 relative mx-auto" :class="{'pt-20':!form.cover_picture, 'md:w-3/5 lg:w-1/2 md:max-w-2xl': form.width === 'centered', 'max-w-7xl': (form.width === 'full' && !isIframe) }" + :style="{ 'direction': form?.layout_rtl ? 'rtl' : 'ltr' }" > Logo Picture From acbae32aa9fa79953f0f5c36222ed03a14eafab0 Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Wed, 13 Nov 2024 10:17:08 +0100 Subject: [PATCH 2/2] Fix label --- .../forms/components/form-components/FormCustomization.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/components/open/forms/components/form-components/FormCustomization.vue b/client/components/open/forms/components/form-components/FormCustomization.vue index b0dd9c65..2b3091fa 100644 --- a/client/components/open/forms/components/form-components/FormCustomization.vue +++ b/client/components/open/forms/components/form-components/FormCustomization.vue @@ -136,7 +136,8 @@