Skip to content

fix/114/change duplicate title cntx in add n edit forms#125

Open
M-lakshan wants to merge 10 commits intoLeadCMS:developfrom
M-lakshan:fix/114/change_duplicate_title_cntx_in_ADD_n_EDIT_forms
Open

fix/114/change duplicate title cntx in add n edit forms#125
M-lakshan wants to merge 10 commits intoLeadCMS:developfrom
M-lakshan:fix/114/change_duplicate_title_cntx_in_ADD_n_EDIT_forms

Conversation

@M-lakshan
Copy link
Copy Markdown
Contributor

refined areas:

  • specified title under form types
  • refined title based module name plurality (keyword ending check based on 's' or 'ies')
  • new helper method added

Copy link
Copy Markdown
Contributor Author

@M-lakshan M-lakshan left a comment

Choose a reason for hiding this comment

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

refined the helper method course:

  • first the sub_title keyword will be checked within the MODULE_CONFIG entries
  • if no MODULE_CONFIG entry found validation checks with noly with 's' & 'ies' but also with 'es'
  • correct suffix change ( replace 'ies' with char 'y')

@M-lakshan M-lakshan changed the title Fix/114/change duplicate title cntx in add n edit forms fix/114/change duplicate title cntx in add n edit forms Sep 4, 2025
@DilhanRubera
Copy link
Copy Markdown
Contributor

Could you remove the suffix change code and use the module name as it is, if the module isnt found in the config file. Since this case will be when we use dynamic modules, we can change the name from the backend.

Change default from "Remove' to "View"

Capitalise the first letter of the word too

@peterliapin peterliapin requested a review from Copilot September 11, 2025 04:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes duplicate title context in add and edit forms by refining title generation based on form types and module name plurality. The changes improve form titles to correctly display "Add" vs "Edit" actions and handle plural module names appropriately.

  • Adds a new helper function to check module name plurality based on menu configuration
  • Updates form title generation to use dynamic action words and singular module names
  • Refines arrow function formatting for consistency

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/utils/general-helper.ts Adds moduleNamePluralBasisCheck function and imports MENU_CONFIG, fixes arrow function formatting
src/components/generic-components/generic-form.tsx Updates form title generation to use dynamic actions and singular module names

Comment thread src/utils/general-helper.ts Outdated
if (mdl_sub_title[0]) {
const module_tag = mdl_sub_title[0]?.toString();

return module_tag[0].toUpperCase() + module_tag?.substring(1, module_tag.length);
Copy link

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

[nitpick] The substring operation can be simplified. Use module_tag.slice(1) instead of module_tag?.substring(1, module_tag.length) for better readability and consistency with the existing pattern in the codebase.

Suggested change
return module_tag[0].toUpperCase() + module_tag?.substring(1, module_tag.length);
return module_tag[0].toUpperCase() + module_tag.slice(1);

Copilot uses AI. Check for mistakes.
@peterliapin peterliapin linked an issue Sep 11, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Links -> Add/Edit/View: same Title for Add and Edit forms

3 participants