From 807da358e206acf49602b54dced8b940be05fc40 Mon Sep 17 00:00:00 2001 From: Peiman Nourani Date: Fri, 10 May 2024 23:10:19 +0330 Subject: [PATCH] [5.x] Fix some RTL issues (#10029) Co-authored-by: Jason Varga --- resources/css/components/fieldtypes/markdown.css | 1 + resources/css/elements/tables.css | 2 +- resources/js/components/FavoriteCreator.vue | 4 ++-- resources/js/components/data-list/Pagination.vue | 2 +- resources/js/components/entries/PublishForm.vue | 7 ++++++- resources/js/components/fieldtypes/TextFieldtype.vue | 1 + resources/js/components/nav/Builder.vue | 2 +- resources/js/components/navigation/View.vue | 2 +- resources/js/components/roles/PermissionTree.vue | 2 +- resources/js/components/stacks/Stack.vue | 2 +- resources/js/components/structures/PageTree.vue | 2 +- resources/js/components/users/Wizard.vue | 2 +- resources/views/utilities/git.blade.php | 2 +- resources/views/utilities/phpinfo.blade.php | 10 +++++----- src/CP/Breadcrumbs.php | 5 ++++- src/Sites/Sites.php | 3 +++ src/Statamic.php | 4 +++- 17 files changed, 34 insertions(+), 19 deletions(-) diff --git a/resources/css/components/fieldtypes/markdown.css b/resources/css/components/fieldtypes/markdown.css index c0ee9176a8..609d7d4905 100644 --- a/resources/css/components/fieldtypes/markdown.css +++ b/resources/css/components/fieldtypes/markdown.css @@ -204,6 +204,7 @@ @apply rounded px-4 py-2; color: #c7254e; background-color: #f9f2f4; + direction: ltr; code { @apply p-0 } } diff --git a/resources/css/elements/tables.css b/resources/css/elements/tables.css index d7fc2cc07b..a420bb28ee 100644 --- a/resources/css/elements/tables.css +++ b/resources/css/elements/tables.css @@ -37,7 +37,7 @@ overflow-x: auto; thead { - @apply bg-gray-100 text-xs text-gray-700 text-gray-900; + @apply bg-gray-100 text-xs text-gray-900; tr { @apply border-b; diff --git a/resources/js/components/FavoriteCreator.vue b/resources/js/components/FavoriteCreator.vue index 3dd27ad903..9302e0776e 100644 --- a/resources/js/components/FavoriteCreator.vue +++ b/resources/js/components/FavoriteCreator.vue @@ -29,7 +29,7 @@ export default { data() { return { - name: document.title.replace(` ${this.$config.get('direction', 'rtl') === 'ltr' ? '‹' : '›'} Statamic`, ''), + name: document.title.replace(` ${this.$config.get('direction', 'ltr') === 'ltr' ? '‹' : '›'} Statamic`, ''), currentUrl: this.$config.get('urlPath') } }, @@ -53,7 +53,7 @@ export default { }, direction() { - return this.$config.get('direction', 'rtl'); + return this.$config.get('direction', 'ltr'); }, }, diff --git a/resources/js/components/data-list/Pagination.vue b/resources/js/components/data-list/Pagination.vue index 7f0cd5c78e..f8c96ad501 100644 --- a/resources/js/components/data-list/Pagination.vue +++ b/resources/js/components/data-list/Pagination.vue @@ -167,7 +167,7 @@ export default { }, direction() { - return this.$config.get('direction', 'rtl'); + return this.$config.get('direction', 'ltr'); }, }, diff --git a/resources/js/components/entries/PublishForm.vue b/resources/js/components/entries/PublishForm.vue index 9c9419a9ca..58122a59db 100644 --- a/resources/js/components/entries/PublishForm.vue +++ b/resources/js/components/entries/PublishForm.vue @@ -486,6 +486,10 @@ export default { })); }, + direction() { + return this.$config.get('direction', 'ltr'); + }, + }, watch: { @@ -547,7 +551,8 @@ export default { this.title = response.data.data.title; this.isWorkingCopy = true; if (this.isBase) { - document.title = this.title + ' ‹ ' + this.breadcrumbs[1].text + ' ‹ ' + this.breadcrumbs[0].text + ' ‹ Statamic'; + const arrow = this.direction === 'ltr' ? '‹' : '›'; + document.title = `${this.title} ${arrow} ${this.breadcrumbs[1].text} ${arrow} ${this.breadcrumbs[0].text} ${arrow} Statamic`; } if (!this.revisionsEnabled) this.permalink = response.data.data.permalink; if (!this.isCreating && !this.isAutosave) this.$toast.success(__('Saved')); diff --git a/resources/js/components/fieldtypes/TextFieldtype.vue b/resources/js/components/fieldtypes/TextFieldtype.vue index 16c7b4e0a8..67262ad5d0 100644 --- a/resources/js/components/fieldtypes/TextFieldtype.vue +++ b/resources/js/components/fieldtypes/TextFieldtype.vue @@ -14,6 +14,7 @@ :placeholder="__(config.placeholder)" :name="name" :id="fieldId" + :direction="config.direction" @input="inputUpdated" @focus="$emit('focus')" @blur="$emit('blur')" diff --git a/resources/js/components/nav/Builder.vue b/resources/js/components/nav/Builder.vue index 8cf30df52e..fd10c2c1f5 100644 --- a/resources/js/components/nav/Builder.vue +++ b/resources/js/components/nav/Builder.vue @@ -317,7 +317,7 @@ export default { }, direction() { - return this.$config.get('direction', 'rtl'); + return this.$config.get('direction', 'ltr'); }, }, diff --git a/resources/js/components/navigation/View.vue b/resources/js/components/navigation/View.vue index f3a9ffd096..1ca5979590 100644 --- a/resources/js/components/navigation/View.vue +++ b/resources/js/components/navigation/View.vue @@ -249,7 +249,7 @@ export default { }, direction() { - return this.$config.get('direction', 'rtl'); + return this.$config.get('direction', 'ltr'); }, }, diff --git a/resources/js/components/roles/PermissionTree.vue b/resources/js/components/roles/PermissionTree.vue index dee6880a6f..a54de2973a 100644 --- a/resources/js/components/roles/PermissionTree.vue +++ b/resources/js/components/roles/PermissionTree.vue @@ -47,7 +47,7 @@ export default { computed: { direction() { - return this.$config.get('direction', 'rtl'); + return this.$config.get('direction', 'ltr'); } } diff --git a/resources/js/components/stacks/Stack.vue b/resources/js/components/stacks/Stack.vue index 0559a48c1b..368e36d1bd 100644 --- a/resources/js/components/stacks/Stack.vue +++ b/resources/js/components/stacks/Stack.vue @@ -99,7 +99,7 @@ export default { }, direction() { - return this.$config.get('direction', 'rtl'); + return this.$config.get('direction', 'ltr'); } }, diff --git a/resources/js/components/structures/PageTree.vue b/resources/js/components/structures/PageTree.vue index 1b7ab7325f..0bdf7389d6 100644 --- a/resources/js/components/structures/PageTree.vue +++ b/resources/js/components/structures/PageTree.vue @@ -118,7 +118,7 @@ export default { }, direction() { - return this.$config.get('direction', 'rtl'); + return this.$config.get('direction', 'ltr'); }, }, diff --git a/resources/js/components/users/Wizard.vue b/resources/js/components/users/Wizard.vue index b7dfca5b50..686cd1338d 100644 --- a/resources/js/components/users/Wizard.vue +++ b/resources/js/components/users/Wizard.vue @@ -257,7 +257,7 @@ export default { return this.invitation.send ? __('Create and Send Email') : __('Create User'); }, direction() { - return this.$config.get('direction', 'rtl'); + return this.$config.get('direction', 'ltr'); }, }, diff --git a/resources/views/utilities/git.blade.php b/resources/views/utilities/git.blade.php index 50a685de79..213a248fab 100644 --- a/resources/views/utilities/git.blade.php +++ b/resources/views/utilities/git.blade.php @@ -28,7 +28,7 @@ @forelse($statuses ?? [] as $path => $status)

{{ __('Repository path') }}: {{ $path }}

-
{{ $status->status }}
+
{{ $status->status }}
{{ __('Affected files') }}: {{ $status->totalCount }}
@if ($status->addedCount) diff --git a/resources/views/utilities/phpinfo.blade.php b/resources/views/utilities/phpinfo.blade.php index 937ab357ca..823ed7c878 100644 --- a/resources/views/utilities/phpinfo.blade.php +++ b/resources/views/utilities/phpinfo.blade.php @@ -13,8 +13,8 @@

{{ __('PHP Info') }}

-
- +
+
@@ -23,9 +23,9 @@ @foreach ($phpinfo as $section => $items) -

{{ $section }}

-
-
{{ __('PHP Version') }} {{ PHP_VERSION }}
+

{{ $section }}

+
+
@foreach ($items as $name => $value) diff --git a/src/CP/Breadcrumbs.php b/src/CP/Breadcrumbs.php index c41fd23b95..f7e2af79cc 100644 --- a/src/CP/Breadcrumbs.php +++ b/src/CP/Breadcrumbs.php @@ -4,6 +4,7 @@ use Illuminate\Contracts\Support\Arrayable; use JsonSerializable; +use Statamic\Statamic; class Breadcrumbs implements Arrayable, JsonSerializable { @@ -43,6 +44,8 @@ public function title($title = null) $crumbs->push(__($title)); } - return $crumbs->reverse()->join(' ‹ '); + $arrow = Statamic::cpDirection() === 'ltr' ? ' ‹ ' : ' › '; + + return $crumbs->reverse()->join($arrow); } } diff --git a/src/Sites/Sites.php b/src/Sites/Sites.php index d3d2b6f772..42de9e6bba 100644 --- a/src/Sites/Sites.php +++ b/src/Sites/Sites.php @@ -173,6 +173,7 @@ public function blueprint() 'instructions' => __('statamic::messages.site_configure_url_instructions'), 'required' => true, 'width' => 33, + 'direction' => 'ltr', ], ], [ @@ -182,6 +183,7 @@ public function blueprint() 'instructions' => __('statamic::messages.site_configure_locale_instructions'), 'required' => true, 'width' => 33, + 'direction' => 'ltr', ], ], [ @@ -190,6 +192,7 @@ public function blueprint() 'type' => 'text', 'instructions' => __('statamic::messages.site_configure_lang_instructions'), 'width' => 33, + 'direction' => 'ltr', ], ], [ diff --git a/src/Statamic.php b/src/Statamic.php index b459092d2a..272b0bf94e 100644 --- a/src/Statamic.php +++ b/src/Statamic.php @@ -338,7 +338,9 @@ public static function flash() public static function crumb(...$values) { - return implode(' ‹ ', array_map(fn ($str) => Statamic::trans($str), $values)); + $arrow = Statamic::cpDirection() === 'ltr' ? ' ‹ ' : ' › '; + + return implode($arrow, array_map(fn ($str) => Statamic::trans($str), $values)); } public static function docsUrl($url)
{{ $name }}