Whilst working through some notice bugs I noted that we now have a few different places where we wrap the content for output in various instants. I think we could centralise on the html_content method I introduce in bug 30287 and add support for the 'pre' (or perhaps replace pre with <div style="white-space: pre-wrap;"> as suggested in https://stackoverflow.com/questions/248011/how-do-i-wrap-text-in-a-pre-tag) for non html encoded templates. Thoughts?
Created attachment 158657 [details] [review] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the <div style="white-space: pre-wrap"> block to maintain text formatting as defined in the original plaintext template.
Work in progress
Created attachment 158658 [details] [review] Bug 35285: Remove switch in notices.tt We now wrap appropriately for non-html formatted messages as part of the html_content method. This means we can remove the case from members/notices.tt and rely on html_content doing the right thing for notice previews.
Created attachment 158889 [details] [review] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the <div style="white-space: pre-wrap"> block to maintain text formatting as defined in the original plaintext template. Test Follow the test plan for bug 30287, nothing should outwardly change.
Created attachment 158890 [details] [review] Bug 35285: Remove switch in notices.tt We now wrap appropriately for non-html formatted messages as part of the html_content method. This means we can remove the case from members/notices.tt and rely on html_content doing the right thing for notice previews.
Created attachment 158891 [details] [review] Bug 35285: Unit tests This patch adds unit tests for the new 'is_html' function introduced in Koha::Notice::Message and update the tests to include the new plaintext handling of html_content.
Created attachment 158960 [details] [review] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the <div style="white-space: pre-wrap"> block to maintain text formatting as defined in the original plaintext template. Test Follow the test plan for bug 30287, nothing should outwardly change. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 158961 [details] [review] Bug 35285: Remove switch in notices.tt We now wrap appropriately for non-html formatted messages as part of the html_content method. This means we can remove the case from members/notices.tt and rely on html_content doing the right thing for notice previews. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 158962 [details] [review] Bug 35285: Unit tests This patch adds unit tests for the new 'is_html' function introduced in Koha::Notice::Message and update the tests to include the new plaintext handling of html_content. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166329 [details] [review] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the <div style="white-space: pre-wrap"> block to maintain text formatting as defined in the original plaintext template. Test Follow the test plan for bug 30287, nothing should outwardly change. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166330 [details] [review] Bug 35285: Remove switch in notices.tt We now wrap appropriately for non-html formatted messages as part of the html_content method. This means we can remove the case from members/notices.tt and rely on html_content doing the right thing for notice previews. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166331 [details] [review] Bug 35285: Unit tests This patch adds unit tests for the new 'is_html' function introduced in Koha::Notice::Message and update the tests to include the new plaintext handling of html_content. Signed-off-by: David Nind <david@davidnind.com>
Just a quick rebase
Created attachment 166332 [details] [review] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the <div style="white-space: pre-wrap"> block to maintain text formatting as defined in the original plaintext template. Test Follow the test plan for bug 30287, nothing should outwardly change. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166333 [details] [review] Bug 35285: Remove switch in notices.tt We now wrap appropriately for non-html formatted messages as part of the html_content method. This means we can remove the case from members/notices.tt and rely on html_content doing the right thing for notice previews. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166334 [details] [review] Bug 35285: Unit tests This patch adds unit tests for the new 'is_html' function introduced in Koha::Notice::Message and update the tests to include the new plaintext handling of html_content. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166348 [details] [review] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the <div style="white-space: pre-wrap"> block to maintain text formatting as defined in the original plaintext template. Test Follow the test plan for bug 30287, nothing should outwardly change. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166349 [details] [review] Bug 35285: Remove switch in notices.tt We now wrap appropriately for non-html formatted messages as part of the html_content method. This means we can remove the case from members/notices.tt and rely on html_content doing the right thing for notice previews. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166350 [details] [review] Bug 35285: Unit tests This patch adds unit tests for the new 'is_html' function introduced in Koha::Notice::Message and update the tests to include the new plaintext handling of html_content. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166356 [details] [review] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the <div style="white-space: pre-wrap"> block to maintain text formatting as defined in the original plaintext template. Test Follow the test plan for bug 30287, nothing should outwardly change. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166357 [details] [review] Bug 35285: Remove switch in notices.tt We now wrap appropriately for non-html formatted messages as part of the html_content method. This means we can remove the case from members/notices.tt and rely on html_content doing the right thing for notice previews. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166358 [details] [review] Bug 35285: Unit tests This patch adds unit tests for the new 'is_html' function introduced in Koha::Notice::Message and update the tests to include the new plaintext handling of html_content. Signed-off-by: David Nind <david@davidnind.com> test
Created attachment 166719 [details] [review] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the <div style="white-space: pre-wrap"> block to maintain text formatting as defined in the original plaintext template. Test Follow the test plan for bug 30287, nothing should outwardly change. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 166720 [details] [review] Bug 35285: Remove switch in notices.tt We now wrap appropriately for non-html formatted messages as part of the html_content method. This means we can remove the case from members/notices.tt and rely on html_content doing the right thing for notice previews. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 166721 [details] [review] Bug 35285: Unit tests This patch adds unit tests for the new 'is_html' function introduced in Koha::Notice::Message and update the tests to include the new plaintext handling of html_content. Signed-off-by: David Nind <david@davidnind.com> test Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 166722 [details] [review] Bug 35285: (QA follow-up) Tidy Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This one seems at least in a grey area for being an enh. I am going to push it as it's mostly affecting display in the staff interface right now.
Pushed for 24.05! Well done everyone, thank you!
Pushed to 23.11.x for 23.11.06
This feels like an enhancement to me. I'm not going to include this in 23.05.x.