Bug 11694: Improve handling of individual hold suspension in Bootstrap OPAC
This patch changes the way the controls to suspend and resume holds are displayed on the OPAC for a logged-in user when using the Bootstrap theme. Instead of showing all the suspend options in the table cell a link will trigger a modal with the controls. This makes the table more compact and readable. The patch adds a span and class to the dateformat include so that the dateformat hint can be hidden if JavaScript is enabled (and thus the datepicker will use the correct format automatically). A new class has been added to the CSS, ".js-show" to be used for elements which should be hidden if JavaScript is disabled and made visible by JavaScript if it is enabled. To test you must have RequestOnOpac, SuspendHoldsOpac, and the bootstrap theme enabled. Apply the patch and test with AutoResumeSuspendedHolds enabled: 1. Log in to the OPAC and place a hold. 2. View the list of your holds in the OPAC. 3. Click the "Suspend" link for your new hold. A modal window should appear allowing you to specify a suspend-until date. 4. Specify a suspend-until date. Test the "clear" link and confirm that it clears the date. 5. Specify a suspend-until date and submit. 6. Confirm that the hold has been suspended with the specified resumption date. 7. Click the "Resume" link on the suspended hold to resume. 8. Click the "Suspend" link again and submit without specifying a date. 9. Confirm that the hold has been suspended indefinitely. Follow the same steps above with JavaScript disabled. The "suspend until" options will appear inside the table as before and everything should work correctly. Test with AutoResumeSuspendedHolds disabled. No modal dialog should appear when the "Suspend" link is clicked. The hold should simply be suspended indefinitely. Test again with JavaScript disabled. There should be no change in functionality. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes all tests and QA script, works as described. Happy about the fallback for users without Javascript. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
ed10e5226c
commit
17cf2657ef
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
[% IF ( dateformat == "us" ) %](MM/DD/YYYY)[% ELSIF ( dateformat == "metric" ) %](DD/MM/YYYY)[% ELSE %](YYYY-MM-DD)[% END %]
|
||||
<span class="dateformat">[% IF ( dateformat == "us" ) %](MM/DD/YYYY)[% ELSIF ( dateformat == "metric" ) %](DD/MM/YYYY)[% ELSE %](YYYY-MM-DD)[% END %]</span>
|
||||
|
|
|
|||
|
|
@ -479,10 +479,10 @@
|
|||
<th>Priority</th>
|
||||
[% END %]
|
||||
<th>Status</th>
|
||||
<th class="nosort">Modify</th>
|
||||
[% IF SuspendHoldsOpac %]
|
||||
<th class="nosort" >Suspend individual holds</th>
|
||||
<th class="nosort" >Suspend</th>
|
||||
[% END %]
|
||||
<th class="nosort">Modify</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -555,6 +555,52 @@
|
|||
[% END %]
|
||||
[% END %]
|
||||
</td>
|
||||
[% IF SuspendHoldsOpac %]
|
||||
<td>
|
||||
[% IF ( RESERVE.cancelable ) %]
|
||||
[% IF RESERVE.suspend %]
|
||||
<form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
|
||||
<input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
|
||||
<button class="btn btn-link" type="submit" name="submit"><i class="icon-play"></i> Resume</button>
|
||||
</form>
|
||||
[% ELSE %]
|
||||
[% IF AutoResumeSuspendedHolds %]
|
||||
<a class="btn btn-link js-show" href="#suspendModal[% RESERVE.reserve_id %]" role="button" data-toggle="modal"><i class="icon-pause"></i> Suspend</a>
|
||||
[% # hold suspend modal form %]
|
||||
<div id="suspendModal[% RESERVE.reserve_id %]" class="modal-nojs" tabindex="-1" role="dialog" aria-labelledby="suspendModal[% RESERVE.reserve_id %]Label" aria-hidden="true">
|
||||
<form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
[% IF RESERVE.suspend %]
|
||||
<h3 id="suspendModal[% RESERVE.reserve_id %]Label">Resume your hold on <i>[% RESERVE.reserves_title %]</i></h3>
|
||||
[% ELSE %]
|
||||
<h3 id="suspendModal[% RESERVE.reserve_id %]Label">Suspend your hold on <i>[% RESERVE.reserves_title %]</i></h3>
|
||||
[% END %]
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
|
||||
<label for="suspend_until_[% RESERVE.reserve_id %]">Suspend until:</label>
|
||||
<input name="suspend_until" id="suspend_until_[% RESERVE.reserve_id %]" class="suspend-until" size="10" />
|
||||
[% INCLUDE 'date-format.inc' %]
|
||||
<p class="js-show"><a href="#" onclick="document.getElementById('suspend_until_[% RESERVE.reserve_id %]').value='';return false;">Clear date to suspend indefinitely</a></p>
|
||||
<button class="btn btn-mini js-hide" type="submit" name="submit">Suspend</button>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" type="submit" name="submit">Suspend</button>
|
||||
<a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- /#suspendModal[% RESERVE.reserve_id %] -->
|
||||
[% ELSE %]
|
||||
<form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
|
||||
<input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
|
||||
<button class="btn btn-link" type="submit" name="submit"><i class="icon-pause"></i> Suspend</button>
|
||||
</form>
|
||||
[% END # / IF AutoResumeSuspendedHolds %]
|
||||
[% END # / IF RESERVE.suspend %]
|
||||
[% END # / IF ( RESERVE.cancelable )%]
|
||||
</td>
|
||||
[% END # / IF SuspendHoldsOpac %]
|
||||
<td class="modify">
|
||||
[% IF ( RESERVE.cancelable ) %]
|
||||
<form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
|
||||
|
|
@ -563,27 +609,6 @@
|
|||
<button type="submit" name="submit" class="btn btn-mini btn-danger" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);"><i class="icon-remove icon-white"></i> Cancel</button></form>
|
||||
[% END %]
|
||||
</td>
|
||||
[% IF SuspendHoldsOpac %]
|
||||
<td>
|
||||
[% IF ( RESERVE.cancelable ) %]
|
||||
<form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
|
||||
<input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
|
||||
|
||||
[% IF RESERVE.suspend %]
|
||||
<button class="btn btn-mini" type="submit" name="submit"><i class="icon-play"></i> Resume suspended hold</button>
|
||||
[% ELSE %]
|
||||
<button class="btn btn-mini" type="submit" name="submit"><i class="icon-pause"></i> Suspend hold</button>
|
||||
|
||||
[% IF AutoResumeSuspendedHolds %]
|
||||
<label for="suspend_until_[% RESERVE.reserve_id %]"> until </label>
|
||||
<input name="suspend_until" id="suspend_until_[% RESERVE.reserve_id %]" class="suspend-until" readonly="readonly" size="10" />
|
||||
<a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('suspend_until_[% RESERVE.reserve_id %]').value='';return false;">Clear date</a>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</form>
|
||||
[% END %]
|
||||
</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END # /FOREACH RESERVES %]
|
||||
</tbody>
|
||||
|
|
@ -598,7 +623,7 @@
|
|||
[% IF AutoResumeSuspendedHolds %]
|
||||
<label for="suspend_until"> until </label>
|
||||
<input name="suspend_until" id="suspend_until" class="suspend-until" readonly="readonly" size="10" />
|
||||
<a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('suspend_until').value='';return false;">Clear date</a>
|
||||
<a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('suspend_until').value='';return false;">Clear date to suspend indefinitely</a>
|
||||
[% END %]
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -633,7 +658,10 @@
|
|||
|
||||
$(function() {
|
||||
$('#opac-user-views').tabs();
|
||||
|
||||
$(".js-show").show();
|
||||
$(".js-hide").hide();
|
||||
$(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
|
||||
$(".suspend-until").prop("readonly",1);
|
||||
var dTables = $("#checkoutst,#holdst,#overduest");
|
||||
dTables.each(function(){
|
||||
var thIndex = $(this).find("th.psort").index();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,22 @@ body {
|
|||
/* The html and body elements cannot have any padding or margin. */
|
||||
}
|
||||
|
||||
.no-js {
|
||||
.dateformat {
|
||||
display: inline;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.modal-body {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.js {
|
||||
.dateformat {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Wrapper for page content to push down footer */
|
||||
#wrap {
|
||||
min-height: 100%;
|
||||
|
|
@ -121,6 +137,15 @@ table, td {
|
|||
background-color: #FFF;
|
||||
}
|
||||
|
||||
td {
|
||||
.btn {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.btn-link {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#advsearches,
|
||||
#booleansearch {
|
||||
label {
|
||||
|
|
@ -2315,4 +2340,15 @@ a.reviewlink:visited {
|
|||
padding-right: 6px;
|
||||
}
|
||||
|
||||
.js-show {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.modal-nojs {
|
||||
.modal-header,
|
||||
.modal-footer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@import "responsive.less";
|
||||
|
|
|
|||
Loading…
Reference in New Issue