Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix some issues with mobile editing meal ingredients

Roland Geiderab49043adf7a
diff --git a/wger/manager/static/css/workout-manager-mobile.css b/wger/manager/static/css/workout-manager-mobile.css
index 33c0a2511..e5d7edede 100644
--- a/wger/manager/static/css/workout-manager-mobile.css
+++ b/wger/manager/static/css/workout-manager-mobile.css
@@ -574,4 +574,9 @@ header h1{
.float-left {
float:left;
display:inline;
+}
+
+.align-right
+{
+ text-align: right;
}
\ No newline at end of file
diff --git a/wger/nutrition/templates/mobile/meal_item/edit.html b/wger/nutrition/templates/mobile/meal_item/edit.html
new file mode 100644
index 000000000..da0aa8b32
--- /dev/null
+++ b/wger/nutrition/templates/mobile/meal_item/edit.html
@@ -0,0 +1,61 @@
+{% extends "base.html" %}
+{% load url from future %}
+{% load i18n %}
+{% load staticfiles %}
+{% load wger_extras %}
+
+
+{% block title %}{% trans "Edit meal item" %}{% endblock %}
+
+
+{% block header %}
+<script type="text/javascript">
+$(document).ready(function() {
+ // Init the autocompleter
+ init_ingredient_autocompleter();
+});
+</script>
+{% endblock %}
+
+
+
+{% block content %}
+<form action="{{ form_action }}"
+ method="post"
+ class="ym-form">
+{% csrf_token %}
+{{ form.non_field_errors }}
+{{form.ingredient}}
+<table>
+ <tr>
+ <td colspan="2">
+ <label for="id_ingredient_searchfield">
+ {% trans "Ingredient name" %}
+ </label>
+
+ <div class="ym-fbox-text">
+ <input type="text"
+ id="id_ingredient_searchfield"
+ name="ingredient_searchfield"
+ value="{{ingredient_searchfield}}">
+ </div>
+ <h5 id="exercise_name" class="ym-fbox-text"></h5>
+ </td>
+ </tr>
+
+
+
+ {% yaml_form_field form.amount %}
+ {% yaml_form_field form.weight_unit "ym-fbox-select" %}
+ <tr>
+ <td colspan="2">
+ <a href="{% url 'index' %}"
+ data-role="button"
+ data-rel="back"
+ data-mini="true">{% trans "Cancel" %}</a>
+ <input type="submit" value="{% trans 'Save' %}" id="form-save">
+ </td>
+ </tr>
+</table>
+</form>
+{% endblock %}
diff --git a/wger/nutrition/templates/mobile/plan/view.html b/wger/nutrition/templates/mobile/plan/view.html
index 551b9f440..bf24a2e4f 100644
--- a/wger/nutrition/templates/mobile/plan/view.html
+++ b/wger/nutrition/templates/mobile/plan/view.html
@@ -70,7 +70,8 @@ $(document).ready(function() {
</a>
<a href="{% url 'mealitem-add' meal.id %}"
title="{% trans 'Add' %}"
- data-role="button">
+ data-role="button"
+ data-ajax="false">
<img src="{% static 'images/icons/add.svg' %}"
width="22"
height="22"
@@ -130,24 +131,28 @@ $(document).ready(function() {
{% for item in meal.mealitem_set.select_related %}
<li data-icon="false">
<a href="#editoptions-item-{{ item.id }}" data-rel="popup">
- {% if item.get_unit_type == MEALITEM_WEIGHT_GRAM %}{{ item.amount|floatformat:"0" }}g
- {% else %}
- {{ item.amount|floatformat:"0" }}{{ item.weight_unit.unit.name }}
- {% endif %}
- {{ item.ingredient.name }}
+ <h3>{{ item.ingredient.name }}</h3>
+ <p>
+ {% if item.get_unit_type == MEALITEM_WEIGHT_GRAM %}{{ item.amount|floatformat:"0" }}g
+ {% else %}
+ {{ item.amount|floatformat:"0" }} × {{ item.weight_unit.unit.name }}
+ {% endif %}
+ </p>
</a>
</li>
{% if forloop.last %}
<li>
- <a href="{% url 'mealitem-add' meal.id %}">{% trans "Add item to meal" %}</a>
+ <a href="{% url 'mealitem-add' meal.id %}"
+ data-ajax="false">{% trans "Add item to meal" %}</a>
</li>
{% endif %}
{% empty %}
<li>
<a href="{% url 'mealitem-add' meal.id %}"
- title="{% trans 'Add one now.' %}">
- {% trans "No items for this meal." %}
- {% trans "Add one now."%}
+ title="{% trans 'Add one now.' %}"
+ data-ajax="false">
+ {% trans "No items for this meal." %}<br>
+ {% trans "Add one now." %}
</a>
</li>
{% endfor %}
@@ -155,7 +160,7 @@ $(document).ready(function() {
{% empty %}
<a href="{% url 'meal-add' plan.id %}"
data-role="button">
- {% trans "No meals for this plan." %}
+ {% trans "No meals for this plan." %}<br>
{% trans "Add one now." %}
</a>
{% endfor %}