WiP updates
This commit is contained in:
parent
6706d93bc1
commit
4fce4b6f81
27 changed files with 763 additions and 85 deletions
|
@ -10,7 +10,7 @@ import { validateNamespace, NamespaceSelect } from '../../lib/namespace';
|
|||
import {DeleteModalDialog} from "../../lib/modals";
|
||||
|
||||
import { versafix } from "../../../../shared/mosaico-templates";
|
||||
import { getTemplateTypes } from "./helpers";
|
||||
import { getTemplateTypes, getTemplateTypesOrder } from "./helpers";
|
||||
|
||||
@translate()
|
||||
@withForm
|
||||
|
@ -23,6 +23,14 @@ export default class CUD extends Component {
|
|||
|
||||
this.templateTypes = getTemplateTypes(props.t);
|
||||
|
||||
this.typeOptions = [];
|
||||
for (const type of getTemplateTypesOrder()) {
|
||||
this.typeOptions.push({
|
||||
key: type,
|
||||
label: this.templateTypes[type].typeName
|
||||
});
|
||||
}
|
||||
|
||||
this.state = {};
|
||||
|
||||
this.initForm();
|
||||
|
@ -141,14 +149,6 @@ export default class CUD extends Component {
|
|||
form = this.templateTypes[typeKey].getForm(this);
|
||||
}
|
||||
|
||||
const typeOptions = [];
|
||||
for (const type of ['html', 'mjml']) {
|
||||
typeOptions.push({
|
||||
key: type,
|
||||
label: this.templateTypes.typeName
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{canDelete &&
|
||||
|
@ -158,7 +158,7 @@ export default class CUD extends Component {
|
|||
deleteUrl={`/rest/templates/mosaico/${this.props.entity.id}`}
|
||||
cudUrl={`/templates/mosaico/${this.props.entity.id}/edit`}
|
||||
listUrl="/templates/mosaico"
|
||||
deletingMsg={t('Deleting mosaico template ...')}
|
||||
deletingMsg={t('Deleting Mosaico template ...')}
|
||||
deletedMsg={t('Mosaico template deleted')}/>
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ export default class CUD extends Component {
|
|||
<Form stateOwner={this} onSubmitAsync={::this.submitAndLeave}>
|
||||
<InputField id="name" label={t('Name')}/>
|
||||
<TextArea id="description" label={t('Description')} help={t('HTML is allowed')}/>
|
||||
<Dropdown id="type" label={t('Type')} options={typeOptions}/>
|
||||
<Dropdown id="type" label={t('Type')} options={this.typeOptions}/>
|
||||
<NamespaceSelect/>
|
||||
|
||||
{form}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import React, { Component } from 'react';
|
||||
import { translate } from 'react-i18next';
|
||||
import {DropdownMenu, Icon} from '../../lib/bootstrap-components';
|
||||
import { requiresAuthenticatedUser, withPageHelpers, Title, Toolbar, DropdownLink } from '../../lib/page';
|
||||
import { requiresAuthenticatedUser, withPageHelpers, Title, Toolbar, MenuLink } from '../../lib/page';
|
||||
import { withErrorHandling, withAsyncErrorHandler } from '../../lib/error-handling';
|
||||
import { Table } from '../../lib/table';
|
||||
import axios from '../../lib/axios';
|
||||
|
@ -82,8 +82,8 @@ export default class List extends Component {
|
|||
{this.state.createPermitted &&
|
||||
<Toolbar>
|
||||
<DropdownMenu className="btn-primary" label={t('Create Mosaico Template')}>
|
||||
<DropdownLink to="/templates/mosaico/create">{t('Blank')}</DropdownLink>
|
||||
<DropdownLink to="/templates/mosaico/create/versafix">{t('Versafix One')}</DropdownLink>
|
||||
<MenuLink to="/templates/mosaico/create">{t('Blank')}</MenuLink>
|
||||
<MenuLink to="/templates/mosaico/create/versafix">{t('Versafix One')}</MenuLink>
|
||||
</DropdownMenu>
|
||||
</Toolbar>
|
||||
}
|
||||
|
|
|
@ -5,6 +5,10 @@ import {ACEEditor} from "../../lib/form";
|
|||
import 'brace/mode/html'
|
||||
import 'brace/mode/xml'
|
||||
|
||||
export function getTemplateTypesOrder() {
|
||||
return ['mjml', 'html'];
|
||||
}
|
||||
|
||||
export function getTemplateTypes(t) {
|
||||
const templateTypes = {};
|
||||
|
||||
|
@ -17,7 +21,6 @@ export function getTemplateTypes(t) {
|
|||
typeName: t('HTML'),
|
||||
getForm: owner => <ACEEditor id="html" height="700px" mode="html" label={t('Template content')}/>,
|
||||
afterLoad: data => {
|
||||
console.log(data);
|
||||
data.html = data.data.html;
|
||||
},
|
||||
beforeSave: (data) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue