Skip to content

Commit

Permalink
Standardize event feed stacked icons
Browse files Browse the repository at this point in the history
  • Loading branch information
agh1 committed May 11, 2020
1 parent 37e04b6 commit 4765c38
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 22 deletions.
57 changes: 57 additions & 0 deletions CRM/Core/Smarty/plugins/block.calIcon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/

/**
*
* @package CRM
* @author Andrew Hunt, AGH Strategies
* $Id$
*
*/

/**
* Display an icon stacked on a calendar icon, with some alternative text.
*
* @param $params
* - icon: the icon class to display on top of fa-calendar-o
* - stack: any classes to add to the stack
*
* @param $text
* The translated text to include in the icon's title and screen-reader text.
*
* @param $smarty
*
* @return string
*/
function smarty_block_calIcon($params, $text, &$smarty) {
if (empty($params['icon'])) {
return '';
}
$stack = ['fa-stack'];
if (!empty($params['stack'])) {
$stack = array_unique(array_merge($stack, explode(' ', trim($params['stack']))));
}
$stack = implode(' ', $stack);
if ($text === NULL || $text === '') {
$title = $sr = '';
}
else {
$text = htmlspecialchars($text);
$title = " title=\"$text\"";
$sr = "<span class=\"sr-only\">$text</span>";
}
return <<<HEREDOC
<span class="$stack"$title>
<i class="crm-i fa-calendar-o fa-stack-2x"></i>
<i style="top: 15%;" class="crm-i {$params['icon']} fa-stack-1x"></i>
</span>$sr
HEREDOC;
}
20 changes: 8 additions & 12 deletions templates/CRM/Event/Page/DashBoard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@
<div class="clear">&nbsp;</div>
<h3 id="crm-event-dashboard-heading">{ts}Event Summary{/ts}
{help id="id-event-intro"}
<a href="{$htmlFeed}" target="_blank" title="{ts}HTML listing of current and future public events.{/ts}" class="crm-event-feed-link">
<span class="fa-stack"><i class="crm-i fa-calendar-o fa-stack-2x"></i><i style="top: 15%;" class="crm-i fa-th-list fa-stack-1x"></i></span>
<span class="sr-only">{ts}HTML listing of current and future public events.{/ts}</span>
<a href="{$htmlFeed}" target="_blank" class="crm-event-feed-link">
{calIcon icon="fa-th-list"}{ts}HTML listing of current and future public events.{/ts}{/calIcon}
</a>
<a href="{$rssFeed}" target="_blank" title="{ts}Get RSS 2.0 feed for current and future public events.{/ts}" class="crm-event-feed-link">
<span class="fa-stack"><i class="crm-i fa-calendar-o fa-stack-2x"></i><i style="top: 15%;" class="crm-i fa-rss fa-stack-1x"></i></span>
<span class="sr-only">{ts}Get RSS 2.0 feed for current and future public events.{/ts}</span>
<a href="{$rssFeed}" target="_blank" class="crm-event-feed-link">
{calIcon icon="fa-rss"}{ts}Get RSS 2.0 feed for current and future public events.{/ts}{/calIcon}
</a>
<a href="{$icalFile}" title="{ts}Download iCalendar file for current and future public events.{/ts}" class="crm-event-feed-link">
<span class="fa-stack"><i class="crm-i fa-calendar-o fa-stack-2x"></i><i style="top: 15%;" class="crm-i fa-download fa-stack-1x"></i></span>
<span class="sr-only">{ts}Download iCalendar entry for this event.{/ts}</span>
<a href="{$icalFile}" target="_blank" class="crm-event-feed-link">
{calIcon icon="fa-download"}{ts}Download iCalendar file for current and future public events.{/ts}{/calIcon}
</a>
<a href="{$icalFeed}" target="_blank" title="{ts}Get iCalendar feed for current and future public events.{/ts}" class="crm-event-feed-link">
<span class="fa-stack"><i class="crm-i fa-calendar-o fa-stack-2x"></i><i style="top: 15%;" class="crm-i fa-link fa-stack-1x"></i></span>
<span class="sr-only">{ts}iCalendar feed for this event.{/ts}</span>
<a href="{$icalFeed}" target="_blank" class="crm-event-feed-link">
{calIcon icon="fa-link"}{ts}Get iCalendar feed for current and future public events.{/ts}{/calIcon}
</a>
</h3>
{include file="CRM/common/jsortable.tpl"}
Expand Down
16 changes: 12 additions & 4 deletions templates/CRM/Event/Page/ManageEvent.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@

<div class="crm-block crm-content-block">
<div class="float-right">
<a href="{$htmlFeed}" target="_blank" title="{ts}HTML listing of current and future public events.{/ts}" class="crm-event-feed-link"><i class="crm-i fa-lg fa-calendar"></i></a>
<a href="{$rssFeed}" target="_blank" title="{ts}Get RSS 2.0 feed for current and future public events.{/ts}" class="crm-event-feed-link"><i class="crm-i fa-lg fa-rss"></i></a>
<a href="{$icalFile}" title="{ts}Download iCalendar file for current and future public events.{/ts}" class="crm-event-feed-link"><i class="crm-i fa-lg fa-download"></i></a>
<a href="{$icalFeed}" target="_blank" title="{ts}Get iCalendar feed for current and future public events.{/ts}" class="crm-event-feed-link"><i class="crm-i fa-lg fa-calendar-o"></i></a>
<a href="{$htmlFeed}" target="_blank" class="crm-event-feed-link">
{calIcon icon="fa-th-list"}{ts}HTML listing of current and future public events.{/ts}{/calIcon}
</a>
<a href="{$rssFeed}" target="_blank" class="crm-event-feed-link">
{calIcon icon="fa-rss"}{ts}Get RSS 2.0 feed for current and future public events.{/ts}{/calIcon}
</a>
<a href="{$icalFile}" target="_blank" class="crm-event-feed-link">
{calIcon icon="fa-download"}{ts}Download iCalendar file for current and future public events.{/ts}{/calIcon}
</a>
<a href="{$icalFeed}" target="_blank" class="crm-event-feed-link">
{calIcon icon="fa-link"}{ts}Get iCalendar feed for current and future public events.{/ts}{/calIcon}
</a>
{help id='icalendar'}
</div>

Expand Down
10 changes: 4 additions & 6 deletions templates/CRM/Event/Page/iCalLinks.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
{capture assign=icalFile}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" fe=1 a=1}{/capture}
{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&list=1&id=`$event.id`" fe=1 a=1}{/capture}
<div class="action-link section iCal_links-section">
<a href="{$icalFile}" title="{ts}Download iCalendar entry for this event.{/ts}">
<span class="fa-stack"><i class="crm-i fa-calendar-o fa-stack-2x"></i><i style="top: 15%;" class="crm-i fa-download fa-stack-1x"></i></span>
<span class="sr-only">{ts}Download iCalendar entry for this event.{/ts}</span>
<a href="{$icalFile}" target="_blank">
{calIcon icon="fa-download"}{ts}Download iCalendar entry for this event.{/ts}{/calIcon}
</a>
<a href="{$icalFeed}" title="{ts}iCalendar feed for this event.{/ts}">
<span class="fa-stack"><i class="crm-i fa-calendar-o fa-stack-2x"></i><i style="top: 15%;" class="crm-i fa-link fa-stack-1x"></i></span>
<span class="sr-only">{ts}iCalendar feed for this event.{/ts}</span>
<a href="{$icalFeed}" target="_blank">
{calIcon icon="fa-link"}{ts}iCalendar feed for this event.{/ts}{/calIcon}
</a>
</div>

0 comments on commit 4765c38

Please sign in to comment.