Merge pull request #11005 from totten/master-visual-bundle
[civicrm-core.git] / templates / CRM / Dashlet / Page / Blog.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2017 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
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. |
12 | |
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. |
17 | |
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 +--------------------------------------------------------------------+
25 *}
26 {strip}{literal}
27 <style type="text/css">
28 #civicrm-news-feed {
29 border: 0 none;
30 }
31 #civicrm-news-feed .collapsed .crm-accordion-header {
32 text-overflow: ellipsis;
33 text-wrap: none;
34 white-space: nowrap;
35 overflow: hidden;
36 }
37 #civicrm-news-feed .crm-news-feed-item-preview {
38 color: #8d8d8d;
39 display: none;
40 }
41 #civicrm-news-feed .collapsed .crm-news-feed-item-preview {
42 display: inline;
43 }
44 #civicrm-news-feed .crm-news-feed-item-link {
45 margin-bottom: 0;
46 }
47 </style>
48 {/literal}
49 <div id="civicrm-news-feed">
50 <ul>
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>
54 </li>
55 {/foreach}
56 </ul>
57
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>
65 </div>
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>
69 </div>
70 </div>
71 {/foreach}
72 </div>
73 {/foreach}
74 {if !$feeds}
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}
78 </div>
79 {/if}
80 </div>
81
82 </div>
83 {literal}<script type="text/javascript">
84 (function($, _) {
85 $(function() {
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() {
90 var
91 $tab = $(this),
92 href = $tab.attr('href'),
93 $content = $(href),
94 $items = $('.crm-accordion-wrapper', $content),
95 key = href.substring(19),
96 count = 0;
97 if (!opened[key]) opened[key] = [];
98 if ($items.length) {
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');
103 ++count;
104 $(this).one('crmAccordion:open', function () {
105 $('.crm-news-feed-item-title', this).css('font-weight', '');
106 $('em', $tab).text(--count);
107 if (!count) {
108 $('em', $tab).remove();
109 }
110 opened[key].push(itemKey);
111 localStorage.newsFeed = JSON.stringify(opened);
112 });
113 }
114 });
115 if (count) {
116 $tab.html($tab.text() + ' <em>' + count + '</em>');
117 }
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;
122 }
123 });
124 _.remove(opened[key], function(n) {return !n});
125 }
126 });
127 }
128 });
129 })(CRM.$, CRM._);
130 </script>{/literal}
131 {/strip}