Ivan - Update system fixtures for email templates
This commit is contained in:
parent
088f1de941
commit
a86fdc72ee
|
@ -58,7 +58,7 @@ class AdminPanelEmailTemplates extends React.Component {
|
||||||
<FormField label={i18n('TITLE')} name="title" validation="TITLE" required fieldProps={{size: 'large'}}/>
|
<FormField label={i18n('TITLE')} name="title" validation="TITLE" required fieldProps={{size: 'large'}}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-5">
|
<div className="col-md-5">
|
||||||
<LanguageSelector type="supported" size="medium" value={this.state.language} onChange={event => this.onItemChange(this.state.selectedIndex, event.target.value)}/>
|
<LanguageSelector type="allowed" size="medium" value={this.state.language} onChange={event => this.onItemChange(this.state.selectedIndex, event.target.value)}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FormField label={i18n('CONTENT')} name="content" validation="TEXT_AREA" required field="textarea" />
|
<FormField label={i18n('CONTENT')} name="content" validation="TEXT_AREA" required field="textarea" />
|
||||||
|
@ -132,7 +132,7 @@ class AdminPanelEmailTemplates extends React.Component {
|
||||||
path: '/system/edit-mail-template',
|
path: '/system/edit-mail-template',
|
||||||
data: {
|
data: {
|
||||||
templateType: this.state.items[this.state.selectedIndex].type,
|
templateType: this.state.items[this.state.selectedIndex].type,
|
||||||
subject: form.name,
|
subject: form.title,
|
||||||
body: form.content,
|
body: form.content,
|
||||||
language: this.state.language
|
language: this.state.language
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,8 @@ class AdminPanelEmailTemplates extends React.Component {
|
||||||
API.call({
|
API.call({
|
||||||
path: '/system/recover-mail-template',
|
path: '/system/recover-mail-template',
|
||||||
data: {
|
data: {
|
||||||
templateType: this.state.items[this.state.selectedIndex].type
|
templateType: this.state.items[this.state.selectedIndex].type,
|
||||||
|
language: this.state.language
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.retrieveEmailTemplates();
|
this.retrieveEmailTemplates();
|
||||||
|
@ -189,9 +190,37 @@ class AdminPanelEmailTemplates extends React.Component {
|
||||||
}).then((result) => this.setState({
|
}).then((result) => this.setState({
|
||||||
edited: false,
|
edited: false,
|
||||||
loaded: true,
|
loaded: true,
|
||||||
items: result.data
|
items: this.getParsedItems(result.data)
|
||||||
}, this.updateForm.bind(this, this.state.selectedIndex)));
|
}, this.updateForm.bind(this, this.state.selectedIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getParsedItems(items) {
|
||||||
|
let parsedItems = {};
|
||||||
|
|
||||||
|
_.forEach(items, (item) => {
|
||||||
|
if(parsedItems[item.type]) {
|
||||||
|
parsedItems[item.type][item.language] = {
|
||||||
|
subject: item.subject,
|
||||||
|
body: item.body
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
parsedItems[item.type] = {
|
||||||
|
[item.language]: {
|
||||||
|
subject: item.subject,
|
||||||
|
body: item.body
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
parsedItems = Object.keys(parsedItems).map((type) => {
|
||||||
|
return _.extend({
|
||||||
|
type: type
|
||||||
|
}, parsedItems[type]);
|
||||||
|
});
|
||||||
|
|
||||||
|
return parsedItems;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AdminPanelEmailTemplates;
|
export default AdminPanelEmailTemplates;
|
||||||
|
|
|
@ -76,34 +76,40 @@ module.exports = [
|
||||||
status: 'success',
|
status: 'success',
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
type: 'USER_SIGNUP',
|
type: 'USER_SINGUP',
|
||||||
'en': {
|
language: 'en',
|
||||||
'subject': 'Signup {{to}} - OpenSupports',
|
subject: 'Signup {{to}} - OpenSupports',
|
||||||
'body' : 'This is the user signup content {{name}}'
|
body : 'This is the user signup content {{name}}'
|
||||||
},
|
},
|
||||||
'es': {
|
{
|
||||||
'subject' : 'Registrado {{to}} - OpenSupports',
|
type: 'USER_SINGUP',
|
||||||
'body' : 'Este es el contenido de signup {{name}}'
|
language: 'es',
|
||||||
},
|
subject: 'Registrado {{to}} - OpenSupports',
|
||||||
'de': {
|
body : 'Este es el contenido de signup {{name}}'
|
||||||
'subject' : 'Anmelden {{to}} - OpenSupports',
|
},
|
||||||
'body' : 'Dies ist der User Signup Content {{name}}'
|
{
|
||||||
}
|
type: 'USER_SINGUP',
|
||||||
|
language: 'de',
|
||||||
|
subject: 'Anmelden {{to}} - OpenSupports',
|
||||||
|
body : 'Dies ist der User Signup Content {{name}}'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'USER_EDIT_PASSWORD',
|
type: 'USER_EDIT_PASSWORD',
|
||||||
'en': {
|
language: 'en',
|
||||||
'subject': 'Password changed {{to}} - OpenSupports',
|
subject: 'Password changed {{to}} - OpenSupports',
|
||||||
'body' : 'Password has been edited {{name}}'
|
body : 'Password has been edited {{name}}'
|
||||||
},
|
},
|
||||||
'es': {
|
{
|
||||||
'subject' : 'Password cambiado {{to}} - OpenSupports',
|
type: 'USER_EDIT_PASSWORD',
|
||||||
'body' : 'El password ha sido editado {{name}}'
|
language: 'es',
|
||||||
},
|
subject: 'Password cambiado {{to}} - OpenSupports',
|
||||||
'de': {
|
body : 'El password ha sido editado {{name}}'
|
||||||
'subject' : 'Passwort geändert {{to}} - OpenSupports',
|
},
|
||||||
'body' : 'Passwort wurde bearbeitet {{name}}'
|
{
|
||||||
}
|
type: 'USER_EDIT_PASSWORD',
|
||||||
|
language: 'de',
|
||||||
|
subject: 'Passwort geändert {{to}} - OpenSupports',
|
||||||
|
body : 'Passwort wurde bearbeitet {{name}}'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue