Change the display of subjects in the sidebar
authorJeff Godin <jgodin@tadl.org>
Mon, 23 Apr 2012 08:30:04 +0000 (04:30 -0400)
committerJeff Godin <jgodin@tadl.org>
Mon, 23 Apr 2012 08:30:04 +0000 (04:30 -0400)
For the sidebar display of subjects, use one link per subject
item, not the "increasingly specific" multiple link style of
the record detail summary.

Also minor other formatting changes, such as using <li>. Change
to slot.parentNode reference for unHideMe.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/web/opac/skin/tadlv4/xml/common/sidebar.xml

index 78bef51..e3785f5 100644 (file)
                 <div>
                 <h4>Related Subjects</h4>
                 </div>
-                <div type='opac/slot-data' query='datafield[tag^="6"]' class='rdetail_item'>
+                <div type='opac/slot-data' query='datafield[tag^="6"]'>
                     <script type='opac/slot-format'><![CDATA[
                         var cgi = new CGI();
                         var other_params = [ 'd', 'l', 'r', 'av', 's', 'sd', 'ol' ];
-                        var total = '';
-                        var output = [];
+                        var subj_display = '';
+                        var subj_search = '';
+                        var subj_line = '';
                         var list = dojo.query( 'subfield', item );
                         for (var i = 0; i < list.length; i++) {
                             var sub_code = list[i].getAttribute('code');
                             if ( sub_code.match(/[a-z]/i) ) {
-                                var current = '';
                                 if ( sub_code.match(/[vxyz]/) ) {
-                                    current += '&#x2d;&#x2d; ';
+                                    subj_display += '&#x2d;&#x2d; ';
                                 }
-                                total += BT.textContent(list[i]) + ' ';
-                                current += '<a href="rresult.xml?rt=subject&tp=subject&t=' + total.replace(/\s+$/, '');
-                                for (var p in other_params) {
-                                    if (cgi.param(other_params[p]))
-                                        current += '&' + other_params[p] + '=' + cgi.param(other_params[p]);
-                                }
-                                current += '">' + BT.textContent(list[i]) + '</a>'
-                                output.push(current);
+                                subj_display += BT.textContent(list[i]) + ' ';
+                                subj_search += BT.textContent(list[i]) + ' ';
                             }
                         }
-                        unHideMe($('sidebarSubjects'));
-                        return '<span>' + output.join(' ') + '</span><br/>';
+                        subj_line += '<li><a href="rresult.xml?rt=subject&tp=subject&t=' + subj_search.replace(/\s+$/, '');
+                        for (var p in other_params) {
+                            if (cgi.param(other_params[p]))
+                                subj_line += '&' + other_params[p] + '=' + cgi.param(other_params[p]);
+                        }
+                        subj_line += '">' + subj_display + '</a></li>';
+                        unHideMe(slot.parentNode);
+                        return '<span>' + subj_line + '</span>';
                     ]]></script>
                 </div>
     </div>