diff --git a/changelog.md b/changelog.md index 6cd893dee..801f647f7 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ ### Wednesday, 23/11/2016 - v2.5.0 - Metadata can now be added to brews - Added a metadata editor onto the edit and new pages +- Moved deleting a brew into the metadata editor ### Monday, 14/11/2016 diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.jsx b/client/homebrew/editor/metadataEditor/metadataEditor.jsx index 4fd395f6b..15a9554b1 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.jsx +++ b/client/homebrew/editor/metadataEditor/metadataEditor.jsx @@ -1,6 +1,7 @@ const React = require('react'); const _ = require('lodash'); const cx = require('classnames'); +const request = require("superagent"); const SYSTEMS = ['5e', '4e', '3.5e', 'Pathfinder'] @@ -8,6 +9,7 @@ const MetadataEditor = React.createClass({ getDefaultProps: function() { return { metadata: { + editId : null, title : '', description : '', tags : '', @@ -38,6 +40,17 @@ const MetadataEditor = React.createClass({ })); }, + handleDelete : function(){ + if(!confirm("are you sure you want to delete this brew?")) return; + if(!confirm("are you REALLY sure? You will not be able to recover it")) return; + + request.get('/api/remove/' + this.props.metadata.editId) + .send() + .end(function(err, res){ + window.location.href = '/'; + }); + }, + renderSystems : function(){ return _.map(SYSTEMS, (val)=>{ return