diff --git a/src/humulus/static/recipes.js b/src/humulus/static/recipes.js
index c105df7..1053f65 100644
--- a/src/humulus/static/recipes.js
+++ b/src/humulus/static/recipes.js
@@ -90,6 +90,11 @@ function removeHop() {
removeForm($(this), '.hop-form', '#hops');
}
+// Remove a mash step
+function removeMashStep() {
+ removeForm($(this), '.mash-form', '#mash');
+}
+
// Add a fermentable
function addFerm() {
var $fermsDiv = $('#ferms');
@@ -212,6 +217,58 @@ function addHop() {
rebindChangeEvents();
}
+// Add a new mash step
+function addMashStep() {
+ var $mashDiv = $('#mash');
+ var stepsLength = $mashDiv.data('length');
+ if (stepsLength == 20) {
+ window.alert("Can't have more than 20 mash steps.");
+ return;
+ }
+
+ var newStep = `
';
+
+ $mashDiv.append(newStep);
+ $('.rem-step').unbind('click');
+ $('.rem-step').click(removeMashStep);
+}
+
// Calculate recipe's original gravity
function calculateOG() {
var fermsLength = $('#ferms').data('length');
@@ -414,6 +471,8 @@ $(document).ready(function() {
$('.rem-ferm').click(removeFerm);
$('#add-hop').click(addHop);
$('.rem-hop').click(removeHop);
+ $('#add-step').click(addMashStep);
+ $('.rem-step').click(removeMashStep);
// Register change events
rebindChangeEvents();
diff --git a/src/humulus/templates/recipes/_macros.html b/src/humulus/templates/recipes/_macros.html
index 19b37e6..59d88ef 100644
--- a/src/humulus/templates/recipes/_macros.html
+++ b/src/humulus/templates/recipes/_macros.html
@@ -134,10 +134,10 @@ function getSpecsURL() {
Mash & Steps
-#}
-
+
{{ render_field_with_errors(form.mash.form.name, 'form-control-sm') }}
{% for step in form.mash.form.steps %}
-