1
0
Fork 0
mirror of https://github.com/shouptech/humulus.git synced 2026-02-03 16:09:44 +00:00

Display time in recipe info

This commit is contained in:
Emma 2019-06-25 21:07:36 -06:00
parent e9b0117027
commit 9c9240171c
5 changed files with 37 additions and 10 deletions

View file

@ -176,7 +176,11 @@ class RecipeForm(FlaskForm):
recipe['fermentables'] = [f.doc for f in self.fermentables]
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
return recipe

1
src/humulus/static/moment.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -41,6 +41,7 @@
</div>
</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="{{ url_for('static', filename='moment.min.js')}}"></script>
<main role="main" class="container">
{% block alert %}
{% for category, message in get_flashed_messages(with_categories=true) %}

View file

@ -70,3 +70,10 @@
</div>
</div>
{% 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 %}

View file

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
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' %}
{% block title %}{{ recipe.name }}{% endblock %}
@ -25,14 +25,28 @@
Recipe Details
-#}
<div class="row"><h2>Details</h2></div>
<div class="row"><div class="col">
<div class="row">
<div class="col">
<dl>
<dd>Batch Efficiency</dd>
<dt>{{ recipe.efficiency|int }}%</dt>
<dd>Batch Volume</dd>
<dt>{{ recipe.volume|float|round(1) }} gal.</dt>
<dt>Batch Efficiency</dt>
<dd>{{ recipe.efficiency|int }}%</dd>
<dt>Batch Volume</dt>
<dd>{{ recipe.volume|float|round(1) }} gal.</dd>
</dl>
</div></div>
</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
-#}