From 71ab7acc1c1427f29e2352cdc9cadba97da9ca35 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 14 Aug 2018 13:04:39 +0000 Subject: [PATCH] Bug 20809: Link patron image to patron image add/edit form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch modifies an include file so that it is possible with edit a patron's image on any patron-related page which uses that include. To test you must have the patronimages system preference enabled. Apply the patch and open any patron record for viewing. - Hover the mouse over the patron image. - If the patron has a previously-defined patron image, should you see an "Edit" button appear. Clicking the button should display a modal dialog titled "Edit patron image." Test that the "Upload," "Delete," and "Cancel" buttons work correctly. - If a patron has no patron image defined, you should see an "Add" button appear. Clicking the button should display a modal dialog titled "Edit patron image." Test that the "Upload," "Delete," and "Cancel" buttons work correctly. This process should work from any page which shows the patron sidebar: Check out, Details, Fines, Routing lists, Circulation history, etc. Patch works as described. Signed-off-by: Dilan Johnpullé Signed-off-by: Katrin Fischer Signed-off-by: Claire Gravely Signed-off-by: Katrin Fischer --- .../intranet-tmpl/prog/css/src/staff-global.scss | 53 +++++++++++++++++---- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 54 ++++++++++++++++------ koha-tmpl/intranet-tmpl/prog/js/members-menu.js | 13 ++++++ 3 files changed, 95 insertions(+), 25 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 2a70eff3da..48ae4b913a 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -1684,26 +1684,59 @@ dd { + #menu { margin-right: 0; } + + > div { + border-right: 1px solid #B9D8D9; + width: 100%; + } } -#patronbasics { - div { - background: transparent url("../img/patron-blank.min.svg") 10px 5px no-repeat; - border: 1px solid #CCCCCC; +/* Patron image */ + +.patronimage-container { + padding: .2em; + position: relative; + + &:hover { + .patronimage { + opacity: .8; + } + + .patronimage-controls { + opacity: 1; + } + } +} + +.patronimage { + display: block; + max-width: 160px; + opacity: 1; + transition: .2s ease; + + .empty { + background: transparent url( "../img/patron-blank.min.svg" ) center 5px no-repeat; height: 125px; margin: .3em 0 .3em .3em; padding: 0; - width: 105px; + width: 80%; } } -#patronimage { - border: 1px solid #CCCCCC; - margin: .3em 0 .3em .3em; - max-width: 140px; - padding: .2em; +.patronimage-controls { + left: 50%; + opacity: 0; + position: absolute; + text-align: center; + top: 80%; + transform: translate( -50%, -50% ); + transition: .5s ease; } +.patronimage-control { + padding: 1em 2em; + } + .patronviews { border-right: 1px solid #000; border-top: 1px solid #000; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index b9391fb26b..cc1b4c5a11 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -2,25 +2,30 @@ [% USE KohaDates %] [% IF ( patron.borrowernumber ) %]
[% INCLUDE 'patron-title.inc' %]
+ - + +[% IF ( patronimages ) %] +
+
+ [% IF ( patron.image ) %] + [% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %]) +
+ +
+ [% ELSE %] +
+
+ +
+ [% END %] +
+
+[% END %] +
    - [% IF ( patronimages ) %] - [% IF ( patron.image ) %] -
  • - [% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %]) -
  • - [% ELSE %] -
  • -
    -
  • - [% END %] - [% END %] [% IF !(Koha.Preference('HidePersonalPatronDetailOnCirculation')) %] [% SWITCH Koha.Preference( 'AddressFormat' ) %] [% CASE 'de' %] @@ -130,4 +135,23 @@
  • Interlibrary loans
  • [% END %]
+ + + + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js index ecc22b19c1..c6b909fec6 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js @@ -82,6 +82,19 @@ $(document).ready(function(){ $("#select_patron_messages").on("change",function(){ $("#borrower_message").val( $(this).val() ); }); + + $(".edit-patronimage").on("click", function(e){ + e.preventDefault(); + var borrowernumber = $(this).data("borrowernumber"); + $.get("/cgi-bin/koha/members/moremember.pl", { borrowernumber : borrowernumber }, function( data ){ + var image_form = $(data).find("#picture-upload"); + image_form.show().find(".cancel").remove(); + $("#patronImageEdit .modal-body").html( image_form ); + }); + var modalTitle = $(this).attr("title"); + $("#patronImageEdit .modal-title").text(modalTitle); + $("#patronImageEdit").modal("show"); + }); }); function confirm_updatechild() { -- 2.11.0