Bugzilla – Attachment 153522 Details for
Bug 34275
Add a button to easily toggle between advanced/basic cataloging editors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34275: Add toggle switch for basic/advanced cataloging editors
Bug-34275-Add-toggle-switch-for-basicadvanced-cata.patch (text/plain), 13.65 KB, created by
ByWater Sandboxes
on 2023-07-16 14:52:41 UTC
(
hide
)
Description:
Bug 34275: Add toggle switch for basic/advanced cataloging editors
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2023-07-16 14:52:41 UTC
Size:
13.65 KB
patch
obsolete
>From b1399ceac10cacc58f1623cce2514a4eaff9938d Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 13 Jul 2023 17:51:13 +0000 >Subject: [PATCH] Bug 34275: Add toggle switch for basic/advanced cataloging > editors > >To test: >1. Apply patch and regenerate CSS. (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface) >2. Turn on EnableAdvancedCatalogingEditor. >3. Go to cataloging > 'New record' >4. In the upper left notice a new toggle switch labeled 'Editor:'. >5. Try toggling the switch back and forth to move between editors. Verify it works correecly. >6. Try editing an existing record and make sure the toggle works well when editing records. >7. Try the other method of switch editors, Settings > Switch to basic/advanced editor. Make sure it works the same as always >8. Turn off EnableAdvancedCatalogingEditor, make sure the toggle button is no longer present. > >Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> >--- > .../prog/css/src/staff-global.scss | 65 +++++++++++++++++++ > .../prog/en/includes/cateditor-ui.inc | 31 +++++---- > .../prog/en/modules/cataloguing/addbiblio.tt | 51 ++++++++++----- > .../prog/en/modules/cataloguing/addbooks.tt | 31 +++++++++ > .../prog/en/modules/cataloguing/editor.tt | 12 ++++ > 5 files changed, 164 insertions(+), 26 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >index ab0a8f9e3e..56c0769b05 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -4101,6 +4101,71 @@ input.renew { > } > } > >+#toggle-editor { >+ display: flex; >+ align-items: center; >+ float: right; >+ >+ label { >+ margin-left: 2px; >+ margin-bottom: 0; >+ } >+ >+ .switch { >+ position: relative; >+ display: inline-block; >+ width: 105px; >+ height: 24px; >+ >+ input { >+ opacity: 0; >+ width: 0; >+ height: 0; >+ >+ &:checked { >+ + .slider { >+ background-color: #408540; >+ } >+ + .slider:before { >+ -webkit-transform: translateX(26px); >+ -ms-transform: translateX(26px); >+ transform: translateX(26px); >+ } >+ } >+ } >+ >+ } >+ >+ .slider { >+ position: absolute; >+ cursor: pointer; >+ top: 0; >+ left: 0; >+ right: 0; >+ bottom: 0; >+ background-color: #ccc; >+ -webkit-transition: .4s; >+ transition: .4s; >+ border-radius: 34px; >+ >+ &::before { >+ position: absolute; >+ content: ""; >+ height: 16px; >+ width: 68px; >+ left: 4px; >+ bottom: 4px; >+ background-color: white; >+ -webkit-transition: .4s; >+ transition: .4s; >+ content: attr(data-editor); >+ border-radius: 34px; >+ text-align: center; >+ font-weight: bold; >+ } >+ } >+} >+ > /* Permissions */ > > #permissionstree { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >index a167314729..77a22a360c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >@@ -976,6 +976,20 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > }); > } > >+ function changeEditor() { >+ if ( !confirm( _("Any changes will not be saved. Continue?") ) ) return; >+ >+ Cookies.set( "catalogue_editor_[% logged_in_user.borrowernumber | html %]", "basic", { expires: 365, path: '/', sameSite: 'Lax'} ); >+ >+ if ( state.backend == 'catalog' ) { >+ window.location = '/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=' + state.recordID; >+ } else if ( state.backend == 'new' ) { >+ window.location = '/cgi-bin/koha/cataloguing/addbiblio.pl'; >+ } else { >+ humanMsg.displayAlert( _("Cannot open this record in the basic editor"), { className: 'humanError' } ); >+ } >+ } >+ > $(".macro_shared").change(function(){ > if(this.checked){ > saveMacro(true); >@@ -987,6 +1001,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > // END Macro functions > > $(document).ready( function() { >+ > // Editor setup > editor = new MARCEditor( { > onCursorActivity: function() { >@@ -1222,18 +1237,12 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > return false; > } ); > >- $( '#switch-editor' ).click( function() { >- if ( !confirm( _("Any changes will not be saved. Continue?") ) ) return; >- >- Cookies.set( "catalogue_editor_[% logged_in_user.borrowernumber | html %]", "basic", { expires: 365, path: '/', sameSite: 'Lax'} ); >+ $( '#toggleEditor' ).change( function() { >+ changeEditor(); >+ }); > >- if ( state.backend == 'catalog' ) { >- window.location = '/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=' + state.recordID; >- } else if ( state.backend == 'new' ) { >- window.location = '/cgi-bin/koha/cataloguing/addbiblio.pl'; >- } else { >- humanMsg.displayAlert( _("Cannot open this record in the basic editor"), { className: 'humanError' } ); >- } >+ $( '#switch-editor' ).click( function() { >+ changeEditor(); > } ); > > $( '#show-advanced-search' ).click( function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index 7e33f115d4..b774794a21 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -26,6 +26,26 @@ > $("#loading").hide(); > }); > var Sticky; >+ >+ function changeEditor() { >+ >+ var breedingid = [% breedingid || "null" | html %]; >+ >+ if ( !confirm( breedingid ? _("This record cannot be transferred to the advanced editor. Continue?") : _("Any changes will not be saved. Continue?") ) ) return false; >+ >+ Cookies.set( 'catalogue_editor_[% logged_in_user.borrowernumber | html %]', 'advanced', { expires: 365, path: '/', sameSite: 'Lax' } ); >+ >+ var biblionumber = [% biblionumber || "null" | html %]; >+ >+ if ( biblionumber ) { >+ window.location = '/cgi-bin/koha/cataloguing/editor.pl#catalog/' + biblionumber; >+ } else { >+ window.location = '/cgi-bin/koha/cataloguing/editor.pl'; >+ } >+ >+ return false; >+ } >+ > $(document).ready(function() { > > [% IF bib_doesnt_exist %] >@@ -136,23 +156,14 @@ > return false; > }); > >- $( '#switcheditor' ).click( function() { >- var breedingid = [% breedingid || "null" | html %]; >- >- if ( !confirm( breedingid ? _("This record cannot be transferred to the advanced editor. Continue?") : _("Any changes will not be saved. Continue?") ) ) return false; >- >- Cookies.set( 'catalogue_editor_[% logged_in_user.borrowernumber | html %]', 'advanced', { expires: 365, path: '/', sameSite: 'Lax' } ); >- >- var biblionumber = [% biblionumber || "null" | html %]; >- >- if ( biblionumber ) { >- window.location = '/cgi-bin/koha/cataloguing/editor.pl#catalog/' + biblionumber; >- } else { >- window.location = '/cgi-bin/koha/cataloguing/editor.pl'; >- } >+ $( '#toggleEditor' ).change( function() { >+ changeEditor(); >+ } ); > >- return false; >+ $( '#switcheditor' ).click( function() { >+ changeEditor(); > } ); >+ > $(".change-framework").on("click", function(){ > var frameworkcode = $(this).data("frameworkcode"); > $("#frameworkcode").val( frameworkcode ); >@@ -823,6 +834,16 @@ function PopupMARCFieldDoc(field) { > <div class="row"> > <div class="col-md-10 col-md-offset-1"> > >+ [% IF Koha.Preference('EnableAdvancedCatalogingEditor') %] >+ <div id="toggle-editor"> >+ <label for="toggle-editor">Editor: </label> >+ <label class="switch"> >+ <input id="toggleEditor" type="checkbox"> >+ <span class="slider" data-editor="Basic"></span> >+ </label> >+ </div> >+ [% END %] >+ > <div id="check_errors"></div> > > <h1> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >index 09289a375f..606b7a7a1c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >@@ -130,6 +130,36 @@ > [% END %] > </td> > <td> >+ [% IF (resultsloo.availablecount ) %] >+ <div class="available_items_loop_items"> >+ [% FOREACH items_loo IN resultsloo.available_items_loop %] >+ [% items_loo.branchname | html %] >+ [% IF ( items_loo.location ) %]<span class="shelvingloc">[% items_loo.location | html %]</span>[% END %] >+ [% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %] >+ [% IF ( items_loo.classification ) %] >+ <a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:[% items_loo.classification |url %]"> >+ [% items_loo.classification | html %] >+ </a> >+ [% END %] >+ [% END %] >+ </div> >+ [% END %] >+ [% IF ( resultsloo.onloancount ) %] >+ <div class="onloan_items_loop_items"> >+ <div class="results_checkedout">[% resultsloo.onloancount | html %] checked out:</div> >+ [% FOREACH items_loo IN resultsloo.onloan_items_loop %] >+ [% items_loo.branchname | html %] >+ [% IF ( items_loo.location ) %]<span class="shelvingloc">[% items_loo.location | html %]</span>[% END %] >+ [% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %] >+ [% IF ( items_loo.classification ) %] >+ <a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:[% items_loo.classification |url %]"> >+ [% items_loo.classification | html %] >+ </a> >+ [% END %] >+ [% END %] >+ </div> >+ [% END %] >+ <!-- > [% IF ( resultsloo.available_items_loop ) %] > <span class="available"> > [% FOREACH items_loo IN resultsloo.available_items_loop %] >@@ -159,6 +189,7 @@ > [% END %] > [% END %] > </span> >+--> > </td> > <td> > <div class="dropup"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt >index 6519def77b..74a857dd60 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt >@@ -1,5 +1,6 @@ > [% USE raw %] > [% USE Asset %] >+[% USE Koha %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Editor › Cataloging › Koha</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -36,8 +37,19 @@ > <div class="col-sm-10 col-sm-push-2"> > <main> > >+[% IF Koha.Preference('EnableAdvancedCatalogingEditor') %] >+ <div id="toggle-editor"> >+ <label for="toggle-editor">Editor: </label> >+ <label class="switch"> >+ <input id="toggleEditor" type="checkbox" checked="checked"> >+ <span class="slider" data-editor="Advanced"></span> >+ </label> >+ </div> >+[% END %] >+ > <h1 id="title">Cataloging editor</h1> > >+ > <div id="editor"> > <input id="import-records-input" type="file" style="display: none"> > <div id="toolbar" class="btn-toolbar"> >-- >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 34275
:
153426
|
153522
|
154471
|
154472
|
155706
|
156124
|
156125
|
158142
|
158537
|
158538