Merge pull request #22188 from totten/master-uninstall
[civicrm-core.git] / templates / CRM / Dashlet / Page / Blog.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
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 +--------------------------------------------------------------------+
9 *}
10 {strip}{literal}
11 <style type="text/css">
12 #civicrm-news-feed {
13 border: 0 none;
14 }
15 #civicrm-news-feed .crm-news-feed-unread .crm-news-feed-item-title {
16 font-weight: bold;
17 }
18 #civicrm-news-feed .collapsed .crm-accordion-header {
19 text-overflow: ellipsis;
20 text-wrap: none;
21 white-space: nowrap;
22 overflow: hidden;
23 }
24 #civicrm-news-feed .crm-news-feed-item-preview {
25 color: #8d8d8d;
26 display: none;
27 }
28 #civicrm-news-feed .collapsed .crm-news-feed-item-preview {
29 display: inline;
30 }
31 #civicrm-news-feed .crm-news-feed-item-link {
32 margin-bottom: 0;
33 }
34 </style>
35 {/literal}
36 <div id="civicrm-news-feed">
37 <ul>
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>
41 </li>
42 {/foreach}
43 </ul>
44
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>
52 </div>
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>
56 </div>
57 </div>
58 {/foreach}
59 </div>
60 {/foreach}
61 {if !$feeds}
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}
65 </div>
66 {/if}
67 </div>
68
69 </div>
70 {literal}<script type="text/javascript">
71 (function($, _) {
72 $(function() {
73 $('#civicrm-news-feed').tabs();
74 var opened = CRM.cache.get('newsFeed', {});
75 $('#civicrm-news-feed ul.ui-tabs-nav a').each(function() {
76 var
77 $tab = $(this),
78 href = $tab.attr('href'),
79 $content = $(href),
80 $items = $('.crm-accordion-wrapper', $content),
81 key = href.substring(19),
82 count = 0;
83 if (!opened[key]) opened[key] = [];
84 if ($items.length) {
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');
89 ++count;
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);
95 });
96 }
97 });
98 if (count) {
99 $tab.html($tab.text() + ' <em>' + count + '</em>');
100 }
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;
104 });
105 }
106 });
107 });
108 })(CRM.$, CRM._);
109 </script>{/literal}
110 {/strip}