Bug 29691 - Use template plugins to display OPAC news on homepage
Summary: Use template plugins to display OPAC news on homepage
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Nick Clemens
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 28955
Blocks:
  Show dependency treegraph
 
Reported: 2021-12-14 13:35 UTC by Nick Clemens
Modified: 2024-02-19 20:38 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00


Attachments
Bug 29691: Use template to display news on opac homepage (10.38 KB, patch)
2021-12-14 13:40 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 29691: Use template to display news on opac homepage (10.44 KB, patch)
2021-12-14 13:51 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29691: Use template to display news on opac homepage (11.38 KB, patch)
2023-04-19 16:55 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 29691: Unit tests (4.09 KB, patch)
2023-04-19 16:55 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 29691: Use template to display news on opac homepage (11.44 KB, patch)
2023-04-20 11:26 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29691: Unit tests (4.16 KB, patch)
2023-04-20 11:26 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29691: Use template to display news on opac homepage (11.50 KB, patch)
2023-05-19 15:41 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 29691: Unit tests (4.21 KB, patch)
2023-05-19 15:42 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2021-12-14 13:35:41 UTC
Currently the news for display are fetched in the script, if we move this to the template, bug 28955 will allow displaying branch news by default on home page
Comment 1 Nick Clemens 2021-12-14 13:40:04 UTC
Created attachment 128506 [details] [review]
Bug 29691: Use template to display news on opac homepage

This patch moves the fetching of news to the template and
adds a p[lugin method to get news by id

TO test:
1 - Define some general and library specific news items
2 - Define in various languages
3 - Define some 'Additional contents' as well
4 - Apply patch
5 - Confirm onlly 'all libraries' news show if not loigged in to opac
6 - Confirm correct library news show when logged in
7 - View specific news items:
    http://localhost:8080/cgi-bin/koha/opac-main.pl?news_id=12
8 - Confirm that non-existent ids show " This news item does not exist. "
9 - Confirm if you enter ID for additional contents you get 'does not exist'
Comment 2 Martin Renvoize 2021-12-14 13:51:53 UTC
Created attachment 128508 [details] [review]
Bug 29691: Use template to display news on opac homepage

This patch moves the fetching of news to the template and
adds a p[lugin method to get news by id

TO test:
1 - Define some general and library specific news items
2 - Define in various languages
3 - Define some 'Additional contents' as well
4 - Apply patch
5 - Confirm onlly 'all libraries' news show if not loigged in to opac
6 - Confirm correct library news show when logged in
7 - View specific news items:
    http://localhost:8080/cgi-bin/koha/opac-main.pl?news_id=12
8 - Confirm that non-existent ids show " This news item does not exist. "
9 - Confirm if you enter ID for additional contents you get 'does not exist'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize 2021-12-14 13:52:43 UTC
Nice work Nick.. signing off :)
Comment 4 Jonathan Druart 2022-01-19 12:42:06 UTC
Missing POD and tests.
Comment 5 Jonathan Druart 2022-01-19 12:50:33 UTC
113                             [% IF ( news_item ) %]
114                                 &bull; <a href="/cgi-bin/koha/opac-main.pl">Show all news</a>
115                             [% END %]

This is not displayed.
Comment 6 Jonathan Druart 2022-01-19 12:51:44 UTC
The news is not displayed in the translated version of the interface (does not seem related to this patch however).
Comment 7 Martin Renvoize 2022-07-13 06:57:25 UTC
Do you intend to revisit this Nick?
Comment 8 Nick Clemens 2023-04-19 16:55:56 UTC
Created attachment 149903 [details] [review]
Bug 29691: Use template to display news on opac homepage

This patch moves the fetching of news to the template and
adds a p[lugin method to get news by id

TO test:
1 - Define some general and library specific news items
2 - Define in various languages
3 - Define some 'Additional contents' as well
4 - Apply patch
5 - Confirm onlly 'all libraries' news show if not loigged in to opac
6 - Confirm correct library news show when logged in
7 - View specific news items:
    http://localhost:8080/cgi-bin/koha/opac-main.pl?news_id=12
8 - Confirm that non-existent ids show " This news item does not exist. "
9 - Confirm if you enter ID for additional contents you get 'does not exist'
Comment 9 Nick Clemens 2023-04-19 16:55:58 UTC
Created attachment 149904 [details] [review]
Bug 29691: Unit tests
Comment 10 Martin Renvoize 2023-04-20 11:26:22 UTC
Created attachment 149932 [details] [review]
Bug 29691: Use template to display news on opac homepage

This patch moves the fetching of news to the template and
adds a p[lugin method to get news by id

TO test:
1 - Define some general and library specific news items
2 - Define in various languages
3 - Define some 'Additional contents' as well
4 - Apply patch
5 - Confirm onlly 'all libraries' news show if not loigged in to opac
6 - Confirm correct library news show when logged in
7 - View specific news items:
    http://localhost:8080/cgi-bin/koha/opac-main.pl?news_id=12
8 - Confirm that non-existent ids show " This news item does not exist. "
9 - Confirm if you enter ID for additional contents you get 'does not exist'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize 2023-04-20 11:26:24 UTC
Created attachment 149933 [details] [review]
Bug 29691: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize 2023-04-20 11:27:14 UTC
All working as described, thanks Nick.

Signing off :)
Comment 13 Kyle M Hall 2023-05-19 15:41:59 UTC
Created attachment 151481 [details] [review]
Bug 29691: Use template to display news on opac homepage

This patch moves the fetching of news to the template and
adds a p[lugin method to get news by id

TO test:
1 - Define some general and library specific news items
2 - Define in various languages
3 - Define some 'Additional contents' as well
4 - Apply patch
5 - Confirm onlly 'all libraries' news show if not loigged in to opac
6 - Confirm correct library news show when logged in
7 - View specific news items:
    http://localhost:8080/cgi-bin/koha/opac-main.pl?news_id=12
8 - Confirm that non-existent ids show " This news item does not exist. "
9 - Confirm if you enter ID for additional contents you get 'does not exist'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Kyle M Hall 2023-05-19 15:42:07 UTC
Created attachment 151482 [details] [review]
Bug 29691: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Tomás Cohen Arazi 2023-06-15 11:49:02 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 16 Jonathan Druart 2023-06-16 14:57:14 UTC
Too bad that this has been revived before bug 31383 was pushed...
Comment 17 Martin Renvoize 2023-07-17 12:11:26 UTC
Enhancement.. one I've been wanting for a while.. but not one for 23.05.x I feel.
Comment 18 Caroline Cyr La Rose 2024-02-19 20:38:22 UTC
This seems like a code refactor thing. I don't think there's anything to be added or changed in the manual.