2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2017 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 <style type="text/css">
31 #civicrm-news-feed .collapsed .crm-accordion-header {
32 text-overflow: ellipsis;
37 #civicrm-news-feed .crm-news-feed-item-preview {
41 #civicrm-news-feed .collapsed .crm-news-feed-item-preview {
44 #civicrm-news-feed .crm-news-feed-item-link {
49 <div id="civicrm-news-feed">
51 {foreach from=$feeds item="channel"}
52 <li class="ui-corner-all crm-tab-button" title="{$channel.description|escape}">
53 <a href="#civicrm-news-feed-{$channel.name}">{$channel.title}</a>
58 {foreach from=$feeds item="channel"}
59 <div id="civicrm-news-feed-{$channel.name}">
60 {foreach from=$channel.items item=article}
61 <div class="crm-accordion-wrapper collapsed">
62 <div class="crm-accordion-header">
63 <span class="crm-news-feed-item-title">{$article.title}</span>
64 <span class="crm-news-feed-item-preview"> - {if function_exists('mb_substr')}{$article.description|strip_tags|mb_substr:0:100}{else}{$article.description|strip_tags}{/if}</span>
66 <div class="crm-accordion-body">
67 <div>{$article.description}</div>
68 <p class="crm-news-feed-item-link"><a target="_blank" href="{$article.link}" title="{$article.title|escape}"><i class="crm-i fa-external-link"></i> {ts}read more{/ts}…</a></p>
75 <div class="messages status no-popup">
76 <div class="icon inform-icon"></div>
77 {ts}Sorry but we are not able to provide this at the moment.{/ts}
83 {literal}<script type="text/javascript">
86 $('#civicrm-news-feed').tabs();
87 if (window.localStorage) {
88 var opened = localStorage.newsFeed ? JSON.parse(localStorage.newsFeed) : {};
89 $('#civicrm-news-feed ul.ui-tabs-nav a').each(function() {
92 href = $tab.attr('href'),
94 $items = $('.crm-accordion-wrapper', $content),
95 key = href.substring(19),
97 if (!opened[key]) opened[key] = [];
99 $items.each(function () {
100 var itemKey = $('.crm-news-feed-item-link a', this).attr('href');
101 if ($.inArray(itemKey, opened[key]) < 0) {
102 $('.crm-news-feed-item-title', this).css('font-weight', 'bold');
104 $(this).one('crmAccordion:open', function () {
105 $('.crm-news-feed-item-title', this).css('font-weight', '');
106 $('em', $tab).text(--count);
108 $('em', $tab).remove();
110 opened[key].push(itemKey);
111 localStorage.newsFeed = JSON.stringify(opened);
116 $tab.html($tab.text() + ' <em>' + count + '</em>');
118 // Remove items from localstorage that are no longer in the current feed
119 $.each(opened[key], function(i, itemKey) {
120 if (!$('a[href="' + itemKey + '"]', $content).length) {
121 opened[key][i] = null;
124 _.remove(opened[key], function(n) {return !n});