ElkArte Community

Project Support => Support => Topic started by: Jorin on August 26, 2015, 01:02:29 am

Title: menu buttons with FontAwesome icons?
Post by: Jorin on August 26, 2015, 01:02:29 am
Is there a way to place FontAwesome icons in front of the text of the menu buttons (community, my messages, mentions and so on)?
Title: Re: menu buttons with FontAwesome icons?
Post by: inter on August 26, 2015, 01:58:35 am
Maybe replace value in "title" for SUBSDIR . '/Subs.php

Code: [Select]
			'home' => array(
'title' => '<i class="fa fa-home fa-lg"></i> ' . $txt['community'],

https://fortawesome.github.io/Font-Awesome/cheatsheet/
https://fortawesome.github.io/Font-Awesome/examples/
Title: Re: menu buttons with FontAwesome icons?
Post by: Jorin on August 26, 2015, 02:03:17 am
And this FontAwesome CSS code works in Subs.php out of the box? I thought this would be too easy.  ;)
Title: Re: menu buttons with FontAwesome icons?
Post by: wintstar on August 26, 2015, 02:11:57 am
Yes,for more icons it may have to be updated => https://github.com/elkarte/Elkarte/issues/2186
Title: Re: menu buttons with FontAwesome icons?
Post by: Jorin on August 26, 2015, 02:33:24 am
Works great, thanks a lot!  :)

Only problem ist the admin button which shows no icon. I think I made a mistake:

Code: [Select]
		// Will change title correctly if user is either a mod or an admin.
// Button highlighting works properly too (see current action stuffz).
if ($context['allow_admin'])
{
$buttons['admin'] = array(
'title' => '<i class="fa fa-cog fa-lg"></i> ' . $context['current_action'] !== 'moderate' ? $txt['admin'] : $txt['moderate'],
'counter' => 'grand_total',
'href' => $scripturl . '?action=admin',
'data-icon' => '',
'show' => true,
'sub_buttons' => array(
'admin_center' => array(
'title' => $txt['admin_center'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
),
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'moderate_sub' => array(
'title' => $txt['moderate'],
'counter' => 'grand_total',
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'reports' => array(
'title' => $txt['mc_reported_posts'],
'counter' => 'reports',
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'counter' => 'attachments',
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'counter' => 'postmod',
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'postbyemail' => array(
'title' => $txt['mc_emailerror'],
'counter' => 'emailmod',
'href' => $scripturl . '?action=admin;area=maillist;sa=emaillist',
'show' => !empty($modSettings['maillist_enabled']) && allowedTo('approve_emails'),
),
),
),
),
);
}
else
{
$buttons['admin'] = array(
'title' => '<i class="fa fa-cog fa-lg"></i> ' . $txt['moderate'],
'counter' => 'grand_total',
'href' => $scripturl . '?action=moderate',
'data-icon' => '',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'reports' => array(
'title' => $txt['mc_reported_posts'],
'counter' => 'reports',
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'counter' => 'attachments',
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'counter' => 'postmod',
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'postbyemail' => array(
'title' => $txt['mc_emailerror'],
'counter' => 'emailmod',
'href' => $scripturl . '?action=admin;area=maillist;sa=emaillist',
'show' => !empty($modSettings['maillist_enabled']) && allowedTo('approve_emails'),
),
),
);
}
Title: Re: menu buttons with FontAwesome icons?
Post by: Spuds on August 26, 2015, 09:58:48 am
Code: (this is wrong) [Select]
'title' => '<i class="fa fa-cog fa-lg"></i> ' . $context['current_action'] !== 'moderate' ? $txt['admin'] : $txt['moderate'],
Code: (needs to be) [Select]
'title' => '<i class="fa fa-cog fa-lg"></i> ' . ($context['current_action'] !== 'moderate' ? $txt['admin'] : $txt['moderate']),
Title: Re: menu buttons with FontAwesome icons?
Post by: Jorin on August 27, 2015, 01:16:37 am
Perfect, thanks!  :)