Koha/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-frequencies.tt
Owen Leonard a344b8cf8c Bug 22023: Further improve responsive layout handling of staff client menu bar
This patch makes a number of changes in order to improve the way the
staff client's header menu adjusts at narrower browser widths:

 - Updated version of Bootstrap 3.3.7 which includes the "collapse"
   JavaScript plugin.
 - Modified default Bootstrap CSS using Bootstrap's customization tool.
   These changes facilitate the removal of some custom CSS (overriding
   Bootstrap) from staff-global.scss.
 - Added Bootstrap config file for loading customizations at
   https://getbootstrap.com/docs/3.3/customize/
 - Revised button classes for buttons in Bootstrap-styled toolbars.

   The modified default CSS resets the base font size in Bootstrap to
   better match our global CSS. A side-effect of this is that toolbar
   buttons ended up looking smaller than they should. Changing the
   button class solves this.

 - Restructure the header menu in order to allow different rules to
   govern the appearance of the navigational part of the menu
   (Circulation, Search, etc) and the user menu (Set library, My
   account, Log out).

 - Modify the cart JS to so that the popup works well at narrow widths.

To test, apply the patch, regenerate the staff client CSS, and clear
your browser cache.

 - Log in to the staff client and observe the layout of the header menu
   as you adjust the browser to various widths.
   - Confirm that sections of the menu "collapse" as the window gets
     narrower.
   - Confirm that dropdown menus behave correctly and that links work.
   - Confirm that the Cart link works as expected when the cart empty
     and when it has items.
- Install and enable multiple translations, including at least one
  set of sub-languages (e.g. fr-FR and fr-CA).
  - Test the appearance of the language menus in the footer at
    various browser widths.
- View pages with button toolbars and confirm that they appear unchanged
  (e.g. biblio detail page, patron detail page).

NOTE: While this patch is intended to make improvements to staff client
responsiveness, it does so within a limited scope. There are still many
pages which do not work well at narrower browser widths.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-13 05:31:28 +00:00

240 lines
9.7 KiB
Text

[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Serials &rsaquo; Frequencies</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="ser_subscription_frequencies" class="ser">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'serials-search.inc' %]
[% BLOCK translate_frequnit %]
[% SWITCH frequnit %]
[% CASE 'day' %] day
[% CASE 'week' %] week
[% CASE 'month' %] month
[% CASE 'year' %] year
[% END %]
[% END %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
<a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo;
<a href="/cgi-bin/koha/serials/subscription-frequencies.pl">Frequencies</a>
</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% IF (new or modify) %]
[% IF (new) %]
<h1>New frequency</h1>
[% ELSE %]
<h1>Edit frequency: [% description | html %]</h1>
[% END %]
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" id="add_frequency_form" method="post">
[% IF (modify) %]
<input type="hidden" name="id" value="[% id | html %]" />
<input type="hidden" name="op" value="savemod" />
[% ELSE %]
<input type="hidden" name="op" value="savenew" />
[% END %]
<fieldset class="rows">
<ol>
<li>
<label class="required" for="description">Description: </label>
<input type="text" id="description" name="description" value="[% description | html %]" class="required" required="required" /> <span class="required">Required</span>
</li>
<li>
<label for="unit">Unit: </label>
<select id="unit" name="unit">
<option value="">None</option>
[% FOREACH unit IN units_loop %]
[% IF (unit.selected) %]
<option selected="selected" value="[% unit.val | html %]">
[% ELSE %]
<option value="[% unit.val | html %]">
[% END %]
[% PROCESS translate_frequnit frequnit=unit.val %]
</option>
[% END %]
</select>
</li>
<li><span class="hint">Note: one of the two following fields must be equal to 1</span></li>
<li>
<label for="issuesperunit">Issues per unit: </label>
[% IF (new) %]
<input type="text" id="issuesperunit" name="issuesperunit" value="1" size="3" />
[% ELSE %]
<input type="text" id="issuesperunit" name="issuesperunit" value="[% issuesperunit | html %]" size="3" />
[% END %]
</li>
<li>
<label for="unitsperissue">Units per issue: </label>
[% IF (new) %]
<input type="text" id="unitsperissue" name="unitsperissue" value="1" size="3" />
[% ELSE %]
<input type="text" id="unitsperissue" name="unitsperissue" value="[% unitsperissue | html %]" size="3" />
[% END %]
</li>
<li>
<label for="displayorder">Display order: </label>
<input type="text" id="displayorder" name="displayorder" value="[% displayorder | html %]" size="3" />
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Save" />
<a href="/cgi-bin/koha/serials/subscription-frequencies.pl" class="cancel">Cancel</a>
</fieldset>
</form>
[% ELSE %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="newfrequency" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=new"><i class="fa fa-plus"></i> New frequency</a>
</div>
<h1>Frequencies</h1>
[% IF still_used %]
<div class="dialog alert">
<p>
This frequency is still used by [% subscriptions.size | html %]
subscription(s). Do you still want to delete it?
</p>
<p><a href="#" id="show_blocking_subs">Show subscriptions</a></p>
<ul id="blocking_subs" style="display:none">
[% FOREACH sub IN subscriptions %]
<li style="list-style-type:none">
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid | uri %]">[% sub.title | html %]</a>
</li>
[% END %]
</ul>
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
<input type="hidden" name="op" value="del" />
<input type="hidden" name="confirm" value="1" />
<input type="hidden" name="frequencyid" value="[% frequencyid | html %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
</form>
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% IF (frequencies_loop.size) %]
<table id="frequenciest">
<thead>
<tr>
<th>Description</th>
<th>Unit</th>
<th>Issues per unit</th>
<th>Units per issue</th>
<th>Display order</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH frequency IN frequencies_loop %]
<tr>
<td>[% frequency.description | html %]</td>
<td>[% PROCESS translate_frequnit frequnit=frequency.unit %]</td>
<td>[% frequency.issuesperunit | html %]</td>
<td>[% frequency.unitsperissue | html %]</td>
<td>[% frequency.displayorder | html %]</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=modify&frequencyid=[% frequency.id | html %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="delete_frequency btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=del&frequencyid=[% frequency.id | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<p>There is no defined frequency.</p>
[% END %]
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'serials-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
<script>
function confirmDelete() {
return confirm(_("Are you sure you want to delete this subscription frequency?"));
}
function check_form() {
var description = $("#description").val();
var unit = $("#unit").val();
var issuesperunit = $("#issuesperunit").val();
var unitsperissue = $("#unitsperissue").val();
var alert_msg = _("Some fields are not valid:") + "\n";
var errors = 0;
if(description.length == 0) {
alert_msg += "\t - " + _("Description is required");
errors ++;
}
if(unit.length > 0) {
if(isNaN(issuesperunit) || issuesperunit == 0) {
alert_msg += "\n\t - " + _("Issues per unit is required")
+ " " + _("(must be a number greater than 0)");
errors ++;
}
if(isNaN(unitsperissue) || unitsperissue == 0) {
alert_msg += "\n\t - " + _("Units per issue is required")
+ " " + _("(must be a number greater than 0)");
errors ++;
}
if(issuesperunit > 1 && unitsperissue > 1) {
alert_msg += "\n\t - " + _("One of 'issues per unit' and 'units per issue' must be equal to 1");
errors ++;
}
}
if(errors == 0) {
return true;
}
alert(alert_msg);
return false;
}
$(document).ready(function() {
$("#issuesperunit").change(function() {
var value = $(this).val();
if(!isNaN(value) && value > 1) {
$("#unitsperissue").val(1);
}
});
$("#unitsperissue").change(function() {
var value = $(this).val();
if(!isNaN(value) && value > 1) {
$("#issuesperunit").val(1);
}
});
$(".delete_frequency").on("click",function(){
return confirmDelete();
});
$("#add_frequency_form").on("submit",function(){
return check_form();
});
$("#show_blocking_subs").on("click",function(e){
e.preventDefault();
$("#blocking_subs").show();
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]