1
0
Fork 0
mirror of https://github.com/Oreolek/kangana.git synced 2024-06-16 23:11:07 +03:00

DAR-21: message styling, "problems?" link

This commit is contained in:
Alexander Yakovlev 2014-02-28 17:35:17 +07:00
parent 9c62f4facf
commit 8b5b80fdc6
7 changed files with 40 additions and 16 deletions

View file

@ -81,6 +81,20 @@ textarea {
}
}
.heading {
background-color: @navbar-default-bg;
color: @navbar-default-color;
h3 {
text-align: center;
}
}
.email_link {
font-size: @font-size-small;
text-align: center;
margin-bottom: @navbar-margin-bottom;
}
span.hidden-xs {
display: inline-block !important;
}
@ -240,15 +254,7 @@ footer {
}
.main_content {
@media(min-width: @screen-lg-desktop) {
.make-lg-column(10);
}
@media(min-width: @screen-desktop) and (max-width: @screen-lg-desktop) {
.make-md-column(10);
}
@media(min-width: @screen-tablet) and (max-width: @screen-desktop) {
.make-sm-column(9);
}
.make-sm-column(12);
p {
text-align: justify;
}

View file

@ -74,5 +74,7 @@ class Controller_Letter extends Controller_Layout {
}
$this->template = new View_Letter_View;
$this->template->content = $model->text;
$this->template->subject = $model->subject;
$this->template->id = $model->id;
}
}

View file

@ -55,21 +55,24 @@ class Model_Letter extends ORM {
**/
public function send($address, $token = '')
{
return self::_send($address, $this->text, $this->subject, $token);
return self::_send($address, $this->text, $this->subject, $this->id, $token);
}
/**
* @param $address string or array of strings - email addresses
* @param $text message body
* @param $subject message subject
* @param $id message ID
* @param $token user course token
**/
public static function _send($address, $text, $subject, $token = '')
public static function _send($address, $text, $subject, $id, $token = '')
{
Log::instance()->add(Log::NOTICE, __('Sending letter with subject "%subject" to address %address', array('%subject' => $subject, '%address' => $address)));
$sender = Kohana::$config->load('email')->get('sender');
$template = new View_Letter_View;
$template->content = $text;
$template->id = $id;
$template->subject = $subject;
$template->token = $token;
$renderer = Kostache_Layout::factory($template->_layout);
$email = Email::factory($subject, $renderer->render($template, $template->_view))->from($sender[0], $sender[1]);

View file

@ -37,7 +37,7 @@ class Task_Send extends Minion_Task
->execute();
foreach ($letters as $letter)
{
Model_Letter::_send($letter['email'], $letter['text'], $letter['subject'], $letter['token']);
Model_Letter::_send($letter['email'], $letter['text'], $letter['subject'], $letter['id'], $letter['token']);
}
DB::update('tasks')

View file

@ -7,6 +7,8 @@ class View_Letter_View extends View {
public $_view = NULL;
public $_layout = 'email';
public $token = '';
public $subject = '';
public $id = NULL;
public $scripts = array();
public function stylesheet()
@ -15,6 +17,11 @@ class View_Letter_View extends View {
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)), __('Problems viewing this email? Click here.'));
}
public function get_content()
{
return Kostache::factory()->render($this->content);

View file

@ -67,5 +67,6 @@ return array(
'Message body' => 'Тело письма',
'Subscription code' => 'Код подписки',
'You were subscribed to ' => 'Вы были подписаны на',
'From now on you will receive letters from this subscription.' => 'Теперь вы будете получать письма из этой рассылки.'
'From now on you will receive letters from this subscription.' => 'Теперь вы будете получать письма из этой рассылки.',
'Problems viewing this email? Click here.' => 'Проблемы с отображением письма? Нажмите сюда.'
);

View file

@ -1,7 +1,7 @@
<!doctype html>
<html lang="ru">
<head>
<title>{{title}}</title>
<title>{{subject}}</title>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<style type="text/css">
@ -10,8 +10,13 @@
</head>
<body>
<div class="container">
<div class = "main_content">
<h3>{{title}}</h3>
<div class="row heading">
<h3>{{subject}}</h3>
</div>
<div class="row">
<div class="email_link">{{{view_link}}}</div>
</div>
<div class = "row">
{{>content}}
</div>
</div>