show cumulative score adjustment (if any) and up to 3 actions total in filter tree
This commit is contained in:
@@ -10,6 +10,8 @@ class Pref_Filters extends Handler_Protected {
|
|||||||
const PARAM_ACTIONS = [self::ACTION_TAG, self::ACTION_SCORE,
|
const PARAM_ACTIONS = [self::ACTION_TAG, self::ACTION_SCORE,
|
||||||
self::ACTION_LABEL, self::ACTION_PLUGIN, self::ACTION_REMOVE_TAG];
|
self::ACTION_LABEL, self::ACTION_PLUGIN, self::ACTION_REMOVE_TAG];
|
||||||
|
|
||||||
|
const MAX_ACTIONS_TO_DISPLAY = 3;
|
||||||
|
|
||||||
/** @var array<int,array<mixed>> $action_descriptions */
|
/** @var array<int,array<mixed>> $action_descriptions */
|
||||||
private $action_descriptions = [];
|
private $action_descriptions = [];
|
||||||
|
|
||||||
@@ -746,23 +748,35 @@ class Pref_Filters extends Handler_Protected {
|
|||||||
->order_by_asc('id')
|
->order_by_asc('id')
|
||||||
->find_many();
|
->find_many();
|
||||||
|
|
||||||
$actions_summary = "";
|
/** @var array<string> $actions_summary */
|
||||||
|
$actions_summary = [];
|
||||||
$cumulative_score = 0;
|
$cumulative_score = 0;
|
||||||
|
|
||||||
|
// we're going to show a summary adjustment so we skip individual score action descriptions here
|
||||||
foreach ($actions as $action) {
|
foreach ($actions as $action) {
|
||||||
if ($action->action_id == self::ACTION_SCORE)
|
if ($action->action_id == self::ACTION_SCORE) {
|
||||||
$cumulative_score += (int) $action->action_param;
|
$cumulative_score += (int) $action->action_param;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($actions_summary == "")
|
array_push($actions_summary, self::_get_action_name($action));
|
||||||
$actions_summary = self::_get_action_name($action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cumulative_score) array_push($title_summary, T_sprintf("sets score: %d", $cumulative_score));
|
// inject a fake action description using cumulative filter score
|
||||||
|
if ($cumulative_score != 0) {
|
||||||
|
array_unshift($actions_summary,
|
||||||
|
self::_get_action_name(["action_id" => self::ACTION_SCORE, "action_param" => $cumulative_score]));
|
||||||
|
}
|
||||||
|
|
||||||
if (count($actions) > 1)
|
if (count($actions_summary) > self::MAX_ACTIONS_TO_DISPLAY) {
|
||||||
$actions_summary .= " " . sprintf(_ngettext("(+%d action)", "(+%d actions)", count($actions) - 1), count($actions) - 1);
|
$actions_not_shown = count($actions_summary) - self::MAX_ACTIONS_TO_DISPLAY;
|
||||||
|
$actions_summary = array_slice($actions_summary, 0, self::MAX_ACTIONS_TO_DISPLAY);
|
||||||
|
|
||||||
return [implode(", ", $title_summary), $actions_summary];
|
array_push($actions_summary,
|
||||||
|
sprintf(_ngettext("(+%d action)", "(+%d actions)", $actions_not_shown), $actions_not_shown));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [implode(", ", $title_summary), implode("<br/>", $actions_summary)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -1964,6 +1964,7 @@ body.ttrss_utility.share_popup .content {
|
|||||||
.flat .dijitTree .labelParam {
|
.flat .dijitTree .labelParam {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|||||||
@@ -1866,6 +1866,7 @@ body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
|
|||||||
.flat .dijitTree .labelParam {
|
.flat .dijitTree .labelParam {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|||||||
@@ -1964,6 +1964,7 @@ body.ttrss_utility.share_popup .content {
|
|||||||
.flat .dijitTree .labelParam {
|
.flat .dijitTree .labelParam {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|||||||
@@ -1964,6 +1964,7 @@ body.ttrss_utility.share_popup .content {
|
|||||||
.flat .dijitTree .labelParam {
|
.flat .dijitTree .labelParam {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|||||||
@@ -151,6 +151,7 @@
|
|||||||
.labelParam {
|
.labelParam {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dijitTreeRow.filterDisabled {
|
.dijitTreeRow.filterDisabled {
|
||||||
|
|||||||
@@ -1867,6 +1867,7 @@ body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
|
|||||||
.flat .dijitTree .labelParam {
|
.flat .dijitTree .labelParam {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|||||||
@@ -1867,6 +1867,7 @@ body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
|
|||||||
.flat .dijitTree .labelParam {
|
.flat .dijitTree .labelParam {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
.flat .dijitTree .dijitTreeRow.filterDisabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|||||||
Reference in New Issue
Block a user