Skip to content

Commit

Permalink
Ability change direction accordin to template lnaguage
Browse files Browse the repository at this point in the history
  • Loading branch information
abdosaeedelhassan committed Sep 23, 2024
1 parent 8bd5e00 commit 440ffb6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion resources/lang/ar.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"Email Templates": "قوالب البريد الإلكتروني",
"Email Template Themes": "ثيمات قالب البريد الإلكتروني"
"Email Template Themes": "ثيمات قالب البريد الإلكتروني",
"Preview Email": "مشاهدة البريد الإلكتروني"
}
2 changes: 1 addition & 1 deletion resources/views/email/parts/_content.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: {{config('filament-email-templates.content_width')}}px; margin-bottom: 30px" >
<!-- COPY -->
<tr>
<td bgcolor="{{$data['theme']["content_bg_color"]}}" align="left" style="padding: 20px 30px 40px 30px; color: {{$data['theme']["body_color"]}}; font-family: 'Lato',
<td bgcolor="{{$data['theme']["content_bg_color"]}}" align="{{$data['language']==='ar'?'right':'left'}}" style="padding: 20px 30px 40px 30px; color: {{$data['theme']["body_color"]}}; font-family: 'Lato',
Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 1.8;" >

{!! $data['content']??'' !!}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/email/parts/_footer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: {{config('filament-email-templates.content_width')}}px;">
<!-- NAVIGATION -->
<tr>
<td bgcolor="{{$data['theme']["body_bg_color"]}}" align="left" style="padding: 30px; color: {{$data['theme']["body_color"]}}; border-radius: 4px 4px 4px 4px;
<td bgcolor="{{$data['theme']["body_bg_color"]}}" align="{{$data['language']==='ar'?'right':'left'}}" style="padding: 30px; color: {{$data['theme']["body_color"]}}; border-radius: 4px 4px 4px 4px;
font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;">
<p style="margin: 0;">
@foreach(config('filament-email-templates.links') as $link)
Expand All @@ -26,7 +26,7 @@

<!-- ADDRESS -->
<tr>
<td bgcolor="{{$data['theme']["body_bg_color"]}}" align="left"
<td bgcolor="{{$data['theme']["body_bg_color"]}}" align="{{$data['language']==='ar'?'right':'left'}}"
style="padding: 30px; color: {{$data['theme']["body_color"]}}; border-radius: 4px 4px 4px 4px; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 14px;
font-weight: 400; line-height: 18px;">
<p style="margin: 0;"> &copy; <?= date('Y'); ?> {{config('app.name')}}. {{__('vb-email-templates::email-templates.general-labels.all-rights-reserved')}}.</p>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/email/parts/_head.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<html dir="{{$data['language']==='ar'?'rtl':'ltr'}}" style="direction: {{$data['language']==='ar'?'rtl':'ltr'}}">
<head lang="{{$data['language']}}">
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down
2 changes: 1 addition & 1 deletion src/Models/EmailTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ public function getBase64EmailPreviewData()
public function getEmailPreviewData()
{
$models = self::createEmailPreviewData();

return [
'user' => $models->user,
'content' => TokenHelper::replace($this->content ?? '', $models),
Expand All @@ -190,6 +189,7 @@ public function getEmailPreviewData()
'title' => TokenHelper::replace($this->title ?? '', $models),
'theme' => $this->theme->colours,
'logo' => $this->logo,
'language' => $this->language,
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/EmailTemplateResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static function table(Table $table): Table
'vb-email-templates::forms.components.iframe',
['record' => $record],
))->form(null)
->modalHeading(fn(EmailTemplate $record): string => 'Preview Email: ' . $record->name)
->modalHeading(fn(EmailTemplate $record): string => __('Preview Email').': ' . $record->name)
->modalSubmitAction(false)
->modalCancelAction(false)
->slideOver(),
Expand Down

0 comments on commit 440ffb6

Please sign in to comment.