Skip to content

Commit

Permalink
Feat(UI): add missing icon fron Central page
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebuzz authored and trasher committed May 17, 2024
1 parent 8569f8a commit ef8f694
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/Central.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/

use Glpi\Application\View\TemplateRenderer;
use Glpi\Dashboard\Dashboard;
use Glpi\Event;
use Glpi\Plugin\Hooks;
use Glpi\System\Requirement\PhpSupportedVersion;
Expand Down Expand Up @@ -67,15 +68,15 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)

if ($item->getType() == __CLASS__) {
$tabs = [
1 => __('Personal View'),
2 => __('Group View'),
3 => __('Global View'),
4 => _n('RSS feed', 'RSS feeds', Session::getPluralNumber()),
1 => self::createTabEntry(__('Personal View'), 0, null, User::getIcon()),
2 => self::createTabEntry(__('Group View'), 0, null, Group::getIcon()),
3 => self::createTabEntry(__('Global View'), 0, null, 'ti ti-world'),
4 => self::createTabEntry(_n('RSS feed', 'RSS feeds', Session::getPluralNumber()), 0, null, RSSFeed::getIcon()),
];

$grid = new Glpi\Dashboard\Grid('central');
if ($grid::canViewOneDashboard()) {
array_unshift($tabs, __('Dashboard'));
array_unshift($tabs, self::createTabEntry(__('Dashboard'), 0, null, Dashboard::getIcon()));
}

return $tabs;
Expand Down
5 changes: 5 additions & 0 deletions src/Dashboard/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,4 +622,9 @@ public function isPrivate(): bool
}
return $this->fields['users_id'] != Session::getLoginUserID();
}

public static function getIcon()
{
return "ti ti-dashboard";
}
}
2 changes: 1 addition & 1 deletion templates/layout/parts/menu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
{% if has_dashboard %}
<a class="dropdown-item"
href="{{ path(firstlevel['default_dashboard']) }}">
<i class="ti ti-dashboard"></i>
<i class="{{ call('Glpi\\Dashboard\\Dashboard::getIcon') }}"></i>
{{ __('Dashboard') }}
</a>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/pages/setup/general/preferences_setup.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
{% endif %}
{% if call('\\Glpi\\Dashboard\\Grid::canViewOneDashboard') %}
{{ fields.smallTitle(__('Dashboards'), 'ti ti-dashboard', '', 'section-dashboards') }}
{{ fields.smallTitle(__('Dashboards'), call('Glpi\\Dashboard\\Dashboard::getIcon'), '', 'section-dashboards') }}
{% macro dropdownDashboard(name, config, context = 'core', disabled_option = false) %}
{% do call('\\Glpi\\Dashboard\\Grid::dropdownDashboard', [name, {
value: config[name],
Expand Down

0 comments on commit ef8f694

Please sign in to comment.