Bug 13782: RSS for news needs a bit of styling
authorOwen Leonard <oleonard@myacpl.org>
Fri, 22 Mar 2019 18:16:33 +0000 (18:16 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Sat, 23 Mar 2019 09:43:01 +0000 (09:43 +0000)
This patch makes a number of updates to the display of news in the OPAC.
I hope that this makes OPAC news nicer/easier to read. It includes style
changes to make the RSS link look better too.

To test, apply the patch and regenerate the OPAC CSS. You should have
multiple active news items. View the OPAC news with varied values of
NewsAuthorDisplay and OpacNewsLibrarySelect.

Test the single news item view. Test with Quotes on and off, and with
OpacMainUserBlock populated or not.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt

index a4c135f..20fc1cd 100644 (file)
@@ -515,29 +515,41 @@ th {
 
 #news {
     margin: .5em 0;
+    padding: 1em;
+
+    .newsitem {
+        &:last-child {
+            .newsfooter {
+                border-bottom: 0;
+            }
+        }
+    }
 }
 
 .newscontainer {
     border: 1px solid #DDD;
-    border-bottom-width: 0;
 }
 
 .newsheader {
-    background-color: #f0f3f3;
-    border-bottom: 1px solid #DDD;
-    color: #727272;
     margin: 0;
-    padding: 8px;
+    padding: 8px 0;
 }
 
 .newsbody {
-    padding: 8px;
+    padding: 8px 0;
 }
 
 .newsfooter {
-    border-bottom: 1px solid #DDD;
-    font-style: italic;
-    padding: 4px 8px;
+    border-bottom: 1px solid #EEE;
+    color: #727272;
+    font-size: 90%;
+    margin-bottom: .5em;
+    padding-bottom: .5em;
+}
+
+#rssnews-container {
+    color: #727272;
+    font-size: 90%;
 }
 
 #rssnews-container {
index e02635f..46768ca 100644 (file)
     [% ELSE %]
         <div class="span12">
     [% END %]
-            [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
+
+        [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
+            [% UNLESS news_item %]
                 <form id="news-branch-select" class="form-inline" name="news-branch-select" method="get" action="/cgi-bin/koha/opac-main.pl">
-                <label for="news-branch">Display news for: </label>
-                <select id="news-branch" name="branch">
-                [% IF ( branchcode == "" ) %]
-                <option value="" selected="selected">system-wide only</option>
-                [% ELSE %]
-                <option value=""         >system-wide only</option>
-                [% END %]
-                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
-                </select>
+                    <label for="news-branch">Display news for: </label>
+                    <select id="news-branch" name="branch">
+                        [% IF ( branchcode == "" ) %]
+                            <option value="" selected="selected">System-wide only</option>
+                        [% ELSE %]
+                            <option value="">System-wide only</option>
+                        [% END %]
+                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
+                    </select>
                 </form>
             [% END %]
+        [% END %]
 
         [% IF ( koha_news ) %]
 
 
             [% ELSE %]
 
-            <div id="news" class="newscontainer">
-                [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
-                [% FOREACH koha_new IN koha_news %]
-                    <div class="newsitem">
-                        <a name="newsitem[% koha_new.idnew | html %]" href="/cgi-bin/koha/opac-main.pl?news_id=[% koha_new.idnew | uri %]"><h4 class="newsheader">[% koha_new.title | html %]</h4></a>
-                        <div class="newsbody">[% koha_new.content | $raw %]</div>
-                        <div class="newsfooter">(published on [% koha_new.timestamp | $KohaDates with_hours = 1 %][% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %][% END %])</div>
-                    </div>
-                [% END %]
-            </div>
-
-            [% END %]
-
-            [% UNLESS news_item %] <!-- unless single news item -->
+                <div id="news" class="newscontainer">
+                    [% SET newsdisp = ( Koha.Preference('NewsAuthorDisplay') ) %]
+                    [% FOREACH koha_new IN koha_news %]
+                        <div class="newsitem">
+                            <h4 class="newsheader">
+                                [% IF ( news_item ) %]
+                                    [% koha_new.title | html %]
+                                [% ELSE %]
+                                    <a name="newsitem[% koha_new.idnew | html %]" href="/cgi-bin/koha/opac-main.pl?news_id=[% koha_new.idnew | uri %]">[% koha_new.title | html %]</a>
+                                [% END %]
+                            </h4>
+                            <div class="newsbody">[% koha_new.content | $raw %]</div>
+                            <div class="newsfooter">
+                                Published on [% koha_new.timestamp | $KohaDates with_hours = 1 %]
+                                [% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %]
+                                    by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %]
+                                [% END %]
+                                [% IF ( news_item ) %]
+                                    &bull; <a href="/cgi-bin/koha/opac-main.pl">Show all news</a>
+                                [% END %]
+                            </div>
+                        </div>
 
-            <div id="rssnews-container">
-                <!-- Logged in users have a branch code or it could be explicitly set -->
-                <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode | uri %]"><i class="fa fa-rss"></i>
-                [% IF Branches.all.size == 1 %]
-                    [% IF branchcode %]
-                        RSS feed for [% Branches.GetName( branchcode ) | html %] library news.
-                    [% ELSE %]
-                        RSS feed for library news.
                     [% END %]
-                [% ELSE %]
-                    [% IF branchcode %]
-                        RSS feed for [% Branches.GetName( branchcode ) | html %] and system-wide library news.
-                    [% ELSE %]
-                        RSS feed for system-wide library news.
+                    [% UNLESS news_item %]
+                        <div id="rssnews-container">
+                            <!-- Logged in users have a branch code or it could be explicitly set -->
+                            <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-news-rss.pl?branchcode=[% branchcode | uri %]">
+                                <i class="fa fa-rss"></i>
+                                [% IF Branches.all.size == 1 %]
+                                    [% IF branchcode %]
+                                        RSS feed for [% Branches.GetName( branchcode ) | html %] library news
+                                    [% ELSE %]
+                                        RSS feed for library news
+                                    [% END %]
+                                [% ELSE %]
+                                    [% IF branchcode %]
+                                        RSS feed for [% Branches.GetName( branchcode ) | html %] and system-wide library news
+                                    [% ELSE %]
+                                        RSS feed for system-wide library news
+                                    [% END %]
+                                [% END %]
+                            </a>
+                        </div>
                     [% END %]
-                [% END %]
-                </a>
-            </div>
+                </div>
 
-            [% END %] <!-- single news item -->
+            [% END # /IF single_news_error %]
 
         [% ELSE %] <!-- koha news -->
             [% IF Koha.Preference( 'OpacNewsLibrarySelect' ) %]
                 </div>
             [% END %]
 
+        [% END # IF koha_news %]
+
+        [% UNLESS news_item # Don't show under single news item %]
             [% IF ( display_daily_quote && daily_quote ) %]
                 <div id="daily-quote">
                     <h3>Quote of the day</h3>
             [% END %]
 
             [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock">[% OpacMainUserBlock | $raw %]</div>[% END %]
+        [% END %]
 
-        [% END %] <!-- koha news -->
         </div> <!-- / .span 7/9 -->
 
         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) || OpacNavRight ) %]