Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interview more #1126

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rdmo/core/assets/js/actions/actionTypes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export const UPDATE_CONFIG = 'UPDATE_CONFIG'
export const DELETE_CONFIG = 'DELETE_CONFIG'

export const ADD_TO_PENDING = 'ADD_TO_PENDING'
export const REMOVE_FROM_PENDING = 'REMOVE_FROM_PENDING'

export const FETCH_SETTINGS_ERROR = 'FETCH_SETTINGS_ERROR'
export const FETCH_SETTINGS_INIT = 'FETCH_SETTINGS_INIT'
export const FETCH_SETTINGS_SUCCESS = 'FETCH_SETTINGS_SUCCESS'
Expand Down
12 changes: 4 additions & 8 deletions rdmo/core/assets/js/actions/configActions.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { setConfigInLocalStorage, deleteConfigInLocalStorage } from '../utils/config'

import { UPDATE_CONFIG, DELETE_CONFIG } from './actionTypes'

export function updateConfig(prefix, path, value) {
setConfigInLocalStorage(prefix, path, value)
return {type: UPDATE_CONFIG, path, value}
export function updateConfig(path, value, ls = false) {
return {type: UPDATE_CONFIG, path, value, ls}
}

export function deleteConfig(prefix, path) {
deleteConfigInLocalStorage(prefix, path)
return {type: DELETE_CONFIG, path}
export function deleteConfig(path, ls = false) {
return {type: DELETE_CONFIG, path, ls}
}
9 changes: 9 additions & 0 deletions rdmo/core/assets/js/actions/pendingActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ADD_TO_PENDING, REMOVE_FROM_PENDING } from './actionTypes'

export function addToPending(item) {
return {type: ADD_TO_PENDING, item}
}

export function removeFromPending(item) {
return {type: REMOVE_FROM_PENDING, item}
}
20 changes: 20 additions & 0 deletions rdmo/core/assets/js/components/Html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import PropTypes from 'prop-types'
import { isEmpty } from 'lodash'

const Html = ({ html }) => {
return !isEmpty(html) && (
<div dangerouslySetInnerHTML={{ __html: html }} />
)
}

Html.defaultProps = {
className: ''
}

Html.propTypes = {
className: PropTypes.string,
html: PropTypes.string
}

export default Html
15 changes: 0 additions & 15 deletions rdmo/core/assets/js/components/Template.js

This file was deleted.

17 changes: 9 additions & 8 deletions rdmo/core/assets/js/containers/Pending.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { isEmpty } from 'lodash'

const Pending = ({ config }) => {
if (config.pending) {
return <i className="fa fa-circle-o-notch fa-spin fa-fw"></i>
} else {
return null
}
const Pending = ({ pending }) => {
return (
!isEmpty(pending.items) && (
<i className="fa fa-circle-o-notch fa-spin fa-fw"></i>
)
)
}

Pending.propTypes = {
config: PropTypes.object.isRequired,
pending: PropTypes.object.isRequired,
}

function mapStateToProps(state) {
return {
config: state.config,
pending: state.pending,
}
}

Expand Down
8 changes: 7 additions & 1 deletion rdmo/core/assets/js/reducers/configReducer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateConfig, deleteConfig } from '../utils/config'
import { updateConfig, deleteConfig, setConfigInLocalStorage, deleteConfigInLocalStorage } from '../utils/config'

import { DELETE_CONFIG, UPDATE_CONFIG } from '../actions/actionTypes'

Expand All @@ -7,8 +7,14 @@ const initialState = {}
export default function configReducer(state = initialState, action) {
switch(action.type) {
case UPDATE_CONFIG:
if (action.ls) {
setConfigInLocalStorage(state.prefix, action.path, action.value)
}
return updateConfig(state, action.path, action.value)
case DELETE_CONFIG:
if (action.ls) {
deleteConfigInLocalStorage(state.prefix, action.path)
}
return deleteConfig(state, action.path)
default:
return state
Expand Down
16 changes: 16 additions & 0 deletions rdmo/core/assets/js/reducers/pendingReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ADD_TO_PENDING, REMOVE_FROM_PENDING } from '../actions/actionTypes'

const initialState = {
items: []
}

export default function pendingReducer(state = initialState, action) {
switch(action.type) {
case ADD_TO_PENDING:
return { ...state, items: [...state.items, action.item] }
case REMOVE_FROM_PENDING:
return { ...state, items: state.items.filter((item) => (item != action.item)) }
default:
return state
}
}
3 changes: 3 additions & 0 deletions rdmo/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@
'projects/project_interview_multiple_values_warning.html',
'projects/project_interview_navigation_help.html',
'projects/project_interview_overview_help.html',
'projects/project_interview_page_help.html',
'projects/project_interview_page_tabs_help.html',
'projects/project_interview_progress_help.html',
'projects/project_interview_question_help.html',
'projects/project_interview_questionset_help.html',
]

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Expand Down
1 change: 1 addition & 0 deletions rdmo/projects/assets/js/interview/actions/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const RESOLVE_CONDITION_SUCCESS = 'RESOLVE_CONDITION_SUCCESS'
export const RESOLVE_CONDITION_ERROR = 'RESOLVE_CONDITION_ERROR'

export const CREATE_VALUE = 'CREATE_VALUE'
export const UPDATE_VALUE = 'UPDATE_VALUE'

export const STORE_VALUE_INIT = 'STORE_VALUE_INIT'
export const STORE_VALUE_SUCCESS = 'STORE_VALUE_SUCCESS'
Expand Down
Loading
Loading