mirror of
https://github.com/Oreolek/kangana.git
synced 2024-07-16 21:34:28 +03:00
DAR-21: message styling, "problems?" link
This commit is contained in:
parent
9c62f4facf
commit
8b5b80fdc6
|
@ -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 {
|
span.hidden-xs {
|
||||||
display: inline-block !important;
|
display: inline-block !important;
|
||||||
}
|
}
|
||||||
|
@ -240,15 +254,7 @@ footer {
|
||||||
}
|
}
|
||||||
|
|
||||||
.main_content {
|
.main_content {
|
||||||
@media(min-width: @screen-lg-desktop) {
|
.make-sm-column(12);
|
||||||
.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);
|
|
||||||
}
|
|
||||||
p {
|
p {
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,5 +74,7 @@ class Controller_Letter extends Controller_Layout {
|
||||||
}
|
}
|
||||||
$this->template = new View_Letter_View;
|
$this->template = new View_Letter_View;
|
||||||
$this->template->content = $model->text;
|
$this->template->content = $model->text;
|
||||||
|
$this->template->subject = $model->subject;
|
||||||
|
$this->template->id = $model->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,21 +55,24 @@ class Model_Letter extends ORM {
|
||||||
**/
|
**/
|
||||||
public function send($address, $token = '')
|
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 $address string or array of strings - email addresses
|
||||||
* @param $text message body
|
* @param $text message body
|
||||||
* @param $subject message subject
|
* @param $subject message subject
|
||||||
|
* @param $id message ID
|
||||||
* @param $token user course token
|
* @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)));
|
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');
|
$sender = Kohana::$config->load('email')->get('sender');
|
||||||
$template = new View_Letter_View;
|
$template = new View_Letter_View;
|
||||||
$template->content = $text;
|
$template->content = $text;
|
||||||
|
$template->id = $id;
|
||||||
|
$template->subject = $subject;
|
||||||
$template->token = $token;
|
$template->token = $token;
|
||||||
$renderer = Kostache_Layout::factory($template->_layout);
|
$renderer = Kostache_Layout::factory($template->_layout);
|
||||||
$email = Email::factory($subject, $renderer->render($template, $template->_view))->from($sender[0], $sender[1]);
|
$email = Email::factory($subject, $renderer->render($template, $template->_view))->from($sender[0], $sender[1]);
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Task_Send extends Minion_Task
|
||||||
->execute();
|
->execute();
|
||||||
foreach ($letters as $letter)
|
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')
|
DB::update('tasks')
|
||||||
|
|
|
@ -7,6 +7,8 @@ class View_Letter_View extends View {
|
||||||
public $_view = NULL;
|
public $_view = NULL;
|
||||||
public $_layout = 'email';
|
public $_layout = 'email';
|
||||||
public $token = '';
|
public $token = '';
|
||||||
|
public $subject = '';
|
||||||
|
public $id = NULL;
|
||||||
public $scripts = array();
|
public $scripts = array();
|
||||||
|
|
||||||
public function stylesheet()
|
public function stylesheet()
|
||||||
|
@ -15,6 +17,11 @@ class View_Letter_View extends View {
|
||||||
return file_get_contents(DOCROOT.$url[0]);
|
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()
|
public function get_content()
|
||||||
{
|
{
|
||||||
return Kostache::factory()->render($this->content);
|
return Kostache::factory()->render($this->content);
|
||||||
|
|
|
@ -67,5 +67,6 @@ return array(
|
||||||
'Message body' => 'Тело письма',
|
'Message body' => 'Тело письма',
|
||||||
'Subscription code' => 'Код подписки',
|
'Subscription code' => 'Код подписки',
|
||||||
'You were subscribed to ' => 'Вы были подписаны на',
|
'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.' => 'Проблемы с отображением письма? Нажмите сюда.'
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
<head>
|
<head>
|
||||||
<title>{{title}}</title>
|
<title>{{subject}}</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta content="width=device-width, initial-scale=1" name="viewport">
|
<meta content="width=device-width, initial-scale=1" name="viewport">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
@ -10,8 +10,13 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class = "main_content">
|
<div class="row heading">
|
||||||
<h3>{{title}}</h3>
|
<h3>{{subject}}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="email_link">{{{view_link}}}</div>
|
||||||
|
</div>
|
||||||
|
<div class = "row">
|
||||||
{{>content}}
|
{{>content}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue