Name: primo-explore-custom-actions
Owner: UIdaho Library Digital
Description: adds custom actions to primo's actions menu.
Forked from: alliance-pcsg/primo-explore-custom-actions
Created: 2017-06-08 23:19:01.0
Updated: 2017-06-08 23:19:03.0
Pushed: 2017-06-02 22:57:01.0
Homepage: null
Size: 8
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
if you don't have a package.json
as part of your view code, go to your package directory (e.g. /primo-explore/custom/LCC_NEWUI
) and run:
init
follow the prompts and fill out basic information for your package.
from inside your package directory (e.g. /primo-explore/custom/LCC_NEWUI
), run:
install primo-explore-custom-actions
to add custom actions, edit your 2_options.js
(or another file in the package's js
directory) and add the following lines:
rtActions([{
name: "Report Problem",
type: "template",
icon: {
set: 'action',
name: 'ic_report_problem_24px'
},
action: "http://my.institution.edu/report_problem?record_id={recordId}"
name: "My Link",
icon: {
set: 'action',
name: 'ic_open_in_new_24px'
},
action: "http://google.com/"
name: "Open PNX",
type: 'template',
icon: {
set: 'action',
name: 'ic_stars_24px'
},
action: "/primo_library/libweb/jqp/record/{pnx.control.recordid}.pnx"
name: "My other link",
type: 'template',
templateVar: ['test', 'me'],
icon: {
set: 'action',
name: 'ic_stars_24px'
},
action: "http://www.example.com/{0}/{1}"
this code works by supplying a list of action objects you wish to be included. each action object can have up to four properties:
name
:
required
string
defines the name of the action as you will see it in the actions menu.
type
:
optional
string
tells the function what type of action is being added - e.g. a simple link, a problem reporter, etc.
if not specified, the function will assume the action is a simple link.
currently supported types:
icon
:
required.
object
defines the icon you wish to represent your action
action
:
required
string
a url for a page that the action will open and/or send data to
templateVar
array, as seen aboveyou can edit the code in your 2_options.js
to change these values.
adding the above example code would add four actions (not recommended, as space is limited on the actions menu):
templateVar
from inside your package directory (e.g. /primo-explore/custom/LCC_NEWUI
), run:
uninstall primo-explore-custom-actions