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'}}/>
|
||||
</div>
|
||||
<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>
|
||||
<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',
|
||||
data: {
|
||||
templateType: this.state.items[this.state.selectedIndex].type,
|
||||
subject: form.name,
|
||||
subject: form.title,
|
||||
body: form.content,
|
||||
language: this.state.language
|
||||
}
|
||||
|
@ -156,7 +156,8 @@ class AdminPanelEmailTemplates extends React.Component {
|
|||
API.call({
|
||||
path: '/system/recover-mail-template',
|
||||
data: {
|
||||
templateType: this.state.items[this.state.selectedIndex].type
|
||||
templateType: this.state.items[this.state.selectedIndex].type,
|
||||
language: this.state.language
|
||||
}
|
||||
}).then(() => {
|
||||
this.retrieveEmailTemplates();
|
||||
|
@ -189,9 +190,37 @@ class AdminPanelEmailTemplates extends React.Component {
|
|||
}).then((result) => this.setState({
|
||||
edited: false,
|
||||
loaded: true,
|
||||
items: result.data
|
||||
items: this.getParsedItems(result.data)
|
||||
}, 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;
|
||||
|
|
|
@ -76,34 +76,40 @@ module.exports = [
|
|||
status: 'success',
|
||||
data: [
|
||||
{
|
||||
type: 'USER_SIGNUP',
|
||||
'en': {
|
||||
'subject': 'Signup {{to}} - OpenSupports',
|
||||
'body' : 'This is the user signup content {{name}}'
|
||||
},
|
||||
'es': {
|
||||
'subject' : 'Registrado {{to}} - OpenSupports',
|
||||
'body' : 'Este es el contenido de signup {{name}}'
|
||||
},
|
||||
'de': {
|
||||
'subject' : 'Anmelden {{to}} - OpenSupports',
|
||||
'body' : 'Dies ist der User Signup Content {{name}}'
|
||||
}
|
||||
type: 'USER_SINGUP',
|
||||
language: 'en',
|
||||
subject: 'Signup {{to}} - OpenSupports',
|
||||
body : 'This is the user signup content {{name}}'
|
||||
},
|
||||
{
|
||||
type: 'USER_SINGUP',
|
||||
language: 'es',
|
||||
subject: 'Registrado {{to}} - OpenSupports',
|
||||
body : 'Este es el contenido de signup {{name}}'
|
||||
},
|
||||
{
|
||||
type: 'USER_SINGUP',
|
||||
language: 'de',
|
||||
subject: 'Anmelden {{to}} - OpenSupports',
|
||||
body : 'Dies ist der User Signup Content {{name}}'
|
||||
},
|
||||
{
|
||||
type: 'USER_EDIT_PASSWORD',
|
||||
'en': {
|
||||
'subject': 'Password changed {{to}} - OpenSupports',
|
||||
'body' : 'Password has been edited {{name}}'
|
||||
},
|
||||
'es': {
|
||||
'subject' : 'Password cambiado {{to}} - OpenSupports',
|
||||
'body' : 'El password ha sido editado {{name}}'
|
||||
},
|
||||
'de': {
|
||||
'subject' : 'Passwort geändert {{to}} - OpenSupports',
|
||||
'body' : 'Passwort wurde bearbeitet {{name}}'
|
||||
}
|
||||
language: 'en',
|
||||
subject: 'Password changed {{to}} - OpenSupports',
|
||||
body : 'Password has been edited {{name}}'
|
||||
},
|
||||
{
|
||||
type: 'USER_EDIT_PASSWORD',
|
||||
language: 'es',
|
||||
subject: 'Password cambiado {{to}} - OpenSupports',
|
||||
body : 'El password ha sido editado {{name}}'
|
||||
},
|
||||
{
|
||||
type: 'USER_EDIT_PASSWORD',
|
||||
language: 'de',
|
||||
subject: 'Passwort geändert {{to}} - OpenSupports',
|
||||
body : 'Passwort wurde bearbeitet {{name}}'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue