Form editor

- new/edit in forms listing goes to editor
- fixed editor dependencies (via Webpack)
- updated forms table schema
- saving/loading a form works
This commit is contained in:
Jonathan Labreuille
2015-11-02 19:01:01 +01:00
parent 6c8d2be18c
commit 541696863e
21 changed files with 175 additions and 93 deletions

View File

@ -86,7 +86,7 @@ const item_actions = [
label: 'Edit',
link: function(item) {
return (
<Link to={ `/edit/${item.id}` }>Edit</Link>
<a href={ `admin.php?page=mailpoet-form-editor&id=${item.id}` }>Edit</a>
);
}
},
@ -117,7 +117,19 @@ const bulk_actions = [
];
const FormList = React.createClass({
renderItem: function(form, actions) {
createForm() {
MailPoet.Ajax.post({
endpoint: 'forms',
action: 'save',
data: {
name: "New form"
}
}).done(function(response) {
window.location =
'admin.php?page=mailpoet-form-editor&id='+ parseInt(response, 10);
})
},
renderItem(form, actions) {
let row_classes = classNames(
'manage-column',
'column-primary',
@ -151,7 +163,11 @@ const FormList = React.createClass({
return (
<div>
<h2 className="title">
Forms <Link className="add-new-h2" to="/new">New</Link>
Forms <a
className="add-new-h2"
href="javascript:;"
onClick={ this.createForm }
>New</a>
</h2>
<Listing