Browse Source

Update moderation page

Visman 3 years ago
parent
commit
66830ec240
4 changed files with 131 additions and 100 deletions
  1. 29 22
      app/Models/Pages/Moderate.php
  2. 2 2
      app/Models/Pages/Topic.php
  3. 43 37
      app/lang/en/misc.po
  4. 57 39
      app/lang/ru/misc.po

+ 29 - 22
app/Models/Pages/Moderate.php

@@ -272,7 +272,8 @@ class Moderate extends Page
             );
         }
 
-        $this->single = 1 === \count($objects);
+        $this->numObj = \count($objects);
+        $this->single = 1 === $this->numObj;
 
         return $this->{'action' . \ucfirst($v->action)}($objects, $v);
     }
@@ -286,8 +287,8 @@ class Moderate extends Page
     {
         switch ($v->step) {
             case 1:
-                $this->formTitle   = __($this->single ? 'Open topic title' : 'Open topics title');
-                $this->buttonValue = __($this->single ? 'Open topic btn' : 'Open topics btn');
+                $this->formTitle   = __(['Open topic title', $this->numObj]);
+                $this->buttonValue = ['Open topic btn', $this->numObj];
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
                 $this->form        = $this->formConfirm($topics, $v);
 
@@ -296,9 +297,7 @@ class Moderate extends Page
                 if (1 === $v->confirm) {
                     $this->c->topics->access(true, ...$topics);
 
-                    $message = $this->single ? 'Open topic redirect' : 'Open topics redirect';
-
-                    return $this->c->Redirect->url($this->backLink)->message($message);
+                    return $this->c->Redirect->url($this->backLink)->message(['Open topic redirect', $this->numObj]);
                 } else {
                     return $this->actionCancel($topics, $v);
                 }
@@ -311,8 +310,8 @@ class Moderate extends Page
     {
         switch ($v->step) {
             case 1:
-                $this->formTitle   = __($this->single ? 'Close topic title' : 'Close topics title');
-                $this->buttonValue = __($this->single ? 'Close topic btn' : 'Close topics btn');
+                $this->formTitle   = __(['Close topic title', $this->numObj]);
+                $this->buttonValue = ['Close topic btn', $this->numObj];
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
                 $this->form        = $this->formConfirm($topics, $v);
 
@@ -321,9 +320,7 @@ class Moderate extends Page
                 if (1 === $v->confirm) {
                     $this->c->topics->access(false, ...$topics);
 
-                    $message = $this->single ? 'Close topic redirect' : 'Close topics redirect';
-
-                    return $this->c->Redirect->url($this->backLink)->message($message);
+                    return $this->c->Redirect->url($this->backLink)->message(['Close topic redirect', $this->numObj]);
                 } else {
                     return $this->actionCancel($topics, $v);
                 }
@@ -353,8 +350,18 @@ class Moderate extends Page
 
         switch ($v->step) {
             case 1:
-                $this->formTitle   = __(true === $this->processAsPosts ? 'Delete posts' : 'Delete topics');
-                $this->buttonValue = __('Delete');
+                $this->formTitle   = __([
+                    true === $this->processAsPosts
+                        ? 'Delete post title'
+                        : 'Delete topic title',
+                    $this->numObj,
+                ]);
+                $this->buttonValue = [
+                    true === $this->processAsPosts
+                        ? 'Delete post btn'
+                        : 'Delete topic btn',
+                    $this->numObj,
+                ];
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
                 $this->form        = $this->formConfirm($objects, $v);
 
@@ -363,13 +370,13 @@ class Moderate extends Page
                 if (1 === $v->confirm) {
                     if (true === $this->processAsPosts) {
                         $this->c->posts->delete(...$objects);
-                        $message = 'Delete posts redirect';
+                        $message = 'Delete post redirect';
                     } else {
                         $this->c->topics->delete(...$objects);
-                        $message = 'Delete topics redirect';
+                        $message = 'Delete topic redirect';
                     }
 
-                    return $this->c->Redirect->url($this->curForum->link)->message($message);
+                    return $this->c->Redirect->url($this->curForum->link)->message([$message, $this->numObj]);
                 } else {
                     return $this->actionCancel($objects, $v);
                 }
@@ -383,7 +390,7 @@ class Moderate extends Page
         switch ($v->step) {
             case 1:
                 $this->formTitle   = __('Move topics');
-                $this->buttonValue = __('Move');
+                $this->buttonValue = 'Move';
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
                 $this->chkRedirect = true;
                 $this->form        = $this->formConfirm($topics, $v);
@@ -422,7 +429,7 @@ class Moderate extends Page
         switch ($v->step) {
             case 1:
                 $this->formTitle   = __('Merge topics');
-                $this->buttonValue = __('Merge');
+                $this->buttonValue = 'Merge';
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $this->curForum);
                 $this->chkRedirect = true;
                 $this->form        = $this->formConfirm($topics, $v);
@@ -446,7 +453,7 @@ class Moderate extends Page
         switch ($v->step) {
             case 1:
                 $this->formTitle   = __('Unstick topics');
-                $this->buttonValue = __('Unstick');
+                $this->buttonValue = 'Unstick';
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
                 $this->form        = $this->formConfirm($topics, $v);
 
@@ -474,7 +481,7 @@ class Moderate extends Page
         switch ($v->step) {
             case 1:
                 $this->formTitle   = __('Stick topics');
-                $this->buttonValue = __('Stick');
+                $this->buttonValue = 'Stick';
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
                 $this->form        = $this->formConfirm($topics, $v);
 
@@ -502,7 +509,7 @@ class Moderate extends Page
         switch ($v->step) {
             case 1:
                 $this->formTitle   = __('Split posts');
-                $this->buttonValue = __('Split');
+                $this->buttonValue = 'Split';
                 $this->needSubject = true;
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $this->curTopic);
                 $this->form        = $this->formConfirm($posts, $v);
@@ -615,7 +622,7 @@ class Moderate extends Page
         $form['sets']['moderate']['fields'] = $fields;
         $form['btns'][$v->action] = [
             'type'  => 'submit',
-            'value' => $this->buttonValue,
+            'value' => __($this->buttonValue),
         ];
         $form['btns']['cancel'] = [
             'type'  => 'submit',

+ 2 - 2
app/Models/Pages/Topic.php

@@ -211,13 +211,13 @@ class Topic extends Page
             $form['btns']['open'] = [
                 'class'     => ['origin'],
                 'type'      => 'submit',
-                'value'     => __('Open topic btn'),
+                'value'     => __(['Open topic btn', 1]),
             ];
         } else {
             $form['btns']['close'] = [
                 'class'     => ['origin'],
                 'type'      => 'submit',
-                'value'     => __('Close topic btn'),
+                'value'     => __(['Close topic btn', 1]),
             ];
         }
 

+ 43 - 37
app/lang/en/misc.po

@@ -138,26 +138,25 @@ msgstr "Topics moved."
 msgid "Confirm delete legend"
 msgstr "Please confirm deletion"
 
-msgid "Delete topics"
-msgstr "Delete topics"
-
-msgid "Delete topics comply"
-msgstr "Delete the selected topics (<b>All posts from these topics will be deleted</b>)"
+msgid "Delete topic title"
+msgid_plural "Delete topics title"
+msgstr[0] "Delete topic"
+msgstr[1] "Delete topics"
 
 msgid "Delete topics redirect"
-msgstr "Topics deleted."
+msgid_plural "Delete topics redirect"
+msgstr[0] "Topic deleted."
+msgstr[1] "Topics deleted."
 
 msgid "Open topic redirect"
-msgstr "Topic opened."
-
-msgid "Open topics redirect"
-msgstr "Topics opened."
+msgid_plural "Open topics redirect"
+msgstr[0] "Topic opened."
+msgstr[1] "Topics opened."
 
 msgid "Close topic redirect"
-msgstr "Topic closed."
-
-msgid "Close topics redirect"
-msgstr "Topics closed."
+msgid_plural "Close topics redirect"
+msgstr[0] "Topic closed."
+msgstr[1] "Topics closed."
 
 msgid "Not enough topics selected"
 msgstr "You must select at least two topics for merge."
@@ -201,17 +200,18 @@ msgstr "Are you sure you want to split the selected posts?"
 msgid "Split posts redirect"
 msgstr "Posts have been split."
 
-msgid "Delete posts"
-msgstr "Delete posts"
+msgid "Delete post title"
+msgid_plural "Delete posts title"
+msgstr[0] "Delete post"
+msgstr[1] "Delete posts"
 
 msgid "Cannot select first"
 msgstr "First post cannot be selected for split/delete."
 
-msgid "Delete posts comply"
-msgstr "Delete the selected posts"
-
-msgid "Delete posts redirect"
-msgstr "Posts deleted."
+msgid "Delete post redirect"
+msgid_plural "Delete posts redirect"
+msgstr[0] "Post deleted."
+msgstr[1] "Posts deleted."
 
 msgid "No posts selected"
 msgstr "You must select at least one post for split/delete."
@@ -249,17 +249,15 @@ msgstr "Action not available."
 msgid "No object selected"
 msgstr "You must select at least one object for the action."
 
-msgid "Open topics title"
-msgstr "Open topics"
-
 msgid "Open topic title"
-msgstr "Open topic"
-
-msgid "Close topics title"
-msgstr "Close topics"
+msgid_plural "Open topics title"
+msgstr[0] "Open topic"
+msgstr[1] "Open topics"
 
 msgid "Close topic title"
-msgstr "Close topic"
+msgid_plural "Close topics title"
+msgstr[0] "Close topic"
+msgstr[1] "Close topics"
 
 msgid "Topic links cannot be merged"
 msgstr "Topic links cannot be merged."
@@ -279,20 +277,28 @@ msgstr "Moderate topic"
 msgid "All"
 msgstr "All"
 
+msgid "Delete topic btn"
+msgid_plural "Delete topics btn"
+msgstr[0] "Delete topic"
+msgstr[1] "Delete topics"
+
+msgid "Delete post btn"
+msgid_plural "Delete posts btn"
+msgstr[0] "Delete post"
+msgstr[1] "Delete posts"
+
 msgid "Move topic"
 msgstr "Move topic"
 
 msgid "Open topic btn"
-msgstr "Open topic"
-
-msgid "Open topics btn"
-msgstr "Open topics"
+msgid_plural "Open topics btn"
+msgstr[0] "Open topic"
+msgstr[1] "Open topics"
 
 msgid "Close topic btn"
-msgstr "Close topic"
-
-msgid "Close topics btn"
-msgstr "Close topics"
+msgid_plural "Close topics btn"
+msgstr[0] "Close topic"
+msgstr[1] "Close topics"
 
 msgid "Unstick topic"
 msgstr "Unstick topic"

+ 57 - 39
app/lang/ru/misc.po

@@ -138,26 +138,29 @@ msgstr "Темы перенесены."
 msgid "Confirm delete legend"
 msgstr "Пожалуйста, подтвердите удаление"
 
-msgid "Delete topics"
-msgstr "Удаление тем"
-
-msgid "Delete topics comply"
-msgstr "Удалить выбранные темы (<b>Все сообщения из этих тем будут удалены</b>)"
-
-msgid "Delete topics redirect"
-msgstr "Темы удалены."
+msgid "Delete topic title"
+msgid_plural "Delete topics title"
+msgstr[0] "Удаление темы"
+msgstr[1] "Удаление тем"
+msgstr[2] "Удаление тем"
+
+msgid "Delete topic redirect"
+msgid_plural "Delete topics redirect"
+msgstr[0] "Тема удалена."
+msgstr[1] "Темы удалены."
+msgstr[2] "Темы удалены."
 
 msgid "Open topic redirect"
-msgstr "Тема открыта."
-
-msgid "Open topics redirect"
-msgstr "Темы открыты."
+msgid_plural "Open topics redirect"
+msgstr[0] "Тема открыта."
+msgstr[1] "Темы открыты."
+msgstr[2] "Темы открыты."
 
 msgid "Close topic redirect"
-msgstr "Тема закрыта."
-
-msgid "Close topics redirect"
-msgstr "Темы закрыты."
+msgid_plural "Close topics redirect"
+msgstr[0] "Тема закрыта."
+msgstr[1] "Темы закрыты."
+msgstr[2] "Темы закрыты."
 
 msgid "Not enough topics selected"
 msgstr "Вы должны выбрать хотя бы две темы для объединения."
@@ -201,17 +204,20 @@ msgstr "Вы уверены, что хотите разделить выбран
 msgid "Split posts redirect"
 msgstr "Сообщения разделены."
 
-msgid "Delete posts"
-msgstr "Удаление сообщений"
+msgid "Delete post title"
+msgid_plural "Delete posts title"
+msgstr[0] "Удаление сообщения"
+msgstr[1] "Удаление сообщений"
+msgstr[2] "Удаление сообщений"
 
 msgid "Cannot select first"
 msgstr "Первое сообщение не может быть выбрано."
 
-msgid "Delete posts comply"
-msgstr "Удалить выбранные сообщения"
-
-msgid "Delete posts redirect"
-msgstr "Сообщения удалены."
+msgid "Delete post redirect"
+msgid_plural "Delete posts redirect"
+msgstr[0] "Сообщение удалено."
+msgstr[1] "Сообщения удалены."
+msgstr[2] "Сообщения удалены."
 
 msgid "No posts selected"
 msgstr "Вы должны выбрать хотя бы одно сообщение для данного действия."
@@ -249,17 +255,17 @@ msgstr "Действие недоступно."
 msgid "No object selected"
 msgstr "Вы должны выбрать хотя бы один объект для действия."
 
-msgid "Open topics title"
-msgstr "Открытие тем"
-
 msgid "Open topic title"
-msgstr "Открытие темы"
-
-msgid "Close topics title"
-msgstr "Закрытие тем"
+msgid_plural "Open topics title"
+msgstr[0] "Открытие темы"
+msgstr[1] "Открытие тем"
+msgstr[2] "Открытие тем"
 
 msgid "Close topic title"
-msgstr "Закрытие темы"
+msgid_plural "Close topics title"
+msgstr[0] "Закрытие темы"
+msgstr[1] "Закрытие тем"
+msgstr[2] "Закрытие тем"
 
 msgid "Topic links cannot be merged"
 msgstr "Ссылки на темы не могут быть объединены."
@@ -279,20 +285,32 @@ msgstr "Модерирование темы"
 msgid "All"
 msgstr "All"
 
+msgid "Delete topic btn"
+msgid_plural "Delete topics btn"
+msgstr[0] "Удалить тему"
+msgstr[1] "Удалить темы"
+msgstr[2] "Удалить темы"
+
+msgid "Delete post btn"
+msgid_plural "Delete posts btn"
+msgstr[0] "Удалить сообщение"
+msgstr[1] "Удалить сообщения"
+msgstr[2] "Удалить сообщения"
+
 msgid "Move topic"
 msgstr "Перенести тему"
 
 msgid "Open topic btn"
-msgstr "Открыть тему"
-
-msgid "Open topics btn"
-msgstr "Открыть темы"
+msgid_plural "Open topics btn"
+msgstr[0] "Открыть тему"
+msgstr[1] "Открыть темы"
+msgstr[2] "Открыть темы"
 
 msgid "Close topic btn"
-msgstr "Закрыть тему"
-
-msgid "Close topics btn"
-msgstr "Закрыть темы"
+msgid_plural "Close topics btn"
+msgstr[0] "Закрыть тему"
+msgstr[1] "Закрыть темы"
+msgstr[2] "Закрыть темы"
 
 msgid "Unstick topic"
 msgstr "Снять выделение темы"