Bug 21838: Wrong alignment of instructors in course reserves

This patch adds CSS to course reserve pages so that multiple instructors
on a course are displayed well.

To test, apply the patch and:

 - Add or edit a course.
   - Test adding and removing instructors, saving, and adding and removing
     again.
 - View a course with multiple instructors and confirm that they are
   displayed well.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Awesome, Owen :-D

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2018-11-15 13:39:33 +00:00 committed by Nick Clemens
parent 119653a3a1
commit 2517147c30
2 changed files with 40 additions and 11 deletions

View file

@ -10,6 +10,14 @@
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/datatables.css") | $raw %]
<style>
#instructors {
float: left;
}
.instructor_line {
padding: 0 .1em;
}
</style>
</head>
<body id="courses_course_details" class="course">
@ -45,7 +53,16 @@
<li><span class="label">Department</span> [% AuthorisedValues.GetByCode( 'DEPARTMENT', course.department ) | html %]</li>
<li><span class="label">Course number</span> [% course.course_number | html %]</li>
<li><span class="label">Section</span> [% course.section | html %]</li>
<li><span class="label">Instructors</span> [% FOREACH i IN course.instructors %]<div class="instructor"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% i.borrowernumber | uri %]">[% i.firstname | html %] [% i.surname | html %]</a></div>[% END %]</li>
<li>
<span class="label">Instructors</span>
<div id="instructors">
[% FOREACH i IN course.instructors %]
<div class="instructor_line">
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% i.borrowernumber | uri %]">[% i.firstname | html %] [% i.surname | html %]</a>
</div>
[% END %]
</div>
</li>
<li><span class="label">Staff note</span> [% course.staff_note | html %]</li>
<li><span class="label">Public note</span> [% course.public_note | html %]</li>
<li><span class="label">Student count</span> [% course.students_count | html %]</li>

View file

@ -2,6 +2,14 @@
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Course reserves &rsaquo; [% IF course_name %] Edit [% course_name | html %] [% ELSE %] New course [% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<style>
#course_instructors {
float: left;
}
.instructor_line {
padding: .3em;
}
</style>
</head>
<body id="courses_course" class="course">
@ -78,16 +86,20 @@
<li>
<span class="label">Instructors:</span>
<fieldset id="course_instructors">
<div id="instructors">[% FOREACH i IN instructors %]<div id="borrower_[% i.borrowernumber | html %]">[% i.surname | html %], [% i.firstname | html %] ( <a href="#" class="removeInstructor"> Remove </a> )
<input type='hidden' name='instructors' value='[% i.borrowernumber | html %]' /></div>[% END %]</div>
</fieldset>
<fieldset>
<label for="find_instructor">Instructor search:</label>
<input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit"/>
<div id="course_instructors">
<div id="instructors">
[% FOREACH i IN instructors %]
<div class="instructor_line" id="borrower_[% i.borrowernumber | html %]">[% i.surname | html %], [% i.firstname | html %] ( <a href="#" class="removeInstructor"><i class="fa fa-trash"></i> Remove </a> )
<input type='hidden' name='instructors' value='[% i.borrowernumber | html %]' />
</div>
[% END %]
</div>
<p>
<label for="find_instructor">Instructor search:</label>
<input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit"/>
</p>
<div id="find_instructor_container"></div>
</fieldset>
</div>
<li>
<label for="staff_note">Staff note:</label>
<textarea name="staff_note" id="staff_note">[% staff_note | html %]</textarea>
@ -174,7 +186,7 @@
});
function AddInstructor( name, borrowernumber ) {
div = "<div id='borrower_" + borrowernumber + "'>" + name + " ( <a href='#' class='removeInstructor'> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + borrowernumber + "' /></div>";
div = "<div class='instructor_line' id='borrower_" + borrowernumber + "'>" + name + " ( <a href='#' class='removeInstructor'><i class='fa fa-trash'></i> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + borrowernumber + "' /></div>";
$('#instructors').append( div );
$('#find_instructor').val('').focus();