Skip to content

Add utility class for creating and attaching modals in the DOM #105

@fabiodrg

Description

@fabiodrg

Modals were only used for calendar events, but now are used for 'batch email' (#101) and also for grades simulation (#64). The idea is to create an util class that creates the modal skeletons and attaches them in DOM. The skeleton only manages how to open the modal, where to insert it in the DOM and how to close the modal. The skeleton could provide an interface to specify a title, the body and an eventual footer. Using this skeleton modal ensures consistency and avoids duplicated code.

class Modal {
  static id; // to assign unique identifiers and allow multiple modals in the same page context ?
  // title is a string. body and footer are HTMLElements. isPermanent indicates whether the modal should be removed after opening/closing once (all existing modals are like this, although I think it was just because it was easier to avoid clashes between multiple modals)
  constructor(title, body, footer, isPermanent) {}
  // this triggers the modal to open and can be used externally to attach to event listeners and yada yada
  open() {}
}
  • Ability to specify the title, body content and footer content
  • Possibility for modals being permanent in the DOM and support co-existing modals

Metadata

Metadata

Assignees

No one assigned

    Labels

    code qualityIssues related to improve code quality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions