Skip to content

Commit 0644563

Browse files
committed
Refactor how ideas list pages are named
1 parent 5a42a09 commit 0644563

4 files changed

Lines changed: 14 additions & 13 deletions

File tree

controller/list_controller.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,16 @@ public function ideas_list($sort)
5252
$sort = ideas::SORT_DATE;
5353
}
5454

55-
// if sort by "implemented", sort ideas with status implemented by date
56-
if ($sort === ideas::SORT_IMPLEMENTED)
57-
{
58-
$status = ideas::$statuses['IMPLEMENTED'];
59-
$sort = ideas::SORT_DATE;
60-
}
61-
62-
// Set the status name for displaying in the template
63-
$status_name = (!$status && $sort === ideas::SORT_TOP) ? $this->language->lang('TOP_IDEAS') : $this->ideas->get_status_from_id($status);
55+
// Set the name for displaying in the template
56+
$status_name = 'LIST_' . strtoupper($status > 0 ? array_search($status, ideas::$statuses) : $sort);
57+
$status_name = $this->language->is_set($status_name) ? $this->language->lang($status_name) : '';
6458

6559
// For special case where we want to request ALL ideas,
6660
// including the statuses normally hidden from lists.
6761
if ($status === -1)
6862
{
6963
$status = ideas::$statuses;
70-
$status_name = $this->language->lang('ALL_IDEAS');
64+
$status_name = $status_name ?: $this->language->lang('ALL_IDEAS');
7165
}
7266

7367
// Generate ideas

factory/ideas.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class ideas
2121
{
2222
const SORT_AUTHOR = 'author';
2323
const SORT_DATE = 'date';
24-
const SORT_IMPLEMENTED = 'implemented';
2524
const SORT_NEW = 'new';
2625
const SORT_SCORE = 'score';
2726
const SORT_TITLE = 'title';

language/en/common.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@
5555
'JS_DISABLED' => 'JavaScript is disabled',
5656

5757
'LATEST_IDEAS' => 'Latest Ideas',
58+
'LIST_DUPLICATE' => 'Duplicate ideas',
59+
'LIST_EGOSEARCH' => 'My ideas',
60+
'LIST_IMPLEMENTED' => 'Implemented ideas',
61+
'LIST_IN_PROGRESS' => 'In Progress ideas',
62+
'LIST_INVALID' => 'Invalid ideas',
63+
'LIST_NEW' => 'New ideas',
64+
'LIST_TOP' => 'Top ideas',
65+
5866
'LOGGED_OUT' => 'You must be logged in to do this.',
5967

6068
'NEW' => 'New',

tests/controller/list_controller_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function controller_test_data()
5252
200,
5353
'list_body.html',
5454
array(
55-
'sort' => \phpbb\ideas\factory\ideas::SORT_IMPLEMENTED,
56-
'status' => 0,
55+
'sort' => \phpbb\ideas\factory\ideas::SORT_DATE,
56+
'status' => \phpbb\ideas\factory\ideas::$statuses['IMPLEMENTED'],
5757
),
5858
array(
5959
'sort' => \phpbb\ideas\factory\ideas::SORT_DATE,

0 commit comments

Comments
 (0)