]> _ Git - psq.git/commitdiff
cleanup
authorLouis Jeckel <louis.jeckel@outlook.com>
Tue, 17 Nov 2020 16:53:47 +0000 (17:53 +0100)
committerLouis Jeckel <louis.jeckel@outlook.com>
Tue, 17 Nov 2020 16:53:47 +0000 (17:53 +0100)
app/EmailTemplate.php
app/TemplateVariables.php
resources/views/unlayer/button.blade.php [deleted file]

index 78b238aa61a82f861e176fc4fa16fc0705102035..b01071714bbdd05041092ddabd8a7a46983faf6e 100644 (file)
@@ -44,12 +44,10 @@ class EmailTemplate extends Model
      * @param $user
      * @param $content
      * @return string
-     * @todo remove first regex
      */
     public static function fillWithContentFor($user, $content)
     {
         $content = self::fillWithRegex($user, $content, '/\{\{[^(% )]*\}\}/', '{{', '}}');
-        $content = self::fillWithRegex($user, $content, '/%[^(% )]*%/', '%', '%');
         return  self::processLinks($user, $content);
     }
 
@@ -87,7 +85,7 @@ class EmailTemplate extends Model
      */
     public function fillFor(User $user)
     {
-        return self::fillWithContentFor($user, $this->content);
+        return self::fillWithContentFor($user, $this->html);
     }
 
     /**
@@ -99,22 +97,6 @@ class EmailTemplate extends Model
         return self::fillWithContentFor($user, $this->subject);
     }
 
-    /**
-     * @param $url
-     * @param $label
-     * @param null $color
-     * @return string
-     * @throws \Throwable
-     * @todo remove
-     * @deprecated
-     */
-    public static function button($url, $label, $color = null)
-    {
-        return view('unlayer.button', [
-            'url' => $url,
-            'slot' => $label,
-        ])->render();
-    }
 
     /**
      * @param Builder $builder
@@ -140,9 +122,7 @@ class EmailTemplate extends Model
      */
     public function getMailableFor(User $user)
     {
-        return $this->html ?
-            (new TemplateMail($this->fillFor($user), $this->fillSubjectFor($user))) :
-            (new TemplateMailOld($this->fillFor($user), $this->fillSubjectFor($user)));
+        return new TemplateMail($this->fillFor($user), $this->fillSubjectFor($user));
     }
 
     /**
@@ -154,9 +134,13 @@ class EmailTemplate extends Model
         return $this->render();
     }
 
+    /**
+     * @return mixed
+     * @deprecated
+     */
     public function getContentAttribute()
     {
-        return $this->html ?? $this->getAttributes()['content'];
+        return $this->html;
     }
 
 
index 4689b70c8abe97fcf50e9f8fffa65041f10d40aa..9addcfd486304c83192ea8a4e60d78984f69586d 100644 (file)
@@ -128,68 +128,6 @@ trait TemplateVariables
 
 
 
-    /**
-     * @return string
-     * @throws \Throwable
-     */
-    public function getHomeButtonTemplate()
-    {
-        return EmailTemplate::button(url('/'), 'Cliquez ici');
-    }
-
-    /**
-     * @return string
-     * @throws \Throwable
-     */
-    public function getMyAccountButtonTemplate()
-    {
-        return EmailTemplate::button(
-            $this->routeWithToken('account.index', [], now()->addDays(7)),
-            'Accéder à mon compte'
-        );
-    }
-
-
-    /**
-     * @return string
-     * @throws \Throwable
-     */
-    public function getCompleteRegistrationButtonTemplate()
-    {
-        return EmailTemplate::button(
-            $this->routeWithToken('account.complete-reg', [], now()->addDays(7)),
-            'Créer mon mot de passe'
-        );
-
-    }
-
-
-    /**
-     * @return string
-     * @throws \Throwable
-     */
-    public function getContactButtonTemplate()
-    {
-        return EmailTemplate::button(
-            route('contact.index'),
-            'Nous contacter'
-        );
-
-    }
-
-    /**
-     * @return string
-     * @throws \Throwable
-     */
-    public function getAskPdfButtonTemplate()
-    {
-        $route = \URL::signedRoute('account.ask-pdf', ['user' => $this->id]);
-        return EmailTemplate::button(
-            $route,
-            'Reçevoir le PDF'
-        );
-    }
-
 
     /**
      * @return string
diff --git a/resources/views/unlayer/button.blade.php b/resources/views/unlayer/button.blade.php
deleted file mode 100644 (file)
index b628832..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<table id="u_content_button_1" class="u_content_button" style="font-family:'Open Sans',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
-  <tbody>
-    <tr>
-      <td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:'Open Sans',sans-serif;" align="left">
-
-<div class="v-text-align" align="center">
-  <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;font-family:'Open Sans',sans-serif;"><tr><td class="v-text-align" style="font-family:'Open Sans',sans-serif;" align="center"><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="" style="height:45px; v-text-anchor:middle; width:120px;" arcsize="9%" stroke="f" fillcolor="#3AAEE0"><w:anchorlock/><center style="color:#FFFFFF;font-family:'Open Sans',sans-serif;"><![endif]-->
-    <a href="{!! $url !!}" target="_blank" class="v-size-width" style="box-sizing: border-box;display: inline-block;font-family:'Open Sans',sans-serif;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none;">
-      <span class="v-padding" style="display:block;padding:10px 20px;line-height:120%;"><span style="font-size: 14px; line-height: 16.8px;">{{$slot}}</span></span>
-    </a>
-  <!--[if mso]></center></v:roundrect></td></tr></table><![endif]-->
-</div>
-
-      </td>
-    </tr>
-  </tbody>
-</table>