Selaa lähdekoodia

Add reverse sort order of topics on a forum page

Visman 2 vuotta sitten
vanhempi
commit
c11d8cd6a1

+ 9 - 0
app/Models/Forum/Forum.php

@@ -424,6 +424,15 @@ class Forum extends DataModel
             case 2:
                 $sortBy = 't.subject ASC';
                 break;
+            case 4:
+                $sortBy = 't.last_post ASC';
+                break;
+            case 5:
+                $sortBy = 't.posted ASC';
+                break;
+            case 6:
+                $sortBy = 't.subject DESC';
+                break;
             default:
                 $sortBy = 't.last_post DESC';
                 break;

+ 7 - 4
app/Models/Pages/Admin/Forums.php

@@ -361,7 +361,7 @@ class Forums extends Admin
                     'forum_name'           => 'required|string:trim|max:80',
                     'forum_desc'           => 'exist|string:trim|max:65000 bytes|html',
                     'parent'               => 'required|integer|in:' . \implode(',', $this->listOfIndexes),
-                    'sort_by'              => 'required|integer|in:0,1,2',
+                    'sort_by'              => 'required|integer|in:0,1,2,4,5,6',
                     'redirect_url'         => 'string:trim|max:255', //???? это поле может быть отключено в форме
                     'no_sum_mess'          => 'required|integer|in:0,1',
                     'perms.*.read_forum'   => 'checkbox',
@@ -474,9 +474,12 @@ class Forums extends Admin
                 'sort_by' => [
                     'type'    => 'select',
                     'options' => [
-                        0 => __('Last post option'),
-                        1 => __('Topic start option'),
-                        2 => __('Subject option'),
+                        0 => __('Last post option DESC'),
+                        1 => __('Topic start option DESC'),
+                        2 => __('Subject option ASC'),
+                        4 => __('Last post option ASC'),
+                        5 => __('Topic start option ASC'),
+                        6 => __('Subject option DESC'),
                     ],
                     'value'   => $forum->sort_by,
                     'caption' => 'Sort by label',

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

@@ -69,14 +69,23 @@ msgstr "Description (HTML)"
 msgid "Sort by label"
 msgstr "Sort topics by"
 
-msgid "Last post option"
-msgstr "Last post"
+msgid "Last post option DESC"
+msgstr "Last post (newest first)"
 
-msgid "Topic start option"
-msgstr "Topic start"
+msgid "Last post option ASC"
+msgstr "Last post (newest last)"
 
-msgid "Subject option"
-msgstr "Subject"
+msgid "Topic start option DESC"
+msgstr "Topic start (newest first)"
+
+msgid "Topic start option ASC"
+msgstr "Topic start (newest last)"
+
+msgid "Subject option ASC"
+msgstr "Subject (A...Z)"
+
+msgid "Subject option DESC"
+msgstr "Subject (Z...A)"
 
 msgid "Redirect label"
 msgstr "Redirect URL"

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

@@ -69,14 +69,23 @@ msgstr "Описание (HTML)"
 msgid "Sort by label"
 msgstr "Сортировать темы по"
 
-msgid "Last post option"
-msgstr "Последнему сообщению"
+msgid "Last post option DESC"
+msgstr "Последнему сообщению (новые вверху)"
 
-msgid "Topic start option"
-msgstr "Первому сообщению"
+msgid "Last post option ASC"
+msgstr "Последнему сообщению (новые внизу)"
 
-msgid "Subject option"
-msgstr "Заголовку"
+msgid "Topic start option DESC"
+msgstr "Первому сообщению (новые вверху)"
+
+msgid "Topic start option ASC"
+msgstr "Первому сообщению (новые внизу)"
+
+msgid "Subject option ASC"
+msgstr "Заголовку (А...Я)"
+
+msgid "Subject option DESC"
+msgstr "Заголовку (Я...А)"
 
 msgid "Redirect label"
 msgstr "URL переадресации"