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