Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin committed Jan 3, 2020
2 parents ac58bf1 + 643beb9 commit f93f9d4
Show file tree
Hide file tree
Showing 38 changed files with 165 additions and 3,274 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "venv3.6/bin/python"
}
12 changes: 12 additions & 0 deletions Untitled-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

import boto3

# Let's use Amazon S3
s3 = boto3.resource('s3')

for bucket in s3.buckets.all():
print(bucket.name)

# Upload a new file
data = open('./static/favicon-32x32.png', 'rb')
s3.Bucket('thegratefulbrauer').put_object(Key='recipe_description_images/bbearce/recipes/favicon-32x32.png', Body=data)
Binary file modified __pycache__/models.cpython-36.pyc
Binary file not shown.
12 changes: 7 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
manager = Manager(app)
migrate = Migrate(app, db)


# Grab DB table column names
import models

Expand Down Expand Up @@ -71,11 +72,12 @@ def load():

# Multiple row tables
for table in ['Fermentables','Hops']:
exec('{} = models.Recipe_{}.query.filter_by(recipe_id = Recipe.id).all()'.format(table, table))
exec('{} = models.Recipe_{}.query.filter_by(recipe_id = Recipe.id).all()'.format(table, table))

# Build data json dictionary based on models.

data = {'Recipe':{}}

data = {'Recipe':{}}

recipe_dict = {}
for r in recipe_columns:
Expand Down Expand Up @@ -136,9 +138,10 @@ def load():
@app.route('/save')
def save():

# Common to all
# Common to all (in db: gb_recipe_system)
recipe = request.args.get('recipe', 0, type=str)
style = request.args.get('style', 0, type=str)
notes = request.args.get('notes', 0, type=str)

# Grab all input values from html pages
for s in system_columns:
Expand Down Expand Up @@ -170,7 +173,7 @@ def save():
exec("{} = request.args.get('{}', 0, type=str)".format(c,c))

# check if this already exists
Recipe = models.Recipe(recipe=recipe, style=style)
Recipe = models.Recipe(recipe=recipe, style=style, notes=notes)

if(len(models.Recipe.query.filter_by(recipe=Recipe.recipe).all()) == 0):
print("this recipe doesn't exist so we are adding it.")
Expand Down Expand Up @@ -357,7 +360,6 @@ def brewculator():
hcolumns = [zip(hops_columns,[i]*(len(hops_columns)+1)) for i in range(1,num_of_inputs+1)]
hcolumns = [[j for j in i] for i in hcolumns] # Python3 has zips as generators so I have to convert


return render_template('/brewculator/brewculator.html',
Data = json.dumps(data),
Recipes=Recipes,
Expand Down
Binary file removed favicon.ico
Binary file not shown.
Binary file removed favicon.png
Binary file not shown.
52 changes: 51 additions & 1 deletion static/css/brewculator.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
display: block;
height: 300px;
width: 100%;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}

/*h3{
Expand All @@ -14,6 +16,12 @@
width: 33%;
}

.home-input-div{
float: left;
height: 500px;
width: 33%;
}

.fermentables-input-div{
float: left;
height: 700px;
Expand Down Expand Up @@ -64,6 +72,48 @@
height: 200px;
}

/* Home App START */
.home-app-div{
border-left: solid;
float: right;
width: 65%;
height: 500px;
}

#notes {
height: 75%;
width: 100%;
font-size: 14pt;
text-align: left;
}

/* Floating Social Media Bar Style Starts Here */

.fl-fl {
color: #fff;
background: #000000;
text-transform: uppercase;
letter-spacing: 3px;
padding: 4px;
width: 190px;
position: fixed;
right: -140px;
z-index: 1000;
top: 180px;
font: normal normal 10px Arial;
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}

.fl-fl:hover {
right: 0;
}

/* Home App END */

.fermentables-app-div{
border-left: solid;
float: right;
Expand Down Expand Up @@ -223,7 +273,7 @@ body {font-family: Arial;}
/* Style the tab content */
.tabcontent {
display: none;
padding: 6px 12px;
padding: 6px 0px 0px 0px;
/*border: 1px solid #ccc;*/
border-top: none;
}
Expand Down
Binary file added static/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions static/js/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function convert_md_to_html(){
console.log('ran convert_md_to_html()')
// Get markdown to convert
var notes = document.getElementById('notes').value

var converter = new showdown.Converter();
var html = converter.makeHtml(notes);

var output_html = document.getElementById('output-html')
output_html.innerHTML = html

// Adjust what is shown
if (document.getElementById('notes').style.display === 'none') {
document.getElementById('notes').style.display = 'block'
document.getElementById('output-html').style.display = 'none'

} else {
document.getElementById('notes').style.display = 'none'
document.getElementById('output-html').style.display = 'block'

}
}

8 changes: 6 additions & 2 deletions static/js/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $('#load').bind('click', function() {

// Recipe
$('select[name="style"]').val(loaded_data['data']['Recipe']['gb_recipe_master']['style'])
$('textarea[name="notes"]').val(loaded_data['data']['Recipe']['gb_recipe_master']['notes'])

// System
$('input[name="batch_size"]').val(loaded_data['data']['Recipe']['gb_recipe_system']['batch_size'])
Expand Down Expand Up @@ -128,8 +129,12 @@ $('#load').bind('click', function() {
//Send User Message
alert("You just loaded "+loaded_data['data']['Recipe']['gb_recipe_master']['recipe'])


//// Rerun app calculations

// Load Notes and set to HTML mode
convert_md_to_html()

// Fermentables
refresh_fermentables()

Expand All @@ -151,8 +156,7 @@ $('#load').bind('click', function() {
// Fermentation
refresh_fermentation()




}


Expand Down
2 changes: 2 additions & 0 deletions static/js/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ $('#save').bind('click',
// Recipe
recipe: $('input[name="recipe"]').val(),
style: $('select[name="style"]').val(),
notes: $('textarea[name="notes"]').val(),


// System Table
batch_size: $('input[name="batch_size"]').val(),
Expand Down
49 changes: 13 additions & 36 deletions templates/brewculator/brewculator.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
<!DOCTYPE html>
<html>
<head>
<title>Ajax Test with jQuery</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" type="text/css" href="../static/css/thegratefulbrauer.css">
<link rel="stylesheet" href="/static/css/brewculator.css">
<title>Brewculator</title>

<!-- Outside Scripts -->
<!-- Outside CSS and JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

<!-- Custom CSS and JS -->
<link rel="stylesheet" type="text/css" href="../static/css/thegratefulbrauer.css">
<link rel="stylesheet" href="/static/css/brewculator.css">
<!-- Favicon -->
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}">

</head>

Expand Down Expand Up @@ -57,35 +61,7 @@ <h1>Brewculator</h1>

<div id="Home_Tab" class="tabcontent">
<!-- Home Section -->
<div style='display: block;'>
<div style='display: block;'>
<label style='display: block;'>New Recipe Name</label>
<input type=text size=25 name=recipe style='text-align: left; ' value='new recipe'>
<input id=save type="button" value="Save">
</div>

<div>
<label style='display: block;'>Load Recipe</label>
<select id='recipe_load'>
{% for recipe in Recipes %}
<option> {{ recipe.recipe }}</option>
{% endfor %}
</select>
<input id=load type="button" value="Load">
</div>

<div>
<label style='display: block;'>Delete Recipe</label>
<select id='recipe_delete'>
{% for recipe in Recipes %}
<option> {{ recipe.recipe }}</option>
{% endfor %}
</select>
<input id=delete type="button" value="Delete">
</div>

</div>

{% include '/brewculator/home.html' %}
</div>

<div id="System_Tab" class="tabcontent">
Expand Down Expand Up @@ -161,6 +137,7 @@ <h1>Brewculator</h1>
<script src="../static/js/water.js"></script>
<script src="../static/js/fermentation.js"></script>
<script src="../static/js/chemistry.js"></script>
<script src="../static/js/home.js"></script>

<!-- Load Script -->
<script src="../static/js/load.js"></script>
Expand Down
44 changes: 44 additions & 0 deletions templates/brewculator/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div class="container">
<div class='home-input-div'>
<!-- Home Section -->
<div style='display: block;'>
<label style='display: block;'>New Recipe Name</label>
<input type=text size=25 name=recipe style='text-align: left; ' value='new recipe'>
<input id=save type="button" value="Save">
</div>

<div>
<label style='display: block;'>Load Recipe</label>
<select id='recipe_load'>
{% for recipe in Recipes %}
<option> {{ recipe.recipe }}</option>
{% endfor %}
</select>
<input id=load type="button" value="Load">
</div>

<div>
<label style='display: block;'>Delete Recipe</label>
<select id='recipe_delete'>
{% for recipe in Recipes %}
<option> {{ recipe.recipe }}</option>
{% endfor %}
</select>
<input id=delete type="button" value="Delete">
</div>
</div>



<div class='home-app-div'>
<button id=convert_md_to_html onclick="convert_md_to_html()">Toggle MD and HTML</button>
<textarea id='notes' name='notes' type="text" style="display: block;">Enter New Recipe Notes</textarea>
<div id='output-html' style='display: none;'></div>
</div>

<div class="fl-fl">
<h2>Tool Bar</h2>
<a href="" target="_blank"> Like us!</a>
</div>

</div>
11 changes: 4 additions & 7 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@

<title>The Grateful Brauer</title>

<link rel="icon" href="favicon.ico" type="image/x-icon" />

<!-- Bootstrap Core CSS -->
<!--<link href="/static/bootstrap.min.css" rel="stylesheet">-->
<!-- Custom CSS and JS -->
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}">
<link rel="stylesheet" type="text/css" href="../static/css/thegratefulbrauer.css">

<!-- Outside CSS and JS -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<!-- Custum CSS -->
<link rel="stylesheet" type="text/css" href="../static/css/thegratefulbrauer.css">

</head>

{% extends "nav-bar.html" %}
Expand Down
Binary file removed templates/static/.DS_Store
Binary file not shown.
Loading

0 comments on commit f93f9d4

Please sign in to comment.