0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 03:32:40 +00:00

Added sanitizeHtml function to Homebrew model to generate HTML from the brew for the source page.

Moved `source` page generation function to a new function module. Added option to function to create plain text download with a sanitized filename and made it accessible from a new page: `download`.
Added the `download` item to the BrewItem so it appears on each brew on the User page.
Added `sanitize-filename` dependency to `package.json`.
This commit is contained in:
G.Ambatte
2021-01-21 00:02:15 +13:00
parent 7fccb7e03e
commit e8135fcbb4
7 changed files with 79 additions and 67 deletions

View File

@@ -65,7 +65,7 @@ const BrewItem = createClass({
</a>;
},
renderShareLink : function(){
renderSourceLink : function(path, icon){
if(!this.props.brew.shareId) return;
let shareLink = this.props.brew.shareId;
@@ -73,8 +73,8 @@ const BrewItem = createClass({
shareLink = this.props.brew.googleId + shareLink;
}
return <a href={`/share/${shareLink}`} target='_blank' rel='noopener noreferrer'>
<i className='fa fa-share-alt' />
return <a href={`/${path}/${shareLink}`} target='_blank' rel='noopener noreferrer'>
<i className={`fa ${icon}`} />
</a>;
},
@@ -107,8 +107,9 @@ const BrewItem = createClass({
</div>
<div className='links'>
{this.renderShareLink()}
{this.renderSourceLink('share', 'fa-share-alt')}
{this.renderEditLink()}
{this.renderSourceLink('download', 'fa-download')}
{this.renderDeleteBrewLink()}
</div>
</div>;