mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-13 14:35:55 +00:00
Added new delete brew option on user page
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# changelog
|
||||
|
||||
### Saturday, 18/02/2017 - v2.7.2
|
||||
- Adding ability to delete a brew from the user page, incase the user creates a brew that makes the edit page unrender-able. (re:309)
|
||||
|
||||
## BIG NEWS
|
||||
With the next major release of Homebrewery, v3.0.0, this tool *will no longer support raw HTML input for brew code*. Most issues and errors users are having are because of this feature and it's become too taxing to help and fix these issues.
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ const React = require('react');
|
||||
const _ = require('lodash');
|
||||
const cx = require('classnames');
|
||||
const moment = require('moment');
|
||||
const request = require("superagent");
|
||||
|
||||
const BrewItem = React.createClass({
|
||||
getDefaultProps: function() {
|
||||
@@ -15,6 +16,24 @@ const BrewItem = React.createClass({
|
||||
};
|
||||
},
|
||||
|
||||
deleteBrew : 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.brew.editId)
|
||||
.send()
|
||||
.end(function(err, res){
|
||||
location.reload();
|
||||
});
|
||||
},
|
||||
|
||||
renderDeleteBrewLink: function(){
|
||||
if(!this.props.brew.editId) return;
|
||||
|
||||
return <a onClick={this.deleteBrew}>
|
||||
<i className='fa fa-trash' />
|
||||
</a>
|
||||
},
|
||||
renderEditLink: function(){
|
||||
if(!this.props.brew.editId) return;
|
||||
|
||||
@@ -47,6 +66,7 @@ const BrewItem = React.createClass({
|
||||
<i className='fa fa-share-alt' />
|
||||
</a>
|
||||
{this.renderEditLink()}
|
||||
{this.renderDeleteBrewLink()}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "homebrewery",
|
||||
"description": "Create authentic looking D&D homebrews using only markdown",
|
||||
"version": "2.7.1",
|
||||
"version": "2.7.2",
|
||||
"scripts": {
|
||||
"dev": "node scripts/dev.js",
|
||||
"quick": "node scripts/quick.js",
|
||||
|
||||
@@ -42,7 +42,6 @@ const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage
|
||||
const changelogText = require('fs').readFileSync('./changelog.md', 'utf8');
|
||||
|
||||
|
||||
|
||||
//Source page
|
||||
String.prototype.replaceAll = function(s,r){return this.split(s).join(r)}
|
||||
app.get('/source/:id', (req, res)=>{
|
||||
|
||||
Reference in New Issue
Block a user