Commit f90344cb authored by PDuarte's avatar PDuarte

asset textual UI ok

parent 98f489d0
......@@ -90,19 +90,12 @@ const handleError = (text) => {
}
},
handleAddBlock = () => {
if (!dataElement) return
const newData = dataElement
newData.menu_page_layouts.push({
id: '<generated>',
layout_id: null,
order: 1,
page_id: dataElement.id
})
setElementData(newData)
setActiveTab(newData.menu_page_layouts.length - 1)
console.log(newData)
handleTextualChange = value => {
const newData = {
...dataElement,
textual: value
}
setElementData(newData)
}
......@@ -268,7 +261,10 @@ return (
>
<TabPane tabId={0}>
<TextualBlock dataElement={dataElement && dataElement.textual}/>
<TextualBlock
dataElement={dataElement && dataElement.textual}
handleTextualChange={handleTextualChange}
/>
</TabPane>
</TabContent>
</CardBody>
......
......@@ -6,7 +6,12 @@ import {getProject} from '../../../settings/store/actions'
import { Card, CardBody, Row, Col, CardHeader, CardTitle, Label, Input, FormGroup, CardText } from 'reactstrap'
import { languages } from 'prismjs'
const PlanLang = ({language, dataElement}) => {
const PlanLang = ({language, dataElement, LangChange}) => {
const handleInputChange = (value, field) => {
dataElement[field] = value
LangChange(dataElement)
}
return <Fragment>
<CardTitle tag="h5">{language.name} Textual </CardTitle>
<Col md='12' sm='12'>
......@@ -19,6 +24,7 @@ const PlanLang = ({language, dataElement}) => {
// innerRef={register({ required: true })}
placeholder='title'
defaultValue={dataElement && dataElement.title}
onChange={(e) => handleInputChange(e.target.value, 'title')}
// className={classnames({ 'is-invalid': errors['title'] })}
/>
</FormGroup>
......@@ -33,6 +39,7 @@ const PlanLang = ({language, dataElement}) => {
// innerRef={register({ required: true })}
placeholder='longdescription'
defaultValue={dataElement && dataElement.longdescription}
onChange={(e) => handleInputChange(e.target.value, 'longdescription')}
// className={classnames({ 'is-invalid': errors['shortdescriptions'] })}
/>
</FormGroup>
......@@ -47,6 +54,8 @@ const PlanLang = ({language, dataElement}) => {
// innerRef={register({ required: true })}
placeholder='shortdescriptions'
defaultValue={dataElement && dataElement.shortdescriptions}
onChange={(e) => handleInputChange(e.target.value, 'shortdescriptions')}
// className={classnames({ 'is-invalid': errors['shortdescriptions'] })}
/>
</FormGroup>
......@@ -54,9 +63,12 @@ const PlanLang = ({language, dataElement}) => {
</Fragment>
}
const TextualBlock = ({dataElement}) => {
const TextualBlock = ({dataElement, handleTextualChange}) => {
const store = useSelector(state => state.projectsettings),
dispatch = useDispatch()
dispatch = useDispatch(),
handleLangChange = () => {
handleTextualChange(dataElement)
}
// populate layout menus
useEffect(() => {
......@@ -84,9 +96,14 @@ const TextualBlock = ({dataElement}) => {
title: ''
}
]
console.log(textuals)
}
return <PlanLang key={language.id} language={language} dataElement={textuals[0]} />
return <PlanLang
key={language.id}
language={language}
dataElement={textuals[0]}
LangChange={handleLangChange}
/>
}
)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment