[Bug 31339] New: Use Template::Toolkit WRAPPER for Koha Plugins
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Bug ID: 31339 Summary: Use Template::Toolkit WRAPPER for Koha Plugins Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org Rather than requiring Koha plugins to create entire templates, let's provide Template::Toolkit WRAPPER files to allow them to more easily integrate. This should also make it easier for plugins to fit into different versions of Koha. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=30289 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |koha-bugs@lists.koha-commun | |ity.org Component|Templates |Plugin architecture -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- Here's an example for a tool plugin: [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] <title>Plugins › Tools › Koha </title> [% INCLUDE 'doc-head-close.inc' %] </head> <body> [% INCLUDE 'header.inc' %] [% INCLUDE 'prefs-admin-search.inc' %] <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> <ol> <li> <a href="/cgi-bin/koha/mainpage.pl">Home</a> </li> <li> <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> </li> <li> <a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins</a> </li> <li> <a href="#" aria-current="page"> Plugin </a> </li> </ol> </nav> <div class="main container-fluid"> <div class="row"> <div class="col-sm-10 col-sm-push-2"> <main> [% content %] </main> </div> <!-- /.col-sm-10.col-sm-push-2 --> <div class="col-sm-2 col-sm-pull-10"> <aside> [% INCLUDE 'tools-menu.inc' %] </aside> </div> <!-- /.col-sm-2.col-sm-pull-10 --> </div> <!-- /.row --> [% INCLUDE 'intranet-bottom.inc' %] -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- For the moment, I'm including this wrapper template in my Koha plugin. In my .pm file I do this: my $wrapper_path = abs_path( $self->mbf_path( 'plugin-staff-wrapper.tt' ) ); $template->{VARS}->{wrapper_path} = $wrapper_path; Then for each individual template I need for specific functionality, I can just do this: [% WRAPPER "$wrapper_path" %] <h1>Plugin Name</h1> [% END %] -- Even if the wrapper isn't included in Koha core, it could mean updating just the 1 wrapper template instead of updating every single template file because there's a new header include needed or something. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.derscheid@lmscloud.de --- Comment #3 from Paul Derscheid <paul.derscheid@lmscloud.de> --- I love this approach. I could look it up myself but can you pass props to wrappers? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- (In reply to Paul Derscheid from comment #3)
I love this approach.
Glad to hear it!
I could look it up myself but can you pass props to wrappers?
You can! I was going to do a better example, but I was running out of time last night hehe. If you look at https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=30289&attachment=133074 you can see I'm passing in "bodyid", "breadcrumb_label", "columns", and "include_navigation" to the wrapper. In that case, I'm just passing strings, but you can pass variables too. You can define your jsinclude and cssinclude blocks in your individual pages and they'll still be processed via the includes in the wrapper. So it's quite flexible and very powerful. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | Summary|Use Template::Toolkit |Add Template::Toolkit |WRAPPER for Koha Plugins |WRAPPER for Koha Tool | |Plugins -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #5 from David Cook <dcook@prosentient.com.au> --- Created attachment 139647 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=139647&action=edit Bug 31339: Add staff wrapper template include for tool plugins This change adds a template include which can be used as a WRAPPER for tool plugins, which makes it easy to pages in tool templates without having to copy and maintain a lot of template boilerplate. Test plan: 0. Apply patch and koha-plack --restart kohadev 1. Upload koha-plugin-test-wrapper 2. Enable the plugin 3. Click "Actions" and click "Run tool" 4. Note how the plugin page looks like a perfect Koha Tools page 5. Note that the plugin only contains 6 lines of template code to achieve this effect -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #6 from David Cook <dcook@prosentient.com.au> --- Created attachment 139648 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=139648&action=edit test plugin -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=31380 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #139647|0 |1 is obsolete| | --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 150528 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150528&action=edit Bug 31339: Add staff wrapper template include for tool plugins This change adds a template include which can be used as a WRAPPER for tool plugins, which makes it easy to pages in tool templates without having to copy and maintain a lot of template boilerplate. Test plan: 0. Apply patch and koha-plack --restart kohadev 1. Upload koha-plugin-test-wrapper 2. Enable the plugin 3. Click "Actions" and click "Run tool" 4. Note how the plugin page looks like a perfect Koha Tools page 5. Note that the plugin only contains 6 lines of template code to achieve this effect Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #150528|0 |1 is obsolete| | --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 153201 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=153201&action=edit Bug 31339: Add staff wrapper template include for tool plugins This change adds a template include which can be used as a WRAPPER for tool plugins, which makes it easy to pages in tool templates without having to copy and maintain a lot of template boilerplate. Test plan: 0. Apply patch and koha-plack --restart kohadev 1. Upload koha-plugin-test-wrapper 2. Enable the plugin 3. Click "Actions" and click "Run tool" 4. Note how the plugin page looks like a perfect Koha Tools page 5. Note that the plugin only contains 6 lines of template code to achieve this effect Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #9 from David Cook <dcook@prosentient.com.au> --- Cheers, guys! I haven't tried this out since the staff-side re-vamp, so it's cool to hear that this is still working as expected. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- David, I'm pushing this one but please look at (for example) bug 33599, to see how the breadcrumbs should be built using the new wrapper Owen introduced. And file a bug for fixing it. Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |34307 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34307 [Bug 34307] Update plugin wrapper to use template wrapper for breadcrumbs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #12 from David Cook <dcook@prosentient.com.au> --- (In reply to Tomás Cohen Arazi from comment #10)
David, I'm pushing this one but please look at (for example) bug 33599, to see how the breadcrumbs should be built using the new wrapper Owen introduced.
And file a bug for fixing it. Thanks!
Will do! Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #13 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #12)
(In reply to Tomás Cohen Arazi from comment #10)
David, I'm pushing this one but please look at (for example) bug 33599, to see how the breadcrumbs should be built using the new wrapper Owen introduced.
And file a bug for fixing it. Thanks!
Will do! Thanks!
That's all ready to go on bug 34307 now. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|23.11.00 |23.11.00,23.05.02 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #14 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Thanks for all the hard work! Pushed to 23.05.x for the next release -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |matt.blenkinsop@ptfs-europe | |.com Status|Pushed to stable |RESOLVED --- Comment #15 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Enhancement - not backporting to 22.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |40827 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40827 [Bug 40827] Update plugin wrapper to include context for method="report" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com --- Comment #16 from Jonathan Druart <jonathan.druart@gmail.com> --- Can someone confirm this is still working? I think it needs this change: diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc index b34eb63d5c8..85e58d026b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/wrapper-staff-tool-plugin.inc @@ -66,6 +66,5 @@ <!-- /.col-md-2.order-md-1 --> </div> <!-- /.row --> - - [% INCLUDE 'intranet-bottom.inc' %] </div> +[% INCLUDE 'intranet-bottom.inc' %] Using main-container.inc would also be a good improvement. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=38739 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #17 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #16)
Can someone confirm this is still working?
I think it needs this change:
I haven't tried newer than 24.11 yet, but I think you're right about the needed change.
Using main-container.inc would also be a good improvement.
Yeah it looks like that would be a good improvement too. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31339 --- Comment #18 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #16)
Can someone confirm this is still working?
I've tried it, and it's working fine in practice, since the browser cleans the HTML. But if you view the source you'll see a </div> after the </html> so it would technically be invalid HTML. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org