mirror of
https://github.com/strapi/strapi.git
synced 2025-12-24 13:43:41 +00:00
List email-templates
This commit is contained in:
parent
405272eadf
commit
f6497639e7
@ -24,10 +24,10 @@ const links = [
|
||||
// name: 'users-permissions.HeaderNav.link.providers',
|
||||
// to: '/plugins/users-permissions/providers',
|
||||
// },
|
||||
// {
|
||||
// name: 'users-permissions.HeaderNav.link.emailTemplates',
|
||||
// to: '/plugins/users-permissions/email-templates',
|
||||
// },
|
||||
{
|
||||
name: 'users-permissions.HeaderNav.link.emailTemplates',
|
||||
to: '/plugins/users-permissions/email-templates',
|
||||
},
|
||||
{
|
||||
name: 'users-permissions.HeaderNav.link.advancedSettings',
|
||||
to: '/plugins/users-permissions/advanced',
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
import React from 'react';
|
||||
import cn from 'classnames';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { get, includes } from 'lodash';
|
||||
import { router } from 'app';
|
||||
|
||||
@ -14,6 +15,7 @@ import { router } from 'app';
|
||||
import IcoContainer from 'components/IcoContainer';
|
||||
import PopUpWarning from 'components/PopUpWarning';
|
||||
|
||||
import en from 'translations/en.json';
|
||||
import styles from './styles.scss';
|
||||
|
||||
class ListRow extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||
@ -108,10 +110,12 @@ class ListRow extends React.Component { // eslint-disable-line react/prefer-stat
|
||||
<div className="col-md-4">
|
||||
<div className={styles.flex}>
|
||||
<div>
|
||||
<i className={`fa fa-${this.props.item.ico}`} />
|
||||
<i className={`fa fa-${this.props.item.icon}`} />
|
||||
</div>
|
||||
<div>
|
||||
{this.props.item.name}
|
||||
{this.props.item.display && en[this.props.item.display] ? (
|
||||
<FormattedMessage id={`users-permissions.${this.props.item.display}`} />
|
||||
): this.props.item.name}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -127,6 +131,7 @@ class ListRow extends React.Component { // eslint-disable-line react/prefer-stat
|
||||
}
|
||||
|
||||
handleClick = () => {
|
||||
// TODO open modal and pass data
|
||||
switch (this.props.settingType) {
|
||||
case 'roles': {
|
||||
if (!includes(this.protectedRoleIDs, get(this.props.item, 'id').toString())) {
|
||||
@ -168,6 +173,7 @@ ListRow.defaultProps = {
|
||||
name: 'Owner',
|
||||
description: 'Rule them all. This role can\'t be deleted',
|
||||
nb_users: 1,
|
||||
icon: 'envelope',
|
||||
},
|
||||
settingType: 'roles',
|
||||
};
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*
|
||||
*/
|
||||
import { Map } from 'immutable';
|
||||
|
||||
import { isArray } from 'lodash';
|
||||
import {
|
||||
CANCEL_CHANGES,
|
||||
DELETE_DATA,
|
||||
@ -46,6 +46,20 @@ export function fetchData(endPoint) {
|
||||
}
|
||||
|
||||
export function fetchDataSucceeded(data) {
|
||||
if (!isArray(data)) {
|
||||
const list = Object.keys(data).reduce((acc, current) => {
|
||||
const obj = Object.assign({ name: current}, data[current]);
|
||||
acc.push(obj);
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
return {
|
||||
type: FETCH_DATA_SUCCEEDED,
|
||||
data: list,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
type: FETCH_DATA_SUCCEEDED,
|
||||
data,
|
||||
|
||||
@ -114,7 +114,7 @@ export class HomePage extends React.Component {
|
||||
const { modifiedData, initialData, match } = this.props;
|
||||
const headerActions = match.params.settingType === 'advanced' && !isEqual(modifiedData, initialData) ?
|
||||
this.pluginHeaderActions : [];
|
||||
const noButtonList = match.params.settingType === 'email-templates';
|
||||
const noButtonList = match.params.settingType === 'email-templates' || match.params.settingType === 'providers';
|
||||
const component = match.params.settingType === 'advanced' ?
|
||||
<EditForm onChange={this.props.onChange} values={modifiedData} /> : (
|
||||
<List
|
||||
|
||||
@ -56,9 +56,11 @@ export function* dataFetch(action) {
|
||||
if (action.endPoint === 'advanced') {
|
||||
yield put(setForm(response));
|
||||
} else {
|
||||
yield put(fetchDataSucceeded(response[action.endPoint]));
|
||||
const data = response[action.endPoint] || response;
|
||||
yield put(fetchDataSucceeded(data));
|
||||
}
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
strapi.notification.error('users-permissions.notification.error.fetch');
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,9 +124,9 @@
|
||||
"Policies.header.hint": "Select the application's actions or the plugin's actions and click on the cog icon to display the bounded route",
|
||||
"Policies.header.title": "Advanced settings",
|
||||
|
||||
"Email.template.validation_email": "",
|
||||
"Email.template.reset_password": "",
|
||||
"Email.template.success_register": "",
|
||||
"Email.template.validation_email": "Email address validation",
|
||||
"Email.template.reset_password": "Reset password",
|
||||
"Email.template.success_register": "Successfull registration",
|
||||
|
||||
"Auth.advanced.allow_register": "",
|
||||
|
||||
|
||||
@ -124,9 +124,9 @@
|
||||
"Policies.header.hint": "Sélectionnez les actions de l'application ou d'un plugin et cliquer sur l'icon de paramètres pour voir les routes associées à cette action",
|
||||
"Policies.header.title": "Paramètres avancés",
|
||||
|
||||
"Email.template.validation_email": "",
|
||||
"Email.template.reset_password": "",
|
||||
"Email.template.success_register": "",
|
||||
"Email.template.validation_email": "Email de validation d'adresse",
|
||||
"Email.template.reset_password": "Modification de mot de passe",
|
||||
"Email.template.success_register": "Inscription réussie",
|
||||
|
||||
"Auth.advanced.allow_register": "",
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/email-template",
|
||||
"path": "/email-templates",
|
||||
"handler": "UsersPermissions.getEmailTemplate",
|
||||
"config": {
|
||||
"policies": []
|
||||
@ -74,7 +74,7 @@
|
||||
},
|
||||
{
|
||||
"method": "PUT",
|
||||
"path": "/email-template",
|
||||
"path": "/email-templates",
|
||||
"handler": "UsersPermissions.updateEmailTemplate",
|
||||
"config": {
|
||||
"policies": []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user