{"id":21757932,"url":"https://github.com/alliance-pcsg/primo-explore-custom-actions","last_synced_at":"2025-04-13T12:09:34.294Z","repository":{"id":57134135,"uuid":"79370484","full_name":"alliance-pcsg/primo-explore-custom-actions","owner":"alliance-pcsg","description":":hammer_and_wrench: easily add custom actions to primo-explore's actions menu.","archived":false,"fork":false,"pushed_at":"2020-09-10T13:03:12.000Z","size":361,"stargazers_count":15,"open_issues_count":5,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-13T12:09:14.270Z","etag":null,"topics":["angularjs","primo-explore"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alliance-pcsg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-18T18:29:20.000Z","updated_at":"2023-03-23T13:34:16.000Z","dependencies_parsed_at":"2022-09-04T09:31:29.885Z","dependency_job_id":null,"html_url":"https://github.com/alliance-pcsg/primo-explore-custom-actions","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliance-pcsg%2Fprimo-explore-custom-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliance-pcsg%2Fprimo-explore-custom-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliance-pcsg%2Fprimo-explore-custom-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alliance-pcsg%2Fprimo-explore-custom-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alliance-pcsg","download_url":"https://codeload.github.com/alliance-pcsg/primo-explore-custom-actions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710448,"owners_count":21149190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angularjs","primo-explore"],"created_at":"2024-11-26T11:17:45.149Z","updated_at":"2025-04-13T12:09:34.101Z","avatar_url":"https://github.com/alliance-pcsg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# primo-explore-custom-actions\n\n[![npm version](https://img.shields.io/npm/v/primo-explore-custom-actions.svg)](https://www.npmjs.com/package/primo-explore-custom-actions)\n\n## Features\nCustom links can be added to the actions menu visible on Primo brief results and full display. Links can extract properties of the item's PNX record and apply them to the link URL.\n\n### Screenshot\n![screenshot](screenshot.png)\n\n## Install\n1. Make sure you've installed and configured [primo-explore-devenv](https://github.com/ExLibrisGroup/primo-explore-devenv).\n2. Navigate to your template/central package root directory. For example:\n    ```\n    cd primo-explore/custom/MY_VIEW_ID\n    ```\n3. If you do not already have a `package.json` file in this directory, create one:\n    ```\n    npm init -y\n    ```\n4. Install this package:\n    ```\n    npm install primo-explore-custom-actions --save\n    ```\nAlternatively, just copy the contents of `dist/module.js` into your `custom.js` file.\n\n## Usage\nOnce this package is installed, add `customActions` as a dependency for your custom module definition.\n\n```js\nvar app = angular.module('viewCustom', ['customActions'])\n```\nNote: If you're using the `--browserify` build option, you will need to first import the module with:\n\n```javascript\nimport 'primo-explore-custom-actions';\n```\n\nYou can add new actions by adding `\u003ccustom-action\u003e` elements to the template of `prmActionListAfter`. Each element needs the properties below:\n\n| name | type | usage |\n|---|---|---|\n| `name` | string | a short, unique name for the action. don't include whitespace characters. |\n| `label` | string | the name that will display on the action button. whitespace ok. |\n| `index` | integer | where to insert the action. 0 would be \"first\", 1 would be \"second\", etc.|\n| `icon` | string | the icon on the button. must be chosen from \u003chttps://material.io/icons/\u003e. should be in the form \"ic_icon_name_with_underscores_24px\". some icons may not display. |\n| `icon-set` | string | the set of icons from which the above icon is drawn.|\n| `link` | string | URL to open when the action is clicked. supports templating (see below). |\n\n### Templating\n\nYou can create interpolation expressions using `{ }` in the link text and they will be replaced with corresponding values taken from the item - for example, `{pnx.control.recordid[0]}` would become the recordID of the item, taken from the pnx.\n\n### Example\n\nThe example below will generate a configuration similar to that visible in the screenshot above. It adds a \"report problem\" link that will navigate to the institution's \"report problem\" form and append the record ID as a GET parameter, and a link that will open the given record's PNX for viewing.\n\n**Update 2020-08-18:** The previous example node for record IDs, pnx.search.recordid[0], contains long random strings for CDI records instead of the ID used in permalinks. PCSG suggests using pnx.control.recordid[0] instead.\n\n```js\nvar app = angular.module('viewCustom', ['customActions'])\n\napp.component('prmActionListAfter', {\n  template: `\u003ccustom-action name=\"open_pnx\"\n                            label=\"Open PNX\"\n                            index=8\n                            icon=\"ic_find_in_page_24px\"\n                            icon-set=\"action\"\n                            link=\"/primo_library/libweb/jqp/record/{pnx.control.recordid[0]}.pnx\" /\u003e\n            \u003ccustom-action  name=\"report_bug\"\n                            label=\"Report Bug\"\n                            index=7\n                            icon=\"ic_bug_report_24px\"\n                            icon-set=\"action\"\n                            link=\"http://my.institution.edu/report_problem?record_id={pnx.control.recordid[0]}\" /\u003e`\n})\n```\n\n\u003c!-- ## Running tests\n1. Clone the repo\n2. Run `npm install`\n3. Run `npm test` --\u003e\n\n[More detailed documentation is available here](https://docs.google.com/document/d/e/2PACX-1vREAWe303KVxb73IVnAQ-Atd1ndZ0bdokiwoe_0fBiGXY7230g6NAjzWPSs0hjmLeSa6xRIoooNfQ4G/pub) on how to link to a specific Primo Record in various reporting systems such as Google Docs, Survey Monkey, and Qualitrics.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falliance-pcsg%2Fprimo-explore-custom-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falliance-pcsg%2Fprimo-explore-custom-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falliance-pcsg%2Fprimo-explore-custom-actions/lists"}