implemented frontend save

master
Malar Kannan 2017-07-28 11:29:50 +05:30
parent b7bb5da857
commit e5f203d4b8
3 changed files with 19 additions and 13 deletions

View File

@ -183,7 +183,15 @@ const fieldMetaMap = {
_.negate(_.isEqual)
))
},
groups: {
type: 'list',
...listAttrAccessor(attrPredGen(
'groups[0].property',
'id',
'frame',
_.negate(_.isEqual)
))
},
};
const xmlToEntries = (xmlData: any) => {

View File

@ -86,7 +86,7 @@ function imagePreview(params: any) {
let imageSrc = '/png/' + value;
return value !== '' ? (
<LexSingleInput key={field} label={changedLabel(changed, field)}>
<Image src={imageSrc} size="tiny" bordered={true} />
<Image src={imageSrc} size="large" bordered={true} />
</LexSingleInput>
) : textInput(params);
}

View File

@ -20,17 +20,15 @@ function updateXMLState(state: any = {}, action: any) {
return action.xmlData;
}
if (action.type === 'ACTION_SAVE_LEXITEM') {
// debugger;
// let guid = action.lexSelector.guid.get(action.lexItem);
// let lang = action.lexSelector.lang.get(action.lexItem);
// // action.lexItem;
// _.findIndex(_.get<any>(state,'document.lexicon[0].item'),(o)=>{
// return _.isEqual(_.get(o,'$.guid'),guid) && _.isEqual(_.get(o,'entry[0].lang'),lang)
// });
_.noop();
return {
...state
};
let newState = _.cloneDeep(state);
let guid = action.lexSelector.guid.get(action.lexItem);
let lang = action.lexSelector.lang.get(action.lexItem);
let entries = _.get<any>(newState, 'document.lexicon[0].item');
let entGuid = _.find(entries, (o) => _.isEqual(_.get<any>(o, '$.guid'), guid));
let entLang = _.get<any>(entGuid, 'entry');
let entlang = _.find(entLang, (o) => _.isEqual(_.get<any>(o, 'lang[0].$.id'), lang));
_.set(entlang, 'lang[0]', action.lexItem);
return newState;
}
return state;
}