Skip to content

Commit

Permalink
Added workaround for required field rendering bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhaufe committed Dec 4, 2023
1 parent c71ea20 commit 13ba5b8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/domain/Requirement.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export abstract class Requirement extends Entity {
* @param args - The arguments to the property.
* @returns True if the property is satisfied, false otherwise.
*/
abstract property(...args: any[]): boolean;
property(..._args: any[]): boolean {
return false;
}

override toJSON(): RequirementJson {
return {
Expand Down
5 changes: 3 additions & 2 deletions src/presentation/components/DataTable.mts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class DataTable<T extends Entity> extends Component {
id: 'frmDataTableDelete'
}),
table([
caption({ className: 'required' }, ' Required'),
caption({ className: 'required' }, ['Required', span('*')]),
thead({ className: 'data-header' }, [
tr()
]),
Expand Down Expand Up @@ -247,7 +247,8 @@ export class DataTable<T extends Entity> extends Component {
className: col.required ? 'required' : '',
hidden: col.formType == 'hidden'
}, [
col.headerText
col.headerText,
col.required ? span('*') : ''
]))
);

Expand Down
2 changes: 1 addition & 1 deletion src/presentation/pages/environments/NewEnvironment.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class NewEnvironment extends Page {
className: 'environment-form',
autocomplete: 'off'
}, [
label({ htmlFor: 'name', className: 'required' }, 'Name'),
label({ htmlFor: 'name', className: 'required' }, ['Name', span('*')]),
this.#txtName = input({
type: 'text', name: 'name', id: 'name', required: true,
placeholder: 'Sample Environment', maxLength: Environment.maxNameLength
Expand Down
2 changes: 1 addition & 1 deletion src/presentation/pages/goals/NewGoals.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class NewGoals extends Page {
className: 'goals-form',
autocomplete: 'off'
}, [
label({ htmlFor: 'name', className: 'required' }, 'Name'),
label({ htmlFor: 'name', className: 'required' }, ['Name', span('*')]),
input({
type: 'text', name: 'name', id: 'name', required: true,
placeholder: 'My Goals', maxLength: Goals.maxNameLength
Expand Down
5 changes: 2 additions & 3 deletions src/presentation/themes.mts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ export const formTheme: Theme = {
backgroundColor: 'transparent',
color: 'var(--font-color)',
},
'.required::after': {
content: ' *',
'.required > span': {
color: 'var(--btn-danger-color)',
display: 'inline-block'
paddingLeft: '0.25em'
}
};

0 comments on commit 13ba5b8

Please sign in to comment.