1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-13 05:15:56 +00:00

Added new delete brew option on user page

This commit is contained in:
Scott Tolksdorf
2017-02-18 14:46:14 -05:00
parent cc8e874ad1
commit 18852932e8
4 changed files with 24 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
# changelog # 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 ## 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. 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.

View File

@@ -2,6 +2,7 @@ const React = require('react');
const _ = require('lodash'); const _ = require('lodash');
const cx = require('classnames'); const cx = require('classnames');
const moment = require('moment'); const moment = require('moment');
const request = require("superagent");
const BrewItem = React.createClass({ const BrewItem = React.createClass({
getDefaultProps: function() { 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(){ renderEditLink: function(){
if(!this.props.brew.editId) return; if(!this.props.brew.editId) return;
@@ -47,6 +66,7 @@ const BrewItem = React.createClass({
<i className='fa fa-share-alt' /> <i className='fa fa-share-alt' />
</a> </a>
{this.renderEditLink()} {this.renderEditLink()}
{this.renderDeleteBrewLink()}
</div> </div>
</div> </div>
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "homebrewery", "name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown", "description": "Create authentic looking D&D homebrews using only markdown",
"version": "2.7.1", "version": "2.7.2",
"scripts": { "scripts": {
"dev": "node scripts/dev.js", "dev": "node scripts/dev.js",
"quick": "node scripts/quick.js", "quick": "node scripts/quick.js",

View File

@@ -42,7 +42,6 @@ const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage
const changelogText = require('fs').readFileSync('./changelog.md', 'utf8'); const changelogText = require('fs').readFileSync('./changelog.md', 'utf8');
//Source page //Source page
String.prototype.replaceAll = function(s,r){return this.split(s).join(r)} String.prototype.replaceAll = function(s,r){return this.split(s).join(r)}
app.get('/source/:id', (req, res)=>{ app.get('/source/:id', (req, res)=>{