PINES Carousel Customizations for 3.10
authorTerran McCanna <tmccanna@georgialibraries.org>
Thu, 12 Nov 2020 19:46:30 +0000 (14:46 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 23 Nov 2022 18:59:40 +0000 (13:59 -0500)
OPAC: PINES Carousel Implementation

Adds carousel display with custom carousel picker to home page.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
OPAC: Carousel - Animate

Enable ability for carousel to automatically advance every 2 seconds.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
OPAC: restore books image for carousels

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
LP1929872 Open Carousel as a Result List

This adds a new link in the carousel block that will open the
contents of that carousel in a result list format so that a patron
can see everything at once.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Carousel - moving logic to open carousel as a list into new API

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
LP1929872 Make carousel title into link

(instead of having a new link under the title)

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
LP1929872 Fixing link

PINES OPAC Carousel CSS

Adds additional CSS for iframe usage that overrides the basic
OPAC usage CSS.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
PINES - Add list icon next to carousel title

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Carousel.pm
Open-ILS/src/templates-bootstrap/opac/carousel.tt2
Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2
Open-ILS/src/templates-bootstrap/opac/parts/homesearch.tt2
Open-ILS/src/templates-bootstrap/opac/parts/misc_util.tt2
Open-ILS/src/templates-bootstrap/opac/parts/org_selector.tt2
Open-ILS/web/images/books.jpg [new file with mode: 0644]

index cc5d0ec..ce4137f 100644 (file)
@@ -34,7 +34,8 @@ sub get_carousel_contents {
     my $carousel = $e->retrieve_container_carousel($id);
     my $ret = {
         id   => $id,
-        name => $carousel->name
+        name => $carousel->name,
+        bucketid => $carousel->bucket
     };
     my $q = {
         select => { bre => ['id'], mfde => [{ column => 'value', alias => 'title' }] },
index bf54466..a2ca144 100644 (file)
@@ -6,3 +6,54 @@
        PROCESS carousels;
        END
 -%]
+<!-- PINES Carousel Customization for iframes -->
+<style type="text/css">
+       .carousel {
+               margin-left: 100px;
+       }
+       .glide__slide {
+               padding:0px;
+               margin:0px;
+               width:120px !important;
+       }
+       .carousel-entry-image {
+               width:auto;
+               height:150px;
+       }
+
+       @media only screen and (max-width: 1200px) {
+               .carousel {
+                       margin-left: 60px;
+                       width: 100%;
+               }
+               .glide__slide {
+                       width:100px !important;
+               }
+               .carousel-entry {
+                       width:100px;
+               }
+           .carousel-entry-image {
+                       width: auto;
+                       height: 110px;
+                       border: 1px solid #999;
+               }
+       }
+
+       @media only screen and (max-width: 1000px) {
+               .carousel {
+                       margin-left: 0px;
+                       width: 100%;
+               }
+               .glide__slide {
+                       width:100px !important;
+               }
+               .carousel-entry {
+                       width:100px;
+               }
+           .carousel-entry-image {
+                       width: auto;
+                       height: 110px;
+                       border: 1px solid #999;
+               }
+       }
+</style>
\ No newline at end of file
index 88a4a93..87ba483 100755 (executable)
@@ -3863,8 +3863,8 @@ label[for*=expert_]
 */
 
 .carousel {
-    width: 80%;
-    margin: 0 auto;
+    width: 50%;
+    margin-left: 450px;
 }
 .carousel-title {
     font-size: 150%;
@@ -3876,7 +3876,7 @@ label[for*=expert_]
     margin: 0px 3px;
 }
 .carousel-entry {
-    max-width: 150px;
+    max-width: 130px;
 }
 
 /* Truncate titles within carousel to 4 lines */
@@ -3888,8 +3888,9 @@ label[for*=expert_]
 }
 
 .carousel-entry-image {
-    width: 100%;
-    height: auto;
+    width: auto;
+    height: 160px;
+    border: 1px solid #999;
 }
 .carousel .glide__arrow {
     color: [% css_colors.button_text %];
@@ -3905,11 +3906,9 @@ label[for*=expert_]
 }
 .carousel .glide__arrow--right {
     right: -5em;
-    margin-top: -100px;
 }
 .carousel .glide__arrow--left {
-    left: -4em;
-    margin-top: -100px;
+    left: -7em;
 }
 
 /* PINES Carousel customizations */
@@ -3936,21 +3935,6 @@ label[for*=expert_]
     color: #006838;
 }
 
-/* Other PINES customizations */
-
-select option:disabled {
-    background-color: #ddd;
-}
-
-pre {
-    overflow-x: auto;
-    white-space: pre-wrap;
-    white-space: -moz-pre-wrap;
-    white-space: -pre-wrap;
-    white-space: -o-pre-wrap;
-    word-wrap: break-word;
-}
-
 @media only screen and (max-width: 1200px) {
     .carousel {
         margin-left: 430px;
@@ -3979,7 +3963,7 @@ pre {
         height: 80px;
         width: 100%;
         margin: auto;
-        margin-top: -20px;
+        margin-top: -50px;
         margin-bottom: 40px;
     }
     .pines_carousel_selector_image {
@@ -3990,17 +3974,6 @@ pre {
         font-weight: bold;
         color: #006838;
     }
-    .carousel .glide__arrow {
-        display: none;
-    }
-    .carousel .glide__arrow--right {
-        display: none;
-    }
-    .carousel .glide__arrow--left {
-        display: none;
-    }
-
->>>>>>> d9e3b208a9... PINES Bootstrap Customizations
 }
 
 .search-filter{
index 229d442..cde1bcc 100755 (executable)
@@ -1,5 +1,16 @@
-<div id="homeLogo">
-    
-</div>
+<!-- PINES Customizations -->
+
+    <div class="pines_carousel_selector">
+        <img alt="[% l('New Arrivals') %]" src="[% ctx.media_prefix %]/images/books.jpg" class="pines_carousel_selector_image"/><br/>
+        <span class="pines_carousel_selector_text">[% l('New Library Materials') %]</span><br/>
+        <br/>
+        <form>
+            [% INCLUDE build_org_selector_carousel show_loc_groups=1 %]
+        </form>
+    </div>
+
+<!-- End PINES Customizations -->
+
+    [% PROCESS carousels %]
+
 
-[% PROCESS carousels %]
index fd70af9..17f4cce 100755 (executable)
 [%- BLOCK carousels;
     config = {
         animated => 1,
-        animation_interval => 3,
+        animation_interval => 2,
         width => 4,
         sm_width => 3,
         xs_width => 2,
    IF carousel.bibs.size > 0;
 %]
 <div class="carousel">
-<h2 class="carousel-title">[% carousel.name %]</h2>
+<h2 class="carousel-title"><a href="[% mkurl(ctx.opac_root  _ '/results?query=' _ '&fi:container=bre,carousel,' _ carousel.bucketid, {},
+        ['carousel_loc', 'fi:container', 'qtype', 'query']) %]" target="_top">
+               <i class="fas fa-list" style="color:#8DC641;font-size:.8em;" aria-hidden="true"></i>
+               [% carousel.name %]</a>
+</h2>
 <div class="carousel-body glide" id="carousel-[% carousel.id %]">
   <div class="glide__track" data-glide-el="track">
     <ul class="glide__slides">
index 1cd1cf5..f7e6af5 100755 (executable)
@@ -222,3 +222,136 @@ BLOCK build_scope_selector;
 
     </select>
 [%- END %]
+
+[%  # PINES Customization for Carousels
+    # Build org selector that refreshes page with carousel_loc set to control which carousels display
+
+BLOCK build_org_selector_carousel;
+    node_stack = [{org => org_unit || ctx.aouct_tree || ctx.aou_tree}];
+    inherited_vis = ctx.get_cgf('opac.org_unit.non_inherited_visibility').enabled == 'f';
+
+    IF !name;
+        name = loc_name;
+    END;
+    IF !value;
+        value = loc_value;
+    END;
+
+    # if the selected org unit is out of hiding scope,
+    # disable the ou-hide scoping altogether.
+    hiding_disabled = ctx.org_hiding_disabled(value);
+
+    -%]
+
+    <select id='carousel_selector'
+            title='[% arialabel || l("Select Library") %]'
+            class="org_selector_dropdown"
+            onchange="location = '/eg/opac/home?carousel_loc=' +
+                this.options[this.selectedIndex].value">
+    <option value="" class="org_unit" disabled selected="selected">[% l("Choose a library to see newly purchased items") %]</option>
+    [%-
+        WHILE node_stack.size > 0;
+            node = node_stack.pop();
+            org_unit = node.org;
+            loc_grp = node.loc_grp;
+            ou_id = org_unit.id;
+            css_class = '';
+            disabled = '';
+            selected = '';
+            visible = org_unit.opac_visible == 't';
+
+            # org and all children are invisible.
+            NEXT IF !visible AND inherited_vis AND !ctx.is_staff;
+
+            IF !loc_grp; # processing an org unit
+
+                top_loc_groups = [];
+                IF show_loc_groups;
+                    # add the location groups that sort below the child org units
+                    FOR grp IN ctx.copy_location_groups.$ou_id.reverse;
+                        IF grp.top == 't';
+                            top_loc_groups.push(grp);
+                        ELSE;
+                            node_stack.push({org => org_unit, loc_grp => grp});
+                        END;
+                    END;
+                END;
+
+                # add the child org units
+                FOR child IN org_unit.children.reverse;
+                    node_stack.push({org => child});
+                END;
+
+                # add the location groups that sort to the top
+                # above the child org units
+                FOR grp IN top_loc_groups;
+                    node_stack.push({org => org_unit, loc_grp => grp});
+                END;
+
+            END;
+
+            # org is not publicly visible (though its children may be).
+            NEXT UNLESS ctx.is_staff OR visible;
+
+            # org is not within hiding scope (though its children may be).
+            NEXT UNLESS hiding_disabled OR ctx.org_within_hiding_scope(ou_id);
+
+            node_value = ou_id;
+            IF loc_grp;
+                node_value = node_value _ ':' _ loc_grp.id;
+                css_class = 'class="loc_grp"';
+            ELSE;
+                css_class = 'class="org_unit"';
+            END;
+
+            IF can_have_vols_only AND org_unit.ou_type.can_have_vols != 't';
+                disabled = 'disabled="disabled"';
+            ELSIF node_value == value;
+                selected = 'selected="selected"';
+            END;
+
+            IF can_have_users_only AND org_unit.ou_type.can_have_users != 't';
+                disabled = 'disabled="disabled"';
+            ELSIF node_value == value;
+                selected = 'selected="selected"';
+            END;
+
+            IF hold_pickup_lib AND ctx.get_org_setting(
+                    org_unit.id, 'opac.holds.org_unit_not_pickup_lib');
+                disabled = 'disabled="disabled"';
+            END;
+
+            # caller provided a list of valid org units.
+            # all orgs not in the list are marked invalid.
+            IF valid_org_list AND
+                    !valid_org_list.grep('^' _ org_unit.id _ '$').size;
+                disabled = 'disabled="disabled"';
+                selected = '';
+            END;
+
+            pad_depth = 0;
+
+            # copy loc groups appear as children of the owning org unit
+            SET pad_depth = pad_depth + 1 IF loc_grp;
+
+            # determine the depth by calculating the distance from the root
+            porg = ctx.get_aou(org_unit.parent_ou);
+            WHILE porg;
+                SET pad_depth = pad_depth + 1 IF porg.opac_visible == 't' OR ctx.is_staff;
+                porg = ctx.get_aou(porg.parent_ou);
+            END;
+
+            pad_depth = pad_depth * 5;
+            display_name = loc_grp ? loc_grp.name : org_unit.name %]
+            [% IF node_value == 1 %]
+                [% display_name = "All PINES Libraries" %]
+            [% END %]
+
+            <option value='[% org_unit.id %]' [% selected %] [% disabled %] [% css_class %]>
+                [% '&nbsp;' FOR [0..pad_depth]; display_name | html %]
+            </option>
+
+        [%- END %]
+    </select>
+[%- END %]
+
diff --git a/Open-ILS/web/images/books.jpg b/Open-ILS/web/images/books.jpg
new file mode 100644 (file)
index 0000000..6becb9b
Binary files /dev/null and b/Open-ILS/web/images/books.jpg differ