mirror of
https://github.com/shouptech/humulus.git
synced 2026-02-03 17:19:42 +00:00
Display time in recipe info
This commit is contained in:
parent
e9b0117027
commit
9c9240171c
5 changed files with 37 additions and 10 deletions
|
|
@ -176,7 +176,11 @@ class RecipeForm(FlaskForm):
|
||||||
|
|
||||||
recipe['fermentables'] = [f.doc for f in self.fermentables]
|
recipe['fermentables'] = [f.doc for f in self.fermentables]
|
||||||
recipe['hops'] = [h.doc for h in self.hops]
|
recipe['hops'] = [h.doc for h in self.hops]
|
||||||
if self.yeast.doc['name']:
|
if (
|
||||||
|
self.yeast.doc['name'] and
|
||||||
|
self.yeast.doc['low_attenuation'] and
|
||||||
|
self.yeast.doc['high_attenuation']
|
||||||
|
):
|
||||||
recipe['yeast'] = self.yeast.doc
|
recipe['yeast'] = self.yeast.doc
|
||||||
return recipe
|
return recipe
|
||||||
|
|
||||||
|
|
|
||||||
1
src/humulus/static/moment.min.js
vendored
Normal file
1
src/humulus/static/moment.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -41,6 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||||
|
<script src="{{ url_for('static', filename='moment.min.js')}}"></script>
|
||||||
<main role="main" class="container">
|
<main role="main" class="container">
|
||||||
{% block alert %}
|
{% block alert %}
|
||||||
{% for category, message in get_flashed_messages(with_categories=true) %}
|
{% for category, message in get_flashed_messages(with_categories=true) %}
|
||||||
|
|
|
||||||
|
|
@ -70,3 +70,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{#
|
||||||
|
Write javascript to use momentjs to display a timestamp.
|
||||||
|
#}
|
||||||
|
{% macro moment(timestamp, format="llll") %}
|
||||||
|
<script>document.write(moment.utc("{{ timestamp }}").local().format("llll"));</script>
|
||||||
|
{% endmacro %}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-#}
|
-#}
|
||||||
{% from "_macros.html" import render_field_with_errors, render_delete_button, render_delete_modal %}
|
{% from "_macros.html" import render_field_with_errors, render_delete_button, render_delete_modal, moment %}
|
||||||
|
|
||||||
{% extends '_base.html' %}
|
{% extends '_base.html' %}
|
||||||
{% block title %}{{ recipe.name }}{% endblock %}
|
{% block title %}{{ recipe.name }}{% endblock %}
|
||||||
|
|
@ -25,14 +25,28 @@
|
||||||
Recipe Details
|
Recipe Details
|
||||||
-#}
|
-#}
|
||||||
<div class="row"><h2>Details</h2></div>
|
<div class="row"><h2>Details</h2></div>
|
||||||
<div class="row"><div class="col">
|
<div class="row">
|
||||||
<dl>
|
<div class="col">
|
||||||
<dd>Batch Efficiency</dd>
|
<dl>
|
||||||
<dt>{{ recipe.efficiency|int }}%</dt>
|
<dt>Batch Efficiency</dt>
|
||||||
<dd>Batch Volume</dd>
|
<dd>{{ recipe.efficiency|int }}%</dd>
|
||||||
<dt>{{ recipe.volume|float|round(1) }} gal.</dt>
|
<dt>Batch Volume</dt>
|
||||||
</dl>
|
<dd>{{ recipe.volume|float|round(1) }} gal.</dd>
|
||||||
</div></div>
|
</dl>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<dl>
|
||||||
|
{% if 'created' in recipe %}
|
||||||
|
<dt>Created</dt>
|
||||||
|
<dd>{{ moment(recipe.created) }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
{% if 'updated' in recipe %}
|
||||||
|
<dt>Updated</dt>
|
||||||
|
<dd>{{ moment(recipe.updated) }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{#-
|
{#-
|
||||||
Fermentables
|
Fermentables
|
||||||
-#}
|
-#}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue