Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

There are a few customizations to code used on the libraries site. This doc will detail where the code is located as well as what it interacts with. It also contains some information about some rewrites in views fields that affect the display of content. This doc will NOT include template overrides (twig files). That is detailed in this document: https://oulibraries.atlassian.net/wiki/x/LoDPrw

OU_Lib_subtheme

The subtheme is the custom theme that is based on the drupal bootstrap barrio theme. This theme is based on bootstrap 5. These various files are managed as libraries in the ou_lib_subtheme.libraries.yml file - web/themes/custom/ou_lib_subtheme/ou_lib_subtheme.libraries.yml. In that file, the “global-styling” library is used for the entire site and the “front-js” library is used only on the homepage for the search box.

Styles

  • style.css - web/themes/custom/ou_lib_subtheme/css/style.css

    • Virtually all styles for the entire site. Contains lots of styles for colors, fonts, and any bootstrap overrides.

  • search.css - web/themes/custom/ou_lib_subtheme/css/search.css

    • The css needed for the search box on the homepage

  • globalnav.css - web/themes/custom/ou_lib_subtheme/css/globalnav.css

    • Used for the styling of the universal black OU top banner

JS

  • global.js - web/themes/custom/ou_lib_subtheme/js/global.js

    • Main js file for any additional functionality needed on the site.

    • More detailed breakdown later in this doc

  • front.js - web/themes/custom/ou_lib_subtheme/js/front.js

    • The js needed for the search box on the homepage

Fonts

Fonts are loaded via the “adobe-fonts” library. In Adobe font manager, the fonts needed were chosen, then added to a project and referred to in this library. The current adobe fonts link is https://fonts.adobe.com/eulas/00000000000000003b9b011e?ref=tk.com

Custom Module for LibCal events

The location for the custom module is web/modules/custom/libcal_events

Similar to the sub theme, this custom module uses a library in “libcal_events_libraries.yml”. With that library, the following is loaded into pages where the custom module is used.

Styles

  • libcal-events.css - web/modules/custom/libcal_events/css/libcal-events.css

    • Styling used for events

JS

  • libcal-events.js - web/modules/custom/libcal_events/js/libcal-events.js

    • Main js for events.

    • More detailed breakdown later in this doc

Controller/PHP

  • LibcalEventsGetEventsController.php - web/modules/custom/libcal_events/src/Controller/LibcalEventsGetEventsController.php

    • Main controller for making the api call and interacting with the ajax call from the js file.

    • More detailed breakdown later in this doc

View rewrites

Some of the view fields required the need to rewrite the results of that field to provide a certain format to the display. This is a breakdown of those rewrites and where they are

E-Resources A-Z view

Page: https://libraries.ou.edu/eresources

Admin: https://libraries.ou.edu/admin/structure/views/view/e_resources/edit/eresources

  • Content: URL

    • Need to fix format of the field_database___uri. This is the URL that the eresource links to and there were some formatting and character issues with this until the following rewrite was added. This fixed version of the URL (field_database_) is what is used in the two rewrites after that are detailed below.

      • {{ field_database___uri|render|striptags|trim|replace({'&': '&'}) }}

  • Content: Title

    • Check if the proxy checkbox was active, if so, add the proxy url to the field_database_ URL. That conditional is used in the rewrite section for this field since the title is what the user clicks on to go to the eresource.

      • {% if field_proxy|trim == 1 %}
        <a class="panel-title" role="button" href="https://login.ezproxy.lib.ou.edu/login?url={{ field_database_ }}" target="_blank" rel="noopener">{{ title }}</a>
        {% else %}
        <a class="panel-title" role="button" href="{{ field_database_ }}" target="_blank" rel="noopener">{{ title }}</a>
        {% endif %}

  • permalink_url (Permalink)

    • This is similar to the Content: Title overwrite. Since we write the permalink out in the eresource listing, we need to add the proxy here as well.

      • {% if field_proxy|trim == 1 %}
        https://login.ezproxy.lib.ou.edu/login?url={{ field_database_ }}
        {% else %}
        {{ field_database_ }}
        {% endif %}

“Getting Started Databases” section on resources by subject pages

Shortened display with only title and description. None of the extra data.

Page Example: https://libraries.ou.edu/resources-subject/engineering

Admin: https://libraries.ou.edu/admin/structure/views/view/e_resources/edit/block_2

  • Content: URL

    • Need to fix format of the field_database___uri. This is the URL that the eresource links to and there were some formatting and character issues with this until the following rewrite was added. This fixed version of the URL (field_database_) is what is used in the two rewrites after that are detailed below.

      • {{ field_database___uri|render|striptags|trim|replace({'&': '&'}) }}

  • Content: Title

    • Check if the proxy checkbox was active, if so, add the proxy url to the field_database_ URL. That conditional is used in the rewrite section for this field since the title is what the user clicks on to go to the eresource.

      • {% if field_proxy|trim == 1 %}
        <a class="panel-title" role="button" href="https://login.ezproxy.lib.ou.edu/login?url={{ field_database_ }}" target="_blank" rel="noopener">{{ title }}</a>
        {% else %}
        <a class="panel-title" role="button" href="{{ field_database_ }}" target="_blank" rel="noopener">{{ title }}</a>
        {% endif %}

E-resources filtered by subject

This is different from view above. It shows all eresources for that subject and is filterable by type and searchable. Also shows full description with the more info section.

Page Example: https://libraries.ou.edu/subjects/african-african-american-studies

Admin: https://libraries.ou.edu/admin/structure/views/view/taxonomy_term/edit/block_1

  • Content: URL

    • Need to fix format of the field_database___uri. This is the URL that the eresource links to and there were some formatting and character issues with this until the following rewrite was added. This fixed version of the URL (field_database_) is what is used in the two rewrites after that are detailed below.

      • {{ field_database___uri|render|striptags|trim|replace({'&': '&'}) }}

  • Content: Title

    • Check if the proxy checkbox was active, if so, add the proxy url to the field_database_ URL. That conditional is used in the rewrite section for this field since the title is what the user clicks on to go to the eresource.

      • {% if field_proxy|trim == 1 %}
        <a class="panel-title" role="button" href="https://login.ezproxy.lib.ou.edu/login?url={{ field_database_ }}" target="_blank" rel="noopener">{{ title }}</a>
        {% else %}
        <a class="panel-title" role="button" href="{{ field_database_ }}" target="_blank" rel="noopener">{{ title }}</a>
        {% endif %}

  • permalink_url (Permalink)

    • This is similar to the Content: Title overwrite. Since we write the permalink out in the eresource listing, we need to add the proxy here as well.

      • {% if field_proxy|trim == 1 %}
        https://login.ezproxy.lib.ou.edu/login?url={{ field_database_ }}
        {% else %}
        {{ field_database_ }}
        {% endif %}
  • No labels