-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix 2395 citations display #2510
Conversation
@@ -1,36 +1,37 @@ | |||
"use strict"; | |||
|
|||
define(["jquery", "underscore", "backbone", "models/CitationModel"], function ( | |||
define(["jquery", "underscore", "backbone", "models/CitationModel"], ( | |||
$, | |||
_, | |||
Backbone, | |||
CitationModel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <no-unused-vars> reported by reviewdog 🐶
'CitationModel' is defined but never used. Allowed unused args must match /^_/u.
/** @lends Citations.prototype */ { | ||
// eslint-disable-next-line object-shorthand | ||
model: function (attrs, options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected unnamed method 'model'.
model: function (attrs, options) { | ||
// We use the inline require here in addition to the define above to | ||
// avoid an issue caused by the circular dependency between | ||
// CitationModel and Citations | ||
var CitationModel = require("models/CitationModel"); | ||
const CitationModel = require("models/CitationModel"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,11 +1,11 @@ | |||
"use strict"; | |||
|
|||
define(["jquery", "underscore", "backbone", "collections/Citations"], function ( | |||
define(["jquery", "underscore", "backbone", "collections/Citations"], ( | |||
$, | |||
_, | |||
Backbone, | |||
Citations, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <no-unused-vars> reported by reviewdog 🐶
'Citations' is defined but never used. Allowed unused args must match /^_/u.
* @param {Object} options - Options to pass to the parse() method. | ||
* @returns {Object} The parsed response | ||
* @param {object} response - The response from the metrics-service API | ||
* @param {object} options - Options to pass to the parse() method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@param "options" does not match an existing function parameter.
@@ -972,10 +976,11 @@ define(["jquery", "underscore", "backbone", "collections/Citations"], function ( | |||
/** | |||
* Check if a string is a valid DOI. | |||
* @param {string} doi - The string to check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected @param names to be "str". Got "doi, str".
@@ -972,10 +976,11 @@ define(["jquery", "underscore", "backbone", "collections/Citations"], function ( | |||
/** | |||
* Check if a string is a valid DOI. | |||
* @param {string} doi - The string to check. | |||
* @param str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing JSDoc @param "str" description.
@@ -972,10 +976,11 @@ define(["jquery", "underscore", "backbone", "collections/Citations"], function ( | |||
/** | |||
* Check if a string is a valid DOI. | |||
* @param {string} doi - The string to check. | |||
* @param str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing JSDoc @param "str" type.
@@ -1058,7 +1063,7 @@ define(["jquery", "underscore", "backbone", "collections/Citations"], function ( | |||
* @returns {string} Returns the URL for the citation or an empty string. | |||
* @since 2.23.0 | |||
*/ | |||
getURL: function () { | |||
getURL() { | |||
const urlSources = ["view_url", "source_url", "sid_url", "pid_url"]; | |||
for (let i = 0; i < urlSources.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <no-plusplus> reported by reviewdog 🐶
Unary operator '++' used.
@@ -1075,7 +1080,7 @@ define(["jquery", "underscore", "backbone", "collections/Citations"], function ( | |||
* empty string. | |||
* @since 2.23.0 | |||
*/ | |||
getID: function () { | |||
getID() { | |||
const idSources = ["pid", "seriesId", "source_url"]; | |||
for (let i = 0; i < idSources.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <no-plusplus> reported by reviewdog 🐶
Unary operator '++' used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing JSDoc @returns declaration.
metacatui/src/js/models/CitationModel.js
Lines 207 to 220 in 82cb423
/** | |
* Override the default Backbone.Model.set() method to format the title, | |
* page, and volume attributes before setting them, and ensure that | |
* attributes that are different formats of the same value are in sync, | |
* including: origin and originArray; pid and pid_url; seriesId and | |
* seriesId_url. This method will prevent the sourceModel attribute from | |
* being set here. | |
* @param {string | object} key - The attribute name to set, or an object of | |
* attribute names and values to set. | |
* @param {string | number | object} val - The value to set the attribute to. | |
* @param {object} options - Options to pass to the set() method. | |
* @see https://backbonejs.org/#Model-set | |
* @since 2.23.0 | |
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <prefer-regex-literals> reported by reviewdog 🐶
Use a regular expression literal instead of the 'RegExp' constructor.
metacatui/src/js/models/CitationModel.js
Lines 784 to 786 in 82cb423
const regex = new RegExp( | |
"^https?:\\/\\/orcid.org\\/(\\d{4}-){3}(\\d{3}[0-9X])$", | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🪄 you fixed what I broke! Sorry about that unnecessary circular dependency and thanks for figuring this out!!!
Fixes issues with Citation display on dataset and repository landing pages.
#2395