Bugzilla – Attachment 162433 Details for
Bug 36164
Bring more consistency to our module landing pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36164: Proof of concept
Bug-36164-Proof-of-concept.patch (text/plain), 25.63 KB, created by
Pedro Amorim
on 2024-02-26 13:34:51 UTC
(
hide
)
Description:
Bug 36164: Proof of concept
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-02-26 13:34:51 UTC
Size:
25.63 KB
patch
obsolete
>From 08858d55ae6541e1038448e66781c501f7c927f6 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 26 Feb 2024 13:33:45 +0000 >Subject: [PATCH] Bug 36164: Proof of concept > >This PoC serves the purpose of DRYing the markup and logic present in cataloging-home to ensure consistency between module landing pages going forward. >This abstraction would then also be done in circulation-home. And after that, in tools-home and/or other adopting modules in the future. >--- > .../prog/en/includes/html_helpers.inc | 73 ++++ > .../en/modules/cataloguing/cataloging-home.tt | 327 ++++++++---------- > 2 files changed, 224 insertions(+), 176 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >index 535cbca2c91..48b582f407a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -473,3 +473,76 @@ > </li> > [% END %] > [% END %] >+ >+[%# Used to build a module landing page %] >+[% BLOCK module_langing_page %] >+ <div class="row"> >+ <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> >+ [%# FIXME: Confirm messages.inc is needed. Neither circulation-home and cataloging-home use output_and_exit from C4::Output#%] >+ [% INCLUDE 'messages.inc' %] >+ [% content | $raw %] >+ </div> >+ </div> >+[% END %] >+ >+[% BLOCK module_langing_page_item %] >+ [% IF ( item_permission ) %] >+ <h3>[% title %]</h3> >+ <ul class="buttons-list"> >+ [% FOREACH item IN sub_items %] >+ [% IF ( item.permission ) %] >+ <li> >+ <a class="circ-button" href="[% item.link | url %]"><i class="[% item.icon_class | html %]"></i> [% item.label | html %]</a> >+ </li> >+ [% END %] >+ [% END %] >+ </ul> >+ [% content | $raw %] >+ [% END %] >+[% END %] >+ >+[% BLOCK module_langing_page_column %] >+ <div class="col-sm-4 col-md-4"> >+ [% content | $raw %] >+ </div> >+[% END %] >+ >+[% BLOCK module_langing_page_content %] >+ <h1>[% label %]</h1> >+ <div class="row"> >+ [% content | $raw %] >+ </div> >+[% END %] >+ >+[% BLOCK module_langing_page_toolbar %] >+ [% IF ( permission ) %] >+ [% #TODO: Abstract this %] >+ <div id="toolbar" class="btn-toolbar"> >+ [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %] >+ <a id="useadvanced" href="/cgi-bin/koha/cataloguing/editor.pl" class="btn btn-default"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Advanced editor</a> >+ [% END %] >+ <div class="btn-group"> >+ <button class="btn btn-default" id="newRecord"><i class="fa fa-plus"></i> New record</button> >+ <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button> >+ <ul class="dropdown-menu"> >+ <li><a id="newRecordDefault" href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=">Default framework</a></li> >+ [% FOREACH framework IN frameworks %] >+ <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=[% framework.frameworkcode | uri %]">[% framework.frameworktext | html %]</a></li> >+ [% END %] >+ </ul> >+ </div> >+ [% IF servers.count > 0 %] >+ <div class="btn-group"> >+ <button class="btn btn-default" id="z3950search"><i class="fa fa-search"></i> New from Z39.50/SRU</button> >+ <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button> >+ <ul class="dropdown-menu"> >+ <li id="Default" class="z3950searchFw"><a href="#">Default framework</a></li> >+ [% FOREACH framework IN frameworks %] >+ <li id="[% framework.frameworkcode | html %]" class="z3950searchFw"><a href="#">[% framework.frameworktext | html %]</a></li> >+ [% END %] >+ </ul> >+ </div> >+ [% END # /IF servers.count %] >+ </div> <!-- /#toolbar --> >+ [% END %] >+[% END %] >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt >index 7cf87d2ee9a..1154d25fefe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt >@@ -26,208 +26,183 @@ > [% END #/ WRAPPER sub-header.inc %] > > <div class="main container-fluid"> >- <div class="row"> >- <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> >- [% INCLUDE 'messages.inc' %] >- [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] >- <div id="toolbar" class="btn-toolbar"> >- [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %] >- <a id="useadvanced" href="/cgi-bin/koha/cataloguing/editor.pl" class="btn btn-default"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Advanced editor</a> >+ [% WRAPPER module_langing_page %] >+ [% WRAPPER module_langing_page_toolbar permission = CAN_user_editcatalogue_edit_catalogue %][% END %] >+ [% WRAPPER module_langing_page_content label = t("Cataloging") %] >+ [% WRAPPER module_langing_page_column %] >+ [% WRAPPER module_langing_page_item >+ title = t("Import") >+ item_permission = ( CAN_user_tools_stage_marc_import || CAN_user_tools_manage_staged_marc ) >+ sub_items = [ >+ { >+ 'label' => t("Stage records for import"), >+ 'icon_class' => 'fa fa-download', >+ 'link' => '/cgi-bin/koha/tools/stage-marc-import.pl', >+ 'permission' => CAN_user_tools_stage_marc_import, >+ }, >+ { >+ 'label' => t("Manage staged records"), >+ 'icon_class' => 'fa fa-tasks', >+ 'link' => '/cgi-bin/koha/tools/manage-marc-import.pl', >+ 'permission' => CAN_user_tools_manage_staged_marc, >+ } >+ ] >+ %] > [% END %] >- <div class="btn-group"> >- <button class="btn btn-default" id="newRecord"><i class="fa fa-plus"></i> New record</button> >- <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button> >- <ul class="dropdown-menu"> >- <li><a id="newRecordDefault" href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=">Default framework</a></li> >- [% FOREACH framework IN frameworks %] >- <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=[% framework.frameworkcode | uri %]">[% framework.frameworktext | html %]</a></li> >- [% END %] >- </ul> >- </div> >- [% IF servers.count > 0 %] >- <div class="btn-group"> >- <button class="btn btn-default" id="z3950search"><i class="fa fa-search"></i> New from Z39.50/SRU</button> >- <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button> >- <ul class="dropdown-menu"> >- <li id="Default" class="z3950searchFw"><a href="#">Default framework</a></li> >- [% FOREACH framework IN frameworks %] >- <li id="[% framework.frameworkcode | html %]" class="z3950searchFw"><a href="#">[% framework.frameworktext | html %]</a></li> >- [% END %] >- </ul> >- </div> >- [% END # /IF servers.count %] >- </div> <!-- /#toolbar --> >- [% END # /IF CAN_user_editcatalogue_edit_catalogue %] > >- <h1>Cataloging</h1> >+ [% WRAPPER module_langing_page_item >+ title = t("Export") >+ item_permission = ( CAN_user_tools_export_catalog ) >+ sub_items = [ >+ { >+ 'label' => t("Export catalog data"), >+ 'icon_class' => 'fa fa-upload', >+ 'link' => '/cgi-bin/koha/tools/export.pl', >+ 'permission' => CAN_user_tools_export_catalog, >+ } >+ ] >+ %] >+ [% END %] > >- <div class="row"> >+ [% WRAPPER module_langing_page_item >+ title = t("Reports") >+ item_permission = ( CAN_user_tools_inventory || ( ( Koha.Preference('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) ) >+ sub_items = [ >+ { >+ 'label' => t("Inventory"), >+ 'icon_class' => 'fa-solid fa-clipboard-check', >+ 'link' => '/cgi-bin/koha/tools/inventory.pl', >+ 'permission' => CAN_user_tools_inventory, >+ }, >+ { >+ 'label' => t("Catalog concerns"), >+ 'icon_class' => 'fa fa-list-ul', >+ 'link' => '/cgi-bin/koha/cataloguing/concerns.pl', >+ 'permission' => ( ( Koha.Preference('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ), >+ } >+ ] >+ %] >+ [% END %] > >- <div class="col-sm-4 col-md-4"> >- [% IF ( CAN_user_tools_stage_marc_import || CAN_user_tools_manage_staged_marc ) %] >- <h3>Import</h3> >- <ul class="buttons-list"> >- [% IF ( CAN_user_tools_stage_marc_import ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/stage-marc-import.pl"><i class="fa fa-download"></i> Stage records for import</a> >- </li> >- [% END %] >+ [% WRAPPER module_langing_page_item >+ title = t("Fast cataloging") >+ item_permission = ( fast_cataloging && CAN_user_editcatalogue_fast_cataloging ) >+ sub_items = [ >+ { >+ 'label' => t("Fast cataloging"), >+ 'icon_class' => 'fa fa-plus', >+ 'link' => '/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA', >+ 'permission' => CAN_user_editcatalogue_fast_cataloging, >+ } >+ ] >+ %] >+ [% END %] >+ [% END %] <!-- module_langing_page_column--> > >- [% IF ( CAN_user_tools_manage_staged_marc ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/manage-marc-import.pl"><i class="fa fa-tasks"></i> Manage staged records</a> >- </li> >- [% END %] >- </ul> >- [% END %] >+ <div class="col-sm-4 col-md-4"> > >- [% IF ( CAN_user_tools_export_catalog ) %] >- <h3>Export</h3> >- <ul class="buttons-list"> >- [% IF ( CAN_user_tools_export_catalog ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/export.pl"><i class="fa fa-upload"></i> Export catalog data</a> >- </li> >- [% END %] >- </ul> >+ [% IF ( CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel || CAN_user_tools_records_batchmod || CAN_user_tools_records_batchdel || CAN_user_tools_marc_modification_templates ) %] >+ <h3>Batch editing</h3> >+ <ul class="buttons-list"> >+ [% IF ( CAN_user_tools_items_batchmod ) %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/tools/batchMod.pl"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch item modification</a> >+ </li> > [% END %] >- >- [% IF ( CAN_user_tools_inventory || ( ( Koha.Preference('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) ) %] >- <h3>Reports</h3> >- <ul class="buttons-list"> >- [% IF ( CAN_user_tools_inventory ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/inventory.pl"><i class="fa-solid fa-clipboard-check"></i> Inventory</a> >- </li> >- [% END %] >- >- [% IF ( ( Koha.Preference('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/cataloguing/concerns.pl"><i class="fa fa-list-ul"></i> Catalog concerns</a> >- </li> >- [% END %] >- </ul> >+ [% IF ( CAN_user_tools_items_batchdel ) %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/tools/batchMod.pl?del=1"><i class="fa fa-trash-can"></i> Batch item deletion</a> >+ </li> > [% END %] >- [% IF ( fast_cataloging && CAN_user_editcatalogue_fast_cataloging ) %] >- <h3>Fast cataloging</h3> >- <ul class="buttons-list"> >- [% IF ( CAN_user_editcatalogue_fast_cataloging ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA"><i class="fa fa-plus"></i> Fast cataloging</a> >- </li> >- [% END %] >- </ul> >+ [% IF CAN_user_tools_records_batchmod %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/tools/batch_record_modification.pl"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch record modification</a> >+ </li> > [% END %] >- >- >- </div> >- >- <div class="col-sm-4 col-md-4"> >- >- [% IF ( CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel || CAN_user_tools_records_batchmod || CAN_user_tools_records_batchdel || CAN_user_tools_marc_modification_templates ) %] >- <h3>Batch editing</h3> >- <ul class="buttons-list"> >- [% IF ( CAN_user_tools_items_batchmod ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/batchMod.pl"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch item modification</a> >- </li> >- [% END %] >- [% IF ( CAN_user_tools_items_batchdel ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/batchMod.pl?del=1"><i class="fa fa-trash-can"></i> Batch item deletion</a> >- </li> >- [% END %] >- [% IF CAN_user_tools_records_batchmod %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/batch_record_modification.pl"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Batch record modification</a> >- </li> >- [% END %] >- [% IF CAN_user_tools_records_batchdel %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/batch_delete_records.pl"><i class="fa fa-trash-can"></i> Batch record deletion</a> >- </li> >- [% END %] >- >- [% IF ( CAN_user_tools_marc_modification_templates ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/marc_modification_templates.pl"><i class="fa fa-gear"></i> MARC modification templates</a> >- </li> >- [% END %] >- </ul> >+ [% IF CAN_user_tools_records_batchdel %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/tools/batch_delete_records.pl"><i class="fa fa-trash-can"></i> Batch record deletion</a> >+ </li> > [% END %] > >- [% IF ( CAN_user_tools_items_batchmod || ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) ) %] >- <h3>Automation</h3> >- <ul class="buttons-list"> >- [% IF ( CAN_user_tools_items_batchmod ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"><i class="fa-solid fa-calendar-days"></i> Item modifications by age</a> >- </li> >- [% END %] >- [% IF ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/stockrotation.pl"><i class="fa-solid fa-rotate"></i> Stock rotation</a> >- </li> >- [% END %] >- </ul> >+ [% IF ( CAN_user_tools_marc_modification_templates ) %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/tools/marc_modification_templates.pl"><i class="fa fa-gear"></i> MARC modification templates</a> >+ </li> > [% END %] >+ </ul> >+ [% END %] > >- </div> >- >- <div class="col-sm-4 col-md-4"> >+ [% IF ( CAN_user_tools_items_batchmod || ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) ) %] >+ <h3>Automation</h3> >+ <ul class="buttons-list"> >+ [% IF ( CAN_user_tools_items_batchmod ) %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"><i class="fa-solid fa-calendar-days"></i> Item modifications by age</a> >+ </li> >+ [% END %] >+ [% IF ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/tools/stockrotation.pl"><i class="fa-solid fa-rotate"></i> Stock rotation</a> >+ </li> >+ [% END %] >+ </ul> >+ [% END %] > >- [% IF ( CAN_user_tools_label_creator || CAN_user_tools_upload_local_cover_images ) %] >- <h3>Tools</h3> >- <ul class="buttons-list"> >- [% IF ( CAN_user_tools_label_creator ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/labels/label-home.pl"><i class="fa fa-hashtag"></i> Label creator</a> >- </li> >+ </div> > >- <li> >- <a class="circ-button" href="/cgi-bin/koha/labels/barcode-print.pl"><i class="fa fa-barcode"></i> Barcode image generator</a> >- </li> >+ <div class="col-sm-4 col-md-4"> > >- <li> >- <a class="circ-button" href="/cgi-bin/koha/labels/spinelabel-home.pl"><i class="fa fa-hashtag"></i> Quick spine label creator</a> >- </li> >- [% END %] >+ [% IF ( CAN_user_tools_label_creator || CAN_user_tools_upload_local_cover_images ) %] >+ <h3>Tools</h3> >+ <ul class="buttons-list"> >+ [% IF ( CAN_user_tools_label_creator ) %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/labels/label-home.pl"><i class="fa fa-hashtag"></i> Label creator</a> >+ </li> > >- [% IF ( CAN_user_tools_upload_local_cover_images ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/tools/upload-cover-image.pl"><i class="fa fa-upload"></i> Upload local cover image</a> >- </li> >- [% END %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/labels/barcode-print.pl"><i class="fa fa-barcode"></i> Barcode image generator</a> >+ </li> > >- </ul> >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/labels/spinelabel-home.pl"><i class="fa fa-hashtag"></i> Quick spine label creator</a> >+ </li> > [% END %] > >- [% IF ( CAN_user_parameters ) %] >- <h3>Administration</h3> >- <ul class="buttons-list"> >- [% IF ( CAN_user_parameters_manage_sysprefs ) %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/admin/preferences.pl?tab=cataloguing"><i class="fa fa-tasks"></i> Preferences</a> >- </li> >- [% END %] >- <li> >- <a class="circ-button" href="/cgi-bin/koha/admin/admin-home.pl"><i class="fa fa-cogs"></i> Configuration</a> >- </li> >- </ul> >+ [% IF ( CAN_user_tools_upload_local_cover_images ) %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/tools/upload-cover-image.pl"><i class="fa fa-upload"></i> Upload local cover image</a> >+ </li> > [% END %] > >- </div> >- </div> >+ </ul> >+ [% END %] >+ >+ [% IF ( CAN_user_parameters ) %] >+ <h3>Administration</h3> >+ <ul class="buttons-list"> >+ [% IF ( CAN_user_parameters_manage_sysprefs ) %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/admin/preferences.pl?tab=cataloguing"><i class="fa fa-tasks"></i> Preferences</a> >+ </li> >+ [% END %] >+ <li> >+ <a class="circ-button" href="/cgi-bin/koha/admin/admin-home.pl"><i class="fa fa-cogs"></i> Configuration</a> >+ </li> >+ </ul> >+ [% END %] > >- [%- SET StaffCataloguingHome = AdditionalContents.get( location => "StaffCataloguingHome", lang => lang, library => logged_in_user.branchcode ) -%] >- [%- FOREACH block IN StaffCataloguingHome.content -%] >- <div class="page-section"> >- [%- block.content | $raw -%] > </div> >- [%- END -%] >+ [% END %] <!-- module_langing_page_content --> > >+ [%- SET StaffCataloguingHome = AdditionalContents.get( location => "StaffCataloguingHome", lang => lang, library => logged_in_user.branchcode ) -%] >+ [%- FOREACH block IN StaffCataloguingHome.content -%] >+ <div class="page-section"> >+ [%- block.content | $raw -%] > </div> >- </div> >+ [%- END -%] >+ [% END %] <!-- module_langing_page --> > > [% MACRO jsinclude BLOCK %] > <script> >-- >2.30.2
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 36164
:
162433
|
166049