Skip to content

Commit

Permalink
pr review
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfyWin committed May 13, 2024
1 parent 37790e0 commit 7b39454
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/plugin/cursus/Resources/modules/actions/course/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {hasPermission} from '#/main/app/security'

import {route} from '#/plugin/cursus/routing'

export default (courses, refresher, path) => ({
export default (courses) => ({
name: 'edit',
type: LINK_BUTTON,
icon: 'fa fa-fw fa-pencil',
label: trans('edit', {}, 'actions'),
target: route(courses[0], null, path) + '/edit',
target: route(courses[0], null) + '/edit',
displayed: hasPermission('edit', courses[0]),
primary: true,
group: trans('management'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const CourseCreationComponent = (props) =>
path={[{
type: LINK_BUTTON,
label: trans('catalog', {}, 'cursus'),
target: props.path + '/catalog'
target: props.path,
displayed: 'desktop' === props.contextType
}, {
type: LINK_BUTTON,
label: trans('new_course', {}, 'cursus'),
Expand All @@ -30,25 +31,27 @@ const CourseCreationComponent = (props) =>
type: LINK_BUTTON,
icon: 'fa fa-fw fa-plus',
label: trans('add_course', {}, 'cursus'),
target: `${props.path}/catalog/new`,
target: props.path,
group: trans('management'),
primary: true
}]}
>
<CourseForm
path={props.path + '/catalog'}
path={props.path}
name={selectors.FORM_NAME}
/>
</ToolPage>

CourseCreationComponent.propTypes = {
path: T.string.isRequired
path: T.string.isRequired,
contextType: T.string.isRequired
}

const CourseCreation = connect(
(state) => ({
path: toolSelectors.path(state),
course: formSelectors.data(formSelectors.form(state, selectors.FORM_NAME))
course: formSelectors.data(formSelectors.form(state, selectors.FORM_NAME)),
contextType: toolSelectors.contextType(state)
})
)(CourseCreationComponent)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const CourseEditComponent = (props) =>
course={props.course}
>
<CourseForm
path={props.path + '/catalog'}
path={props.path}
name={selectors.FORM_NAME}
/>
</CoursePage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Course = (props) => {
{
type: LINK_BUTTON,
label: trans('catalog', {}, 'cursus'),
target: props.path + '/catalog',
target: props.path,
displayed: 'desktop' === props.contextType
}, {
type: LINK_BUTTON,
Expand All @@ -50,7 +50,7 @@ const Course = (props) => {
}
].concat(props.course ? props.breadcrumb : [])}
primaryAction="edit"
actions={getActions([props.course], {}, '', props.currentUser)}
actions={getActions([props.course], {}, props.path, props.currentUser)}
>
{props.children}
</ToolPage>
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/cursus/Resources/modules/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {route as toolRoute} from '#/main/core/tool/routing'
function route(course, session = null, basePath = null) {
let coursePath
if (basePath) {
coursePath = `${basePath}/catalog/${course.slug}`
coursePath = `${basePath}/${course.slug}`
} else {
coursePath = `${toolRoute('trainings') }/catalog/${course.slug}`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const CatalogList = (props) =>
]}
>
<CourseList
path={props.path}
path={props.path+'/catalog'}
name={selectors.LIST_NAME}
url={['apiv2_cursus_course_list']}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {makeListReducer} from '#/main/app/content/list/store'
import {makeReducer, combineReducers} from '#/main/app/store/reducer'
import {makeFormReducer, FORM_SUBMIT_SUCCESS} from '#/main/app/content/form/store'
import {FORM_SUBMIT_SUCCESS} from '#/main/app/content/form/store'

import {LOAD_COURSE} from '#/plugin/cursus/course/store/actions'
import {selectors} from '#/plugin/cursus/tools/trainings/catalog/store/selectors'
Expand All @@ -16,8 +16,7 @@ const reducer = combineReducers({
}),
course: makeReducer(null, {
[LOAD_COURSE]: (state, action) => action.course
}),
courseForm: makeFormReducer(courseSelectors.FORM_NAME)
})
})

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {createSelector} from 'reselect'

const STORE_NAME = 'trainingCatalog'
const LIST_NAME = STORE_NAME + '.courses'
const FORM_NAME = STORE_NAME + '.courseForm'

const catalog = (state) => state[STORE_NAME] || {}

Expand All @@ -14,7 +13,6 @@ const course = createSelector(
export const selectors = {
STORE_NAME,
LIST_NAME,
FORM_NAME,

course
}

0 comments on commit 7b39454

Please sign in to comment.