Bugzilla – Attachment 101586 Details for
Bug 24745
OPAC news block plugin should evaluate as false if there are no items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24745: OPAC news block plugin should evaluate as false if there are no items
Bug-24745-OPAC-news-block-plugin-should-evaluate-a.patch (text/plain), 1.74 KB, created by
Marcel de Rooy
on 2020-03-24 14:06:23 UTC
(
hide
)
Description:
Bug 24745: OPAC news block plugin should evaluate as false if there are no items
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-03-24 14:06:23 UTC
Size:
1.74 KB
patch
obsolete
>From 7376e345e05014ffd55bac65a33c65202efe2c46 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 27 Feb 2020 01:31:37 +0000 >Subject: [PATCH] Bug 24745: OPAC news block plugin should evaluate as false if > there are no items >Content-Type: text/plain; charset=utf-8 > >This patch changes the way news is returned from GetNewsToDisplay in >KohaNews.pm so that the template variable will evaluate as false instead >of simply being an empty data structure. > >To verify the bug, remove your opacheader news entry and view source on >any page in the OPAC. You should find some empty markup right after >'</div> <!-- /navbar -->' > ><div class="container-fluid"> > <div class="row-fluid"> > </div> ></div> > >To test the fix, apply the patch and reload the OPAC page. The empty >divs should be gone. Add content to the opacheader news item and confirm >that it displays correctly. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Divs gone, no errors. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Template/Plugin/KohaNews.pm | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > >diff --git a/Koha/Template/Plugin/KohaNews.pm b/Koha/Template/Plugin/KohaNews.pm >index bd56f63e2d..713d07301a 100644 >--- a/Koha/Template/Plugin/KohaNews.pm >+++ b/Koha/Template/Plugin/KohaNews.pm >@@ -45,11 +45,15 @@ sub get { > > my $content = &GetNewsToDisplay( $news_lang, $library ); > >- return { >- content => $content, >- location => $display_location, >- blocktitle => $blocktitle >- }; >+ if( @$content ){ >+ return { >+ content => $content, >+ location => $display_location, >+ blocktitle => $blocktitle >+ }; >+ } else { >+ return 0; >+ } > } > > 1; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24745
:
99708
|
100151
|
100152
|
101558
| 101586 |
101587