Bug 21838: Wrong alignment of instructors in course reserves
authorOwen Leonard <oleonard@myacpl.org>
Thu, 15 Nov 2018 13:39:33 +0000 (13:39 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 16 Nov 2018 12:53:02 +0000 (12:53 +0000)
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>

koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt

index c34d14e..931a355 100644 (file)
 [% 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">
                 <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>
index 91db22b..a47195d 100644 (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">
                         <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>
             });
 
             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();