Skip to content

Commit

Permalink
confirm modal copy
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfyWin committed Sep 9, 2024
1 parent 67fcc7c commit a0e5b4f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
12 changes: 8 additions & 4 deletions src/plugin/cursus/Resources/modules/event/components/list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import get from 'lodash/get'
import omit from 'lodash/omit'

import {url} from '#/main/app/api'
import {trans} from '#/main/app/intl/translation'
import {hasPermission} from '#/main/app/security'
import {trans, transChoice} from '#/main/app/intl/translation'
import {ListData} from '#/main/app/content/list/containers/data'
import {actions as listActions} from '#/main/app/content/list/store'
import {ASYNC_BUTTON, LINK_BUTTON, MODAL_BUTTON, URL_BUTTON} from '#/main/app/buttons'
Expand Down Expand Up @@ -53,18 +53,22 @@ const Events = (props) =>
icon: 'fa fa-fw fa-clone',
label: trans('copy', {}, 'actions'),
displayed: hasPermission('edit', rows[0]),
confirm: true,
confirm: {
title: transChoice('copy_event_confirm_title', rows.length, {}, 'actions'),
subtitle: 1 === rows.length ? rows[0].name : transChoice('count_elements', rows.length, {count: rows.length}),
message: transChoice('copy_event_confirm_message', rows.length, {count: rows.length}, 'actions')
},
request: {
url: url(['apiv2_cursus_event_copy']),
request: {
method: 'POST',
body: JSON.stringify({
ids: rows[0].id
ids: rows.map(row => row.id)
})
}
},
group: trans('management'),
scope: ['object']
scope: ['object', 'collection']
}, {
name: 'export-pdf',
type: URL_BUTTON,
Expand Down
14 changes: 9 additions & 5 deletions src/plugin/cursus/Resources/modules/session/components/list.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react'
import {PropTypes as T} from 'prop-types'
import {PropTypes as T} from 'prop-types'
import get from 'lodash/get'

import {url} from '#/main/app/api'
import {trans} from '#/main/app/intl'
import {param} from '#/main/app/config'
import {route} from '#/plugin/cursus/routing'
import {hasPermission} from '#/main/app/security'
import {trans, transChoice} from '#/main/app/intl/translation'
import {ListData} from '#/main/app/content/list/containers/data'
import {constants as listConst} from '#/main/app/content/list/constants'
import {ASYNC_BUTTON, LINK_BUTTON, URL_BUTTON} from '#/main/app/buttons'
Expand Down Expand Up @@ -133,18 +133,22 @@ const SessionList = (props) =>
icon: 'fa fa-fw fa-clone',
label: trans('copy', {}, 'actions'),
displayed: hasPermission('edit', rows[0]),
confirm: true,
confirm: {
title: transChoice('copy_session_confirm_title', rows.length, {}, 'actions'),
subtitle: 1 === rows.length ? rows[0].name : transChoice('count_elements', rows.length, {count: rows.length}),
message: transChoice('copy_session_confirm_message', rows.length, {count: rows.length}, 'actions')
},
request: {
url: url(['apiv2_cursus_session_copy']),
request: {
method: 'POST',
body: JSON.stringify({
ids: rows[0].id
ids: rows.map(row => row.id)
})
}
},
group: trans('management'),
scope: ['object']
scope: ['object', 'collection']
}
]

Expand Down

0 comments on commit a0e5b4f

Please sign in to comment.