1
0
Fork 0
mirror of https://github.com/Oreolek/oreolek.ru.git synced 2024-05-16 16:08:22 +03:00

Time to read for every article in read view

This commit is contained in:
Alexander Yakovlev 2015-08-03 15:29:15 +07:00
parent 297530e637
commit 785a676de4
5 changed files with 17 additions and 3 deletions

View file

@ -316,3 +316,7 @@ p.stagedir {
.ya-page_js_yes .ya-site-form_inited_no {
display: none;
}
.speed {
float: right;
}

View file

@ -39,7 +39,8 @@ class View_Post_Read extends View_Read {
'comment_count' => '',
'edit_link' => '',
'view_link' => '',
'comments_link' => ''
'comments_link' => '',
'speed' => '',
);
if ($this->show_date)
{
@ -49,6 +50,8 @@ class View_Post_Read extends View_Read {
{
$output['edit_link'] = Route::url('default', array('controller' => Request::current()->controller(), 'action' => 'edit','id' => $item->id));
}
// ~900 chars per minute is average reading speed, according to Wikipedia
$output['speed'] = '<span class="fa fa-clock-o"></span> ≈'.ceil(mb_strlen($item->content) / 700).' '.__('min');
$output['view_link'] = Route::url('default', array('controller' => Request::current()->controller(), 'action' => 'view','id' => $item->id));
$output['heading'] = $item->name;
$output['comment_count'] = $item->comment_count;

View file

@ -42,7 +42,8 @@ class View_Read extends View_Index {
'comment_count' => '',
'edit_link' => '',
'view_link' => '',
'comments_link' => ''
'comments_link' => '',
'speed' => '',
);
if ($this->show_date)
{
@ -52,6 +53,8 @@ class View_Read extends View_Index {
{
$output['edit_link'] = Route::url('default', array('controller' => Request::current()->controller(), 'action' => 'edit','id' => $item->id));
}
// ~900 chars per minute is average reading speed, according to Wikipedia
$output['speed'] = '<span class="fa fa-clock-o"></span> ≈'.ceil(mb_strlen($item->content) / 700).' '.__('min');
$output['view_link'] = Route::url('default', array('controller' => Request::current()->controller(), 'action' => 'view','id' => $item->id));
$output['heading'] = $item->name;
$output['comment_count'] = $item->comment_count;

View file

@ -18,5 +18,6 @@ return array(
'You should write a comment first if you want to click a big comment posting button.' => 'Вам стоит написать комментарий перед тем, как нажимать большую кнопку отправки комментария.',
'You did not leave a name. How would you like to be addressed?' => 'Вы не оставили имени. Как вас называть?',
'You should leave an email address. Please.' => 'Вам стоит оставить адрес электронной почты. Пожалуйста.',
'This does not look like an email address. Surely a small mistake.' => 'Это не похоже на адрес электронной почты. Без сомнения, мелкая ошибка.'
'This does not look like an email address. Surely a small mistake.' => 'Это не похоже на адрес электронной почты. Без сомнения, мелкая ошибка.',
'min' => 'мин',
);

View file

@ -3,6 +3,9 @@
</div>
{{#get_items}}
<div class="post" typeof="blogPost">
{{#speed}}
<div class="speed">{{{speed}}}</div>
{{/speed}}
<h3 property="headline"><a href="{{{view_link}}}">{{heading}}</a></h3>
<div class="meta">
{{#date}}