npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@orbis-cascade/primo-explore-favorites-warning

v2.1.1

Published

A package that enables a warning when users try to add an item from Primo to their favorites list without being logged in. If the user isn't logged in their favorites list won't be permanent.

Downloads

4

Readme

Login Warning for Permanent Favorites List

Developer

Jeremiah Kellogg (Eastern Oregon University)

Code Repository

https://github.com/alliance-pcsg/primo-explore-favorites-warning

Description

Favorites lists can be created by guest users, but once they end their session that list goes away. In order to make a favorites list permanent the user needs to login, but Primo has no built in warning to let guest users know this. This development offers two warnings letting guest users know they need to login if they want to save a favorites list permanently.

The first is similar to the login for complete results warning bar that appears in search results list. The favorites warning has the same functionality but appears on the My Favorites page when users aren't logged in:

warning bar

The second warning is a button that appears over the add-to-favorites button when a user isn't logged in or if the warning has been dismissed. When this overlay button is clicked a pop-up window appears to warn the user they must be logged in to save favorites lists permanently. This window also gives the option of logging in or dismissing the warning:

Brief record pin icon

Modal display

System Components

PBO, Package Manager

Skillset Requirements

PBO, JavaScript, CSS

Accessibility

Has not been tested for accessibility

Browser Support

Tested on Chrome, Firefox, Edge, and Safari

Mobile Support

Tested on iPhone

Implementation

Steps

  1. In the PBO, make sure you have the "Inherit Central Package" box checked.
  2. In your local package, in the custom.js file, include the module 'showFavoritesWarning' in your app definition. For example:
var app = angular.module('viewCustom', ['showFavoritesWarning']);

If you are using other angular modules, include them in your app definition as well. For example:

var app = angular.module('viewCustom', ['toggleInstitutions', 'showFavoritesWarning']);
  1. Also in the custom.js file, add the following lines of code within the anonymous function (that is, before the closing brackets at the end of the file).

For the warning bar that appears on the My Favorites page:

app.component('prmFavoritesToolBarAfter', {template: '\<show-favorites-warning /\>' });

For the button overlay that calls the favorites warning modal window when clicked:

app.component('prmSaveToFavoritesButtonAfter', {template:'\<fav-overlay /\>'});

By adding those lines you are effectively enabling both warnings. If you'd like to enable one and not the other, simply omit the one you don't want from the custom.js file.

  1. If you want to customize text associated with warning or to disable a warning, add the following block of code within the anonymous function and edit the values.
app.value('globalFavVars', {

        favWarnBarTxt:'Sign in to make your favorites list permanent',

        favWarnModalTitleText: 'Sign in to make your favorites list permanent',

        favWarnModalHoverText:'Add to my favorites',

        favWarnModalContentText:'You can create a favorites list as a Guest, but to save a list permanently you must be signed in',

});
  1. In your local package, in the custom1.css file, add the following CSS if you want to customize colors, padding, or text styles:
/\* id for customizing the alert bar on favorites page \*/

#fav-bar {

        /\*background-color: tomato;\*/

}

/\* id for customizing the text in the fav warning bar on favorites page\*/

#fav-bar-text {

}

/\* id for customizing the header box of the fav warning pop-up modal\*/

#fav-modal-header{

        /\*background-color: tomato;\*/

}

/\* id for customizing text and font attributes in fav warning pop-up modal header\*/

#fav-modal-header-text {

        /\*padding-top: 10px;\*/

}

/\* id for customizing modal content box below modal header \*/

#fav-modal-content {

        /\*background-color: tomato;\*/

}

/\* id for customizing modal content text below header\*/

#fav-modal-content-text {

        /\*font-size: 10px;\*/

}
  1. Zip and upload your package in the PBO.
  2. Deploy your view.