2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
11 <style type="text/css">
15 #civicrm-news-feed .crm-news-feed-unread .crm-news-feed-item-title {
18 #civicrm-news-feed .collapsed .crm-accordion-header {
19 text-overflow: ellipsis;
24 #civicrm-news-feed .crm-news-feed-item-preview {
28 #civicrm-news-feed .collapsed .crm-news-feed-item-preview {
31 #civicrm-news-feed .crm-news-feed-item-link {
36 <div id="civicrm-news-feed">
38 {foreach from=$feeds item="channel"}
39 <li class="ui-corner-all crm-tab-button" title="{$channel.description|escape}">
40 <a href="#civicrm-news-feed-{$channel.name}">{$channel.title}</a>
45 {foreach from=$feeds item="channel"}
46 <div id="civicrm-news-feed-{$channel.name}">
47 {foreach from=$channel.items item=article}
48 <div class="crm-accordion-wrapper collapsed">
49 <div class="crm-accordion-header">
50 <span class="crm-news-feed-item-title">{$article.title|smarty:nodefaults|purify}</span>
51 <span class="crm-news-feed-item-preview"> - {if function_exists('mb_substr')}{$article.description|smarty:nodefaults|strip_tags|mb_substr:0:150}{else}{$article.description|smarty:nodefaults|strip_tags}{/if}</span>
53 <div class="crm-accordion-body">
54 <div>{$article.description|smarty:nodefaults|purify}</div>
55 <p class="crm-news-feed-item-link"><a target="_blank" href="{$article.link|smarty:nodefaults|purify}" title="{$article.title|smarty:nodefaults|escape}"><i class="crm-i fa-external-link" aria-hidden="true"></i> {ts}read more{/ts}…</a></p>
62 <div class="messages status no-popup">
63 {icon icon="fa-info-circle"}{/icon}
64 {ts}Sorry but we are not able to provide this at the moment.{/ts}
70 {literal}<script type="text/javascript">
73 $('#civicrm-news-feed').tabs();
74 var opened = CRM.cache.get('newsFeed', {});
75 $('#civicrm-news-feed ul.ui-tabs-nav a').each(function() {
78 href = $tab.attr('href'),
80 $items = $('.crm-accordion-wrapper', $content),
81 key = href.substring(19),
83 if (!opened[key]) opened[key] = [];
85 $items.each(function () {
86 var itemKey = $('.crm-news-feed-item-link a', this).attr('href');
87 if ($.inArray(itemKey, opened[key]) < 0) {
88 $(this).addClass('crm-news-feed-unread');
90 $(this).one('crmAccordion:open', function () {
91 $(this).removeClass('crm-news-feed-unread');
92 $('em', $tab).text(--count || '');
93 opened[key].push(itemKey);
94 CRM.cache.set('newsFeed', opened);
99 $tab.html($tab.text() + ' <em>' + count + '</em>');
101 // Remove items from localstorage that are no longer in the current feed
102 _.remove(opened[key], function(itemKey) {
103 return !$('a[href="' + itemKey + '"]', $content).length;