Modals > HAML > Replace `data-confirm` modals with `GlModal`
We need to replace all `data-confirm` modals in HAML files with `GlModal` implementation.
One instance was found by:
```shell:
find app ee/app -type f -name "*.haml" | xargs grep -n "data-confirm"
```
and the rest were found by:
```shell:
find app ee/app -type f -name "*.haml" | xargs grep -n -E "data:\s*\{.*confirm:"
```
### Migration strategy
:footprints: :footprints: :footprints: :footprints: :footprints: :footprints: :footprints: :footprints: :footprints: :footprints:
:shamrock: If you're lucky enough, you should not write any code here. Rather check that the given confirmation modal instance works as expected.
:handshake: But you can help us add functionality that is not supported if you know of such cases.
:nerd: All elements that have `data-confirm` attribute are handled but `Rails.confirm` which in its original implementation uses `window.confrm` and displays `data-confirm` attribute value as a confirmation modal message. We overwrite `Rails.confirm` implementation so that it displays `GlModal` instead. If you're interested in the implementation details - check [this MR](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73167). This solution was generously provided to us by `@leipert`
:footprints: The code that replaces `Rails.confirm` implementation is currently behind the ~"feature flag" so first you'll have to enable it on your local environment running in Rails console:
```shell:
Feature.enable(:bootstrap_confirmation_modals)
```
:footprints: Locate the page where the modal is displayed, make sure that the confirmation modal is displayed, and that it triggers the correct action on `Ok` button click. If not - **fix it**.
:footprints: By default, the `OK` button variant in the confirmation modal is `confirm`. But you can change it by providing `data-confirm-btn-variant` attribute on the element that triggers the button, e.g.
```html:
<button data-confirm="Are you sure?" data-confirm-btn-variant="danger">Delete</button>
```
Also, if the triggering element (the one that has `data-confirm="confirmationMessage"`) has a child element that has CSS class `gl-sr-only` or `sr-only` or the attribute `aria-label`, its text content or value will be adopted as a confirmation button text. E.g.
```html:
<button data-confirm="Are you sure?" aria-label="Delete branch" type="button" class="btn btn-danger btn-md gl-button btn-icon"></button>
```
will display a modal with confirm button text set to `Delete branch`
:footprints: Take the screenshot and paste it into the issue description
:footprints: Do not worry about the `rspecs`. Currently, each file that tests `window.confirm` has `stub_feature_flags(bootstrap_confirmation_modals: false)` as the FFs are enabled by default on the testing environment and will fail until fixed. All specs will be fixed at once in scope of [this MR](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75033) replacing Capybara's `accept_confirm` with our new helper [`accept_gl_confirm`](https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#interacting-with-modals).
:footprints: In case current confirmation modal implementation lacks any functionality - let us (`@ohoral`, `@leipert` `@markrian` `@mikegreiling`) know or feel free to improve it yourself and still let us know and/or assign for MR review :wink:
:footprints: If all works fine - close the issue.
Thank you! :handshake:
<details>
<summary>Example instances of confirms</summary>
### The list of some instances (but not ALL) with the links to related pages
##### http://localhost:3000/admin/users → `Block`

##### http://localhost:3000/admin/users (after entering 20 times wrong password) → `Unlock`

##### http://localhost:3000/admin/appearance → `Remove header logo`

##### http://localhost:3000/admin/appearance → `Remove logo`

##### http://localhost:3000/admin/application_settings → `Clear all repository checks`

##### http://localhost:3000/admin/deploy_keys → `Remove`

##### http://localhost:3000/admin/health_check → `Reset health check access token`

##### http://localhost:3000/admin/hooks → `Remove`

##### http://localhost:3000/admin/hooks/1/edit → `Remove`

##### http://localhost:3000/admin/users/john/identities (for LDAP user) → `Delete`

##### http://localhost:3000/admin/users/john/impersonation_tokens → `Revoke`

##### http://localhost:3000/admin/users/john/keys → 

##### http://localhost:3000/admin/users/john/projects →  (on group)

#### http://localhost:3000/admin/users/john/projects →  (on project)

#### http://localhost:3000/admin/users/john (for blocked user) → `Unblock user`

#### http://localhost:3000/admin/users/john (after entering 20 times wrong password) → `Unlock user`

#### http://localhost:3000/admin/users/john →  (on secondary email)

#### http://localhost:3000/admin/users/john → `Disable` (Two-factor Authentication)

#### http://localhost:3000/admin/users/john → `Confirm user` (for unconfirmed e-mail address)

#### http://localhost:3000/admin/labels → `Delete`

#### http://localhost:3000/admin/runners → 

#### http://localhost:3000/admin/runners → 

#### http://localhost:3000/admin/runners → `Reset runners registration token`

#### http://localhost:3000/admin/abuse_reports → `Remove user & report`

#### http://localhost:3000/admin/abuse_reports → `Block user`

#### http://localhost:3000/gitlab-org/gitlab-ce/settings/ci_cd →  (Secret variables)

#### http://localhost:3000/profile/account → `Disable` (Two-Factor Authentication)

#### http://localhost:3000/profile/emails → 

#### http://localhost:3000/profile/keys/1 → `Remove`

</summary>
epic