Skip to content

Commit

Permalink
Use consistent naming for missing value code views
Browse files Browse the repository at this point in the history
Issue #612
  • Loading branch information
robyngit committed Jul 21, 2023
1 parent 27a77f0 commit e45bd0d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ define([
"models/metadata/eml211/EMLMissingValueCode",
], function ($, Backbone, EMLMissingValueCode) {
/**
* @class EMLMissingValueView
* @classdesc An EMLMissingValueView provides an editing interface for a
* @class EMLMissingValueCodeView
* @classdesc An EMLMissingValueCodeView provides an editing interface for a
* single EML Missing Value Code. The view provides two inputs, one of the
* code and one for the code explanation. If the model is part of a
* collection, the view will also provide a button to remove the model from
* the collection.
* @classcategory Views/Metadata
* @screenshot views/metadata/EMLMissingValueView.png
* @screenshot views/metadata/EMLMissingValueCodeView.png
* @extends Backbone.View
* @since x.x.x
*/
var EMLMissingValueView = Backbone.View.extend(
/** @lends EMLMissingValueView.prototype */ {
var EMLMissingValueCodeView = Backbone.View.extend(
/** @lends EMLMissingValueCodeView.prototype */ {
tagName: "div",

/**
Expand Down Expand Up @@ -76,7 +76,7 @@ define([
isNew: false,

/**
* Creates a new EMLMissingValueView
* Creates a new EMLMissingValueCodeView
* @param {Object} options - A literal object with options to pass to the
* view
* @param {EMLAttribute} [options.model] - The EMLMissingValueCode model
Expand All @@ -90,13 +90,13 @@ define([

/**
* Renders this view
* @return {EMLMissingValueView} A reference to this view
* @return {EMLMissingValueCodeView} A reference to this view
*/
render: function () {
try {
if (!this.model) {
console.warn(
"An EMLMissingValueView model is required to render this view."
"An EMLMissingValueCodeView model is required to render this view."
);
return this;
}
Expand All @@ -116,7 +116,7 @@ define([

return this;
} catch (error) {
console.log("Error rendering EMLMissingValueView", error);
console.log("Error rendering EMLMissingValueCodeView", error);
}
},

Expand Down Expand Up @@ -278,5 +278,5 @@ define([
}
);

return EMLMissingValueView;
return EMLMissingValueCodeView;
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ define([
"backbone",
"models/metadata/eml211/EMLMissingValueCode",
"collections/metadata/eml/EMLMissingValueCodes",
"views/metadata/EML211MissingValueView",
"views/metadata/EML211MissingValueCodeView",
], function (
Backbone,
EMLMissingValueCode,
EMLMissingValueCodes,
EML211MissingValueView
EML211MissingValueCodeView
) {
/**
* @class EMLMissingValuesView
* @classdesc An EMLMissingValuesView provides an editing interface for an EML
* @class EMLMissingValueCodesView
* @classdesc An EMLMissingValueCodesView provides an editing interface for an EML
* Missing Value Codes collection. For each missing value code, the view
* provides two inputs, one of the code and one for the code explanation. Each
* missing value code can be removed from the collection by clicking the
* "Remove" button next to the code. A new row of inputs will automatically be
* added to the view when the user starts typing in the last row of inputs.
* @classcategory Views/Metadata
* @screenshot views/metadata/EMLMissingValuesView.png
* @screenshot views/metadata/EMLMissingValueCodesView.png
* @extends Backbone.View
* @since x.x.x
*/
var EMLMissingValuesView = Backbone.View.extend(
/** @lends EMLMissingValuesView.prototype */ {
var EMLMissingValueCodesView = Backbone.View.extend(
/** @lends EMLMissingValueCodesView.prototype */ {
tagName: "div",

/**
Expand Down Expand Up @@ -76,7 +76,7 @@ define([
},

/**
* Creates a new EMLMissingValuesView
* Creates a new EMLMissingValueCodesView
* @param {Object} options - A literal object with options to pass to the
* view
* @param {EMLAttribute} [options.collection] - The EMLMissingValueCodes
Expand All @@ -89,12 +89,12 @@ define([

/**
* Renders this view
* @return {EMLMissingValuesView} A reference to this view
* @return {EMLMissingValueCodesView} A reference to this view
*/
render: function () {
if (!this.collection) {
console.warn(
`The EMLMissingValuesView requires a MissingValueCodes collection` +
`The EMLMissingValueCodesView requires a MissingValueCodes collection` +
` to render.`
);
return;
Expand Down Expand Up @@ -193,7 +193,7 @@ define([
* Creates a new row view for a missing value code model and inserts it
* into this view at the end.
* @param {EMLMissingValueCode} model - The model to create a row for
* @returns {EML211MissingValueView} The row view that was created
* @returns {EML211MissingValueCodeView} The row view that was created
*/
addRow: function (model) {
if (!model instanceof EMLMissingValueCode) return;
Expand All @@ -202,7 +202,7 @@ define([
const isNew = this.modelIsNew(model);

// Create and render the row view
const rowView = new EML211MissingValueView({
const rowView = new EML211MissingValueCodeView({
model: model,
isNew: isNew,
}).render();
Expand All @@ -223,7 +223,7 @@ define([
/**
* Removes a row view from this view
* @param {EMLMissingValueCode} model - The model to remove a row for
* @returns {EML211MissingValueView} The row view that was removed
* @returns {EML211MissingValueCodeView} The row view that was removed
*/
removeRow: function (model) {
if (!model instanceof EMLMissingValueCode) return;
Expand Down Expand Up @@ -253,5 +253,5 @@ define([
}
);

return EMLMissingValuesView;
return EMLMissingValueCodesView;
});
12 changes: 6 additions & 6 deletions src/js/views/metadata/EMLAttributeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define([
"models/metadata/eml211/EMLAttribute",
"models/metadata/eml211/EMLMeasurementScale",
"views/metadata/EMLMeasurementScaleView",
"views/metadata/EML211MissingValuesView",
"views/metadata/EML211MissingValueCodesView",
"text!templates/metadata/eml-attribute.html",
], function (
_,
Expand All @@ -17,7 +17,7 @@ define([
EMLAttribute,
EMLMeasurementScale,
EMLMeasurementScaleView,
EML211MissingValuesView,
EML211MissingValueCodesView,
EMLAttributeTemplate
) {
/**
Expand Down Expand Up @@ -116,12 +116,12 @@ define([
this.measurementScaleView = measurementScaleView;

// Create and insert a missing values view
const missingValuesView = new EML211MissingValuesView({
const MissingValueCodesView = new EML211MissingValueCodesView({
collection: this.model.get("missingValueCodes"),
});
missingValuesView.render();
this.$(".missing-values-container").append(missingValuesView.el);
this.missingValuesView = missingValuesView;
MissingValueCodesView.render();
this.$(".missing-values-container").append(MissingValueCodesView.el);
this.MissingValueCodesView = MissingValueCodesView;

// Mark this view DOM as new if it is a new attribute
if (this.isNew) {
Expand Down

0 comments on commit e45bd0d

Please sign in to comment.