1
0
Fork 0
mirror of https://github.com/Oreolek/kangana.git synced 2024-05-18 17:08:19 +03:00

cross-email friendly CSS

Also reduces message size. Kinda.
This commit is contained in:
Alexander Yakovlev 2014-03-03 18:59:14 +07:00
parent e21d5c207c
commit 01c60ac3c3
5 changed files with 7 additions and 21 deletions

View file

@ -15,3 +15,5 @@ PHP 5 with enabled OpenSSL and APCu
* All comments in config file are lost on write.
* Feature is highly unreliable. You can lose the file. You can have two users writing config simultaneously.
* Do not use in web environment.
// uses tijsverkoyen / CssToInlineStyles to convert CSS to inline styles

View file

@ -1,4 +0,0 @@
@import 'bootstrap/bootstrap';
@import 'layout';
@import 'variables';
@import 'bootswatch';

View file

@ -75,7 +75,8 @@ class Model_Letter extends ORM {
$template->subject = $subject;
$template->token = $token;
$renderer = Kostache_Layout::factory($template->_layout);
$email = Email::factory($subject, $renderer->render($template, $template->_view), 'text/html')->from($sender[0], $sender[1]);
$html = $renderer->render($template, $template->_view);
$email = Email::factory($subject, $html, 'text/html')->from($sender[0], $sender[1]);
if (is_array($address))
{
$email->bcc($address);

View file

@ -11,12 +11,6 @@ class View_Letter_View extends View {
public $id = NULL;
public $scripts = array();
public function stylesheet()
{
$url = Less::compile(APPPATH.'assets/stylesheets/email', 'all', FALSE);
return file_get_contents(DOCROOT.$url[0]);
}
public function view_link()
{
return HTML::anchor(Route::url('default', array('controller' => 'Letter', 'action' => 'view', 'id' => $this->id), TRUE), __('Problems viewing this email? Click here.'));

View file

@ -4,19 +4,12 @@
<title>{{subject}}</title>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<style type="text/css">
{{{stylesheet}}}
</style>
</head>
<body>
<div class="container">
<div class="row heading">
<h3>{{subject}}</h3>
</div>
<div class="container" style="margin: 20px;">
<h3>{{subject}}</h3>
<div class="email_link" style="font-size: 10px; margin-bottom: 10px">{{{view_link}}}</div>
<div class="row">
<div class="email_link">{{{view_link}}}</div>
</div>
<div class = "row">
{{>content}}
</div>
</div>