Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
my_compassion/**/*.js
my_compassion/**/!(my2*).js
4 changes: 2 additions & 2 deletions my_compassion/static/src/js/child_profile_tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ document.addEventListener("DOMContentLoaded", function () {
return this._super.apply(this, arguments);
},

//--------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
// --------------------------------------------------------------------------

/**
* When the mobile dropdown value changes, find the corresponding desktop
Expand Down
10 changes: 4 additions & 6 deletions my_compassion/static/src/js/my2_add_a_gift.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ document.addEventListener("DOMContentLoaded", function (event) {
route: "/my2/gifts/new",
params: data,
})
.then(
function (data) {
// Redirect user to gift package page
window.location.href = "/my2/gift-package";
}.bind(this)
)
.then(function (data) {
// Redirect user to gift package page
window.location.href = "/my2/gift-package";
})
.guardedCatch(
function () {
// Re-enable buttons
Expand Down
10 changes: 4 additions & 6 deletions my_compassion/static/src/js/my2_donation_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ document.addEventListener("DOMContentLoaded", function (event) {
route: "/my2/gifts/new",
params: data,
})
.then(
function (data) {
// Redirect user to gift package page
window.location.href = "/my2/gift-package";
}.bind(this)
)
.then(function (data) {
// Redirect user to gift package page
window.location.href = "/my2/gift-package";
})
.guardedCatch(
function () {
// Re-enable buttons
Expand Down
5 changes: 2 additions & 3 deletions my_compassion/static/src/js/my2_donation_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ odoo.define("my_compassion.donation_form", function (require) {
) {
this.$(".limit-error-message").removeAttr("hidden");
return;
} else {
this.$(".limit-error-message").attr("hidden", true);
}
this.$(".limit-error-message").attr("hidden", true);

// Trigger submission event
this.$el.trigger(this.$(".btn-submit").data("submission-event"), [
Expand Down Expand Up @@ -172,7 +171,7 @@ odoo.define("my_compassion.donation_form", function (require) {

/**
* Validates the payment form.
* @returns {boolean} - True if valid, false otherwise.
* @returns {Boolean} - True if valid, false otherwise.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to JSDoc standards, primitive types should be in lowercase. {Boolean} refers to the wrapper object, while {boolean} refers to the primitive type. The original {boolean} was correct.

Suggested change
* @returns {Boolean} - True if valid, false otherwise.
* @returns {boolean} - True if valid, false otherwise.

*/
_validateForm: function () {
var isValid = true;
Expand Down
20 changes: 8 additions & 12 deletions my_compassion/static/src/js/my2_gift_package.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ document.addEventListener("DOMContentLoaded", function (event) {
}
}.bind(this)
)
.guardedCatch(
function () {
// Replace spinner with error
$("#edit-donation-form").html("Error");
}.bind(this)
);
.guardedCatch(function () {
// Replace spinner with error
$("#edit-donation-form").html("Error");
});
},

/**
Expand Down Expand Up @@ -128,12 +126,10 @@ document.addEventListener("DOMContentLoaded", function (event) {
route: "/my2/gifts/edit",
params: data,
})
.then(
function (data) {
// Redirect user to gift package page
window.location.href = "/my2/gift-package";
}.bind(this)
)
.then(function (data) {
// Redirect user to gift package page
window.location.href = "/my2/gift-package";
})
.guardedCatch(
function () {
// Re-enable buttons
Expand Down
12 changes: 6 additions & 6 deletions my_compassion/static/src/js/my2_new_letter.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ document.addEventListener("DOMContentLoaded", function () {
* @async
* @function
* @returns {Promise<Object>} A promise that resolves to an object containing:
* @property {string} childId - The ID of the selected child.
* @property {string|null} templateId - The ID of the selected template, or null if not selected.
* @property {string} letterBody - The body text of the letter.
* @property {Array<{filename: string, content: string}>} attachments - The list of base64-encoded attachments.
* @property {String} childId - The ID of the selected child.
* @property {String|null} templateId - The ID of the selected template, or null if not selected.
* @property {String} letterBody - The body text of the letter.
* @property {Array<{filename: String, content: String}>} attachments - The list of base64-encoded attachments.
Comment on lines +122 to +125

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Per JSDoc best practices, primitive types should be lowercase (e.g., string). Using String refers to the object wrapper, which is not the intended type here. Please revert these changes to use string.

Suggested change
* @property {String} childId - The ID of the selected child.
* @property {String|null} templateId - The ID of the selected template, or null if not selected.
* @property {String} letterBody - The body text of the letter.
* @property {Array<{filename: String, content: String}>} attachments - The list of base64-encoded attachments.
* @property {string} childId - The ID of the selected child.
* @property {string|null} templateId - The ID of the selected template, or null if not selected.
* @property {string} letterBody - The body text of the letter.
* @property {Array<{filename: string, content: string}>} attachments - The list of base64-encoded attachments.

*/
_collectFormData: async function () {
const childId = this.$("#child-dropdown").val();
Expand Down Expand Up @@ -203,9 +203,9 @@ document.addEventListener("DOMContentLoaded", function () {
*
* @async
* @function
* @param {string} mode - Submission mode: `'send'` to submit the letter, `'preview'` to show a preview.
* @param {String} mode - Submission mode: `'send'` to submit the letter, `'preview'` to show a preview.
* @param {Object} result - The result object returned by the server.
* @param {string} childId - The ID of the selected child, used in the redirect URL.
* @param {String} childId - The ID of the selected child, used in the redirect URL.
Comment on lines +206 to +208

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.

Suggested change
* @param {String} mode - Submission mode: `'send'` to submit the letter, `'preview'` to show a preview.
* @param {Object} result - The result object returned by the server.
* @param {string} childId - The ID of the selected child, used in the redirect URL.
* @param {String} childId - The ID of the selected child, used in the redirect URL.
* @param {string} mode - Submission mode: `'send'` to submit the letter, `'preview'` to show a preview.
* @param {Object} result - The result object returned by the server.
* @param {string} childId - The ID of the selected child, used in the redirect URL.

*
* @returns {Promise<void>} Resolves when the UI navigation or update is complete.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ document.addEventListener("DOMContentLoaded", () => {
* Generates a unique key for a file based on its metadata.
*
* @param {File} file - The file to generate a key for.
* @returns {string} A unique key combining the file's name, size, type, and last modified date.
* @returns {String} A unique key combining the file's name, size, type, and last modified date.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In JSDoc, it is standard to use lowercase for primitive types. Please change {String} back to {string}.

Suggested change
* @returns {String} A unique key combining the file's name, size, type, and last modified date.
* @returns {string} A unique key combining the file's name, size, type, and last modified date.

*/
const generateFileKey = (file) => `${file.name}-${file.size}-${file.type}-${file.lastModified}`;

Expand All @@ -38,7 +38,7 @@ document.addEventListener("DOMContentLoaded", () => {
* Reads a file as a Data URL (base64 encoded string).
*
* @param {File} file - The file to read.
* @returns {Promise<string>} A promise that resolves with the file's Data URL.
* @returns {Promise<String>} A promise that resolves with the file's Data URL.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To follow JSDoc conventions, primitive types within generic types like Promise should also be lowercase. Please use {Promise<string>} instead of {Promise<String>}.

Suggested change
* @returns {Promise<String>} A promise that resolves with the file's Data URL.
* @returns {Promise<string>} A promise that resolves with the file's Data URL.

*/
const readFileAsDataURL = (file) =>
new Promise((resolve, reject) => {
Expand Down Expand Up @@ -111,7 +111,7 @@ document.addEventListener("DOMContentLoaded", () => {
* Includes a preview image, file name, and a remove button.
*
* @param {File} file - The file to create an element for.
* @param {string} dataUrl - The Data URL of the file for the preview.
* @param {String} dataUrl - The Data URL of the file for the preview.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In JSDoc, it is standard to use lowercase for primitive types. Please change {String} back to {string}.

Suggested change
* @param {String} dataUrl - The Data URL of the file for the preview.
* @param {string} dataUrl - The Data URL of the file for the preview.

* @returns {HTMLElement} The created file container element.
*/
const createFileElement = (file, dataUrl) => {
Expand Down
2 changes: 1 addition & 1 deletion my_compassion/static/src/js/my2_new_sponsorship_wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ document.addEventListener("DOMContentLoaded", function (event) {

/**
* Validates required fields in the current step.
* @returns {boolean} - True if valid, false otherwise.
* @returns {Boolean} - True if valid, false otherwise.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to JSDoc standards, primitive types should be in lowercase. {Boolean} refers to the wrapper object, while {boolean} refers to the primitive type. The original {boolean} was correct.

Suggested change
* @returns {Boolean} - True if valid, false otherwise.
* @returns {boolean} - True if valid, false otherwise.

*/
_validateForm: function () {
var isValid = true;
Expand Down
16 changes: 8 additions & 8 deletions my_compassion/static/src/js/toast_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ odoo.define("my_compassion.toast_service", function (require) {
const ToastService = {
/**
* Show an informational toast message
* @param {string} msg - The message body
* @param {string} title - Optional title (defaults to 'Info')
* @param {String} msg - The message body
* @param {String} title - Optional title (defaults to 'Info')
Comment on lines +17 to +18

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.

Suggested change
* @param {String} msg - The message body
* @param {String} title - Optional title (defaults to 'Info')
* @param {string} msg - The message body
* @param {string} title - Optional title (defaults to 'Info')

*/
info(msg, title = "Info") {
new Toast(null, {
Expand All @@ -27,8 +27,8 @@ odoo.define("my_compassion.toast_service", function (require) {

/**
* Show a success toast message
* @param {string} msg - The message body
* @param {string} title - Optional title (defaults to 'Success')
* @param {String} msg - The message body
* @param {String} title - Optional title (defaults to 'Success')
Comment on lines +30 to +31

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.

Suggested change
* @param {String} msg - The message body
* @param {String} title - Optional title (defaults to 'Success')
* @param {string} msg - The message body
* @param {string} title - Optional title (defaults to 'Success')

*/
success(msg, title = "Success") {
new Toast(null, {
Expand All @@ -40,8 +40,8 @@ odoo.define("my_compassion.toast_service", function (require) {

/**
* Show a warning toast message
* @param {string} msg - The message body
* @param {string} title - Optional title (defaults to 'Warning')
* @param {String} msg - The message body
* @param {String} title - Optional title (defaults to 'Warning')
Comment on lines +43 to +44

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.

Suggested change
* @param {String} msg - The message body
* @param {String} title - Optional title (defaults to 'Warning')
* @param {string} msg - The message body
* @param {string} title - Optional title (defaults to 'Warning')

*/
warning(msg, title = "Warning") {
new Toast(null, {
Expand All @@ -53,8 +53,8 @@ odoo.define("my_compassion.toast_service", function (require) {

/**
* Show an error toast message
* @param {string} msg - The message body
* @param {string} title - Optional title (defaults to 'Error')
* @param {String} msg - The message body
* @param {String} title - Optional title (defaults to 'Error')
Comment on lines +56 to +57

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.

Suggested change
* @param {String} msg - The message body
* @param {String} title - Optional title (defaults to 'Error')
* @param {string} msg - The message body
* @param {string} title - Optional title (defaults to 'Error')

*/
error(msg, title = "Error") {
new Toast(null, {
Expand Down
Loading