Ver código fonte

Update moderation page

Visman 3 anos atrás
pai
commit
c1180f8699

+ 11 - 9
app/Models/Pages/Moderate.php

@@ -272,6 +272,8 @@ class Moderate extends Page
             );
         }
 
+        $this->single = 1 === \count($objects);
+
         return $this->{'action' . \ucfirst($v->action)}($objects, $v);
     }
 
@@ -284,8 +286,8 @@ class Moderate extends Page
     {
         switch ($v->step) {
             case 1:
-                $this->formTitle   = __('Open topics');
-                $this->buttonValue = __('Open');
+                $this->formTitle   = __($this->single ? 'Open topic title' : 'Open topics title');
+                $this->buttonValue = __($this->single ? 'Open topic btn' : 'Open topics btn');
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
                 $this->form        = $this->formConfirm($topics, $v);
 
@@ -294,7 +296,7 @@ class Moderate extends Page
                 if (1 === $v->confirm) {
                     $this->c->topics->access(true, ...$topics);
 
-                    $message = 1 === \count($topics) ? 'Open topic redirect' : 'Open topics redirect';
+                    $message = $this->single ? 'Open topic redirect' : 'Open topics redirect';
 
                     return $this->c->Redirect->url($this->backLink)->message($message);
                 } else {
@@ -309,8 +311,8 @@ class Moderate extends Page
     {
         switch ($v->step) {
             case 1:
-                $this->formTitle   = __('Close topics');
-                $this->buttonValue = __('Close');
+                $this->formTitle   = __($this->single ? 'Close topic title' : 'Close topics title');
+                $this->buttonValue = __($this->single ? 'Close topic btn' : 'Close topics btn');
                 $this->crumbs      = $this->crumbs($this->formTitle, __('Moderate'), $v->topic ? $this->curTopic : $this->curForum);
                 $this->form        = $this->formConfirm($topics, $v);
 
@@ -319,7 +321,7 @@ class Moderate extends Page
                 if (1 === $v->confirm) {
                     $this->c->topics->access(false, ...$topics);
 
-                    $message = 1 === \count($topics) ? 'Close topic redirect' : 'Close topics redirect';
+                    $message = $this->single ? 'Close topic redirect' : 'Close topics redirect';
 
                     return $this->c->Redirect->url($this->backLink)->message($message);
                 } else {
@@ -392,7 +394,7 @@ class Moderate extends Page
                     $forum = $this->c->forums->get($v->destination);
                     $this->c->topics->move(1 === $v->redirect, $forum, ...$topics);
 
-                    $message = 1 === \count($topics) ? 'Move topic redirect' : 'Move topics redirect';
+                    $message = $this->single ? 'Move topic redirect' : 'Move topics redirect';
 
                     return $this->c->Redirect->url($this->curForum->link)->message($message);
                 } else {
@@ -456,7 +458,7 @@ class Moderate extends Page
                         $this->c->topics->update($topic);
                     }
 
-                    $message = 1 === \count($topics) ? 'Unstick topic redirect' : 'Unstick topics redirect';
+                    $message = $this->single ? 'Unstick topic redirect' : 'Unstick topics redirect';
 
                     return $this->c->Redirect->url($this->backLink)->message($message);
                 } else {
@@ -484,7 +486,7 @@ class Moderate extends Page
                         $this->c->topics->update($topic);
                     }
 
-                    $message = 1 === \count($topics) ? 'Stick topic redirect' : 'Stick topics redirect';
+                    $message = $this->single ? 'Stick topic redirect' : 'Stick topics redirect';
 
                     return $this->c->Redirect->url($this->backLink)->message($message);
                 } else {

+ 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'),
+                'value'     => __('Open topic btn'),
             ];
         } else {
             $form['btns']['close'] = [
                 'class'     => ['origin'],
                 'type'      => 'submit',
-                'value'     => __('Close topic'),
+                'value'     => __('Close topic btn'),
             ];
         }
 

+ 3 - 0
app/lang/en/common.po

@@ -49,6 +49,9 @@ msgstr "Operation cancelled."
 msgid "No confirm redirect"
 msgstr "No confirmation provided. Operation cancelled."
 
+msgid "Confirm action"
+msgstr "Confirm action"
+
 msgid "Forum rules"
 msgstr "Forum rules"
 

+ 15 - 6
app/lang/en/misc.po

@@ -249,14 +249,17 @@ msgstr "Action not available."
 msgid "No object selected"
 msgstr "You must select at least one object for the action."
 
-msgid "Open topics"
+msgid "Open topics title"
 msgstr "Open topics"
 
-msgid "Close topics"
+msgid "Open topic title"
+msgstr "Open topic"
+
+msgid "Close topics title"
 msgstr "Close topics"
 
-msgid "Confirm action"
-msgstr "Confirm action"
+msgid "Close topic title"
+msgstr "Close topic"
 
 msgid "Topic links cannot be merged"
 msgstr "Topic links cannot be merged."
@@ -279,12 +282,18 @@ msgstr "All"
 msgid "Move topic"
 msgstr "Move topic"
 
-msgid "Open topic"
+msgid "Open topic btn"
 msgstr "Open topic"
 
-msgid "Close topic"
+msgid "Open topics btn"
+msgstr "Open topics"
+
+msgid "Close topic btn"
 msgstr "Close topic"
 
+msgid "Close topics btn"
+msgstr "Close topics"
+
 msgid "Unstick topic"
 msgstr "Unstick topic"
 

+ 3 - 0
app/lang/ru/common.po

@@ -49,6 +49,9 @@ msgstr "Операция отменена."
 msgid "No confirm redirect"
 msgstr "Подтверждение не получено. Операция отменена."
 
+msgid "Confirm action"
+msgstr "Подтверждаю действие"
+
 msgid "Forum rules"
 msgstr "Правила форума"
 

+ 15 - 6
app/lang/ru/misc.po

@@ -249,14 +249,17 @@ msgstr "Действие недоступно."
 msgid "No object selected"
 msgstr "Вы должны выбрать хотя бы один объект для действия."
 
-msgid "Open topics"
+msgid "Open topics title"
 msgstr "Открытие тем"
 
-msgid "Close topics"
+msgid "Open topic title"
+msgstr "Открытие темы"
+
+msgid "Close topics title"
 msgstr "Закрытие тем"
 
-msgid "Confirm action"
-msgstr "Подтверждаю действие"
+msgid "Close topic title"
+msgstr "Закрытие темы"
 
 msgid "Topic links cannot be merged"
 msgstr "Ссылки на темы не могут быть объединены."
@@ -279,12 +282,18 @@ msgstr "All"
 msgid "Move topic"
 msgstr "Перенести тему"
 
-msgid "Open topic"
+msgid "Open topic btn"
 msgstr "Открыть тему"
 
-msgid "Close topic"
+msgid "Open topics btn"
+msgstr "Открыть темы"
+
+msgid "Close topic btn"
 msgstr "Закрыть тему"
 
+msgid "Close topics btn"
+msgstr "Закрыть темы"
+
 msgid "Unstick topic"
 msgstr "Снять выделение темы"