mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Add Bootstrap icons to dashboard tabs.
This commit is contained in:
parent
082e5f0fe2
commit
dd85b5ffde
16
themes/farm_theme/js/dashboard.js
Normal file
16
themes/farm_theme/js/dashboard.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
(function ($) {
|
||||
Drupal.behaviors.farm_theme_dashboard = {
|
||||
attach: function(context, settings) {
|
||||
$('ul.tabs--primary li a', context).each(function(index) {
|
||||
var link_text = $(this).clone().children().remove().end().text();
|
||||
var icon = 'leaf';
|
||||
switch (link_text) {
|
||||
case 'Dashboard':
|
||||
icon = 'dashboard';
|
||||
break;
|
||||
}
|
||||
$(this).prepend('<span class="icon glyphicon glyphicon-' + icon + '"></span> ');
|
||||
});
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
|
@ -305,6 +305,12 @@ function farm_theme_preprocess_page(&$vars) {
|
|||
drupal_add_js(drupal_get_path('theme', 'farm_theme') . '/js/help.js');
|
||||
}
|
||||
|
||||
// If we are on a page that shows the Dashboard tabs, add Bootstrap icons to
|
||||
// them via JS.
|
||||
if (!empty($vars['tabs']['#primary'][0]['#link']['path']) && $vars['tabs']['#primary'][0]['#link']['path'] == 'farm/dashboard') {
|
||||
drupal_add_js(drupal_get_path('theme', 'farm_theme') . '/js/dashboard.js');
|
||||
}
|
||||
|
||||
// When the farm_areas map is displayed on a page...
|
||||
if (!empty($vars['page']['content']['farm_areas'])) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue