Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Move the nutrition plan page to boostrap

Roland Geider503554a269ed
diff --git a/wger/nutrition/templates/mobile/meal_item/edit.html b/wger/nutrition/templates/mobile/meal_item/edit.html
deleted file mode 100644
index b6a07c218..000000000
--- a/wger/nutrition/templates/mobile/meal_item/edit.html
+++ /dev/null
@@ -1,59 +0,0 @@
-{% extends "base.html" %}
-{% 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">
-{% 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>
-
-
-
- {% render_form_field form.amount %}
- {% render_form_field form.weight_unit %}
- <tr>
- <td colspan="2">
- <a href="{% url 'core: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 9942eb520..a0d1ebdde 100644
--- a/wger/nutrition/templates/mobile/plan/view.html
+++ b/wger/nutrition/templates/mobile/plan/view.html
@@ -1,6 +1,5 @@
{% extends "base.html" %}
-{% load i18n %}
-{% load staticfiles %}
+{% load i18n staticfiles wger_extras %}
{% block title %}{% trans "Nutrition plan" %} – {{ plan.creation_date}}{% endblock %}
@@ -42,154 +41,158 @@ $(document).ready(function() {
{% for meal in plan.meal_set.select_related %}
-<div data-role="popup"
- id="editoptions-meal-{{ meal.id }}"
- data-theme="d"
- data-overlay-theme="a">
- <div data-role="header" data-theme="b">
- <h3>{% trans "Options" %}</h3>
+<div class="modal fade" id="editoptions-meal-{{ meal.id }}">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">
+ {% trans "Options" %} –
+ </h4>
+ </div>
+ <div class="modal-body">
+ <a href="{% url 'wger.nutrition.views.meal.delete_meal' meal.id %}"
+ title="{% trans 'Delete' %}"
+ {% auto_link_css flavour %}>
+ <img src="{% static 'images/icons/trash.svg' %}"
+ width="22"
+ height="22"
+ alt="{% trans 'Delete meal' %}"
+ title="{% trans 'Delete meal' %}">
+ {% trans "Delete meal" %}
+ </a>
+ <a href="{% url 'meal-edit' meal.id %}"
+ title="{% trans 'Edit' %}"
+ {% auto_link_css flavour %}>
+ <img src="{% static 'images/icons/edit.svg' %}"
+ width="22"
+ height="22"
+ alt="{% trans 'Edit meal' %}"
+ title="{% trans 'Edit meal' %}">
+ {% trans "Edit meal" %}
+ </a>
+ <a href="{% url 'mealitem-add' meal.id %}"
+ title="{% trans 'Add' %}"
+ {% auto_link_css flavour %}>
+ <img src="{% static 'images/icons/add.svg' %}"
+ width="22"
+ height="22"
+ alt="{% trans 'Add item to meal' %}"
+ title="{% trans 'Add item to meal' %}">
+ {% trans "Add item to meal" %}
+ </a>
+ </div>
+ </div>
</div>
-
- <div role="main" class="ui-content">
- <a href="{% url 'wger.nutrition.views.meal.delete_meal' meal.id %}"
- title="{% trans 'Delete' %}"
- data-role="button">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="22"
- height="22"
- alt="{% trans 'Delete meal' %}"
- title="{% trans 'Delete meal' %}">
- {% trans "Delete meal" %}
- </a>
- <a href="{% url 'meal-edit' meal.id %}"
- title="{% trans 'Edit' %}"
- data-role="button">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="22"
- height="22"
- alt="{% trans 'Edit meal' %}"
- title="{% trans 'Edit meal' %}">
- {% trans "Edit meal" %}
- </a>
- <a href="{% url 'mealitem-add' meal.id %}"
- title="{% trans 'Add' %}"
- data-role="button"
- data-ajax="false">
- <img src="{% static 'images/icons/add.svg' %}"
- width="22"
- height="22"
- alt="{% trans 'Add item to meal' %}"
- title="{% trans 'Add item to meal' %}">
- {% trans "Add item to meal" %}
- </a>
- </div>
</div>
-{% for item in meal.mealitem_set.select_related %}
- <div data-role="popup"
- id="editoptions-item-{{ item.id }}"
- data-theme="d"
- data-overlay-theme="a">
- <div data-role="header" data-theme="b">
- <h3>{% trans "Options" %}</h3>
- </div>
- <div role="main" class="ui-content">
- <h3>{{item.ingredient}}</h3>
- <table>
- <thead>
- <tr>
- <th colspan="2">{% trans "Nutritional data" %}</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{% trans "Energy" %}</td>
- <td class="align-right">{{item.get_nutritional_values.energy|floatformat}} kcal</td>
- </tr>
- <tr>
- <td>{% trans "Protein" %}</td>
- <td class="align-right">{{item.get_nutritional_values.protein|floatformat}} g</td>
- </tr>
- <tr>
- <td>{% trans "Carbohydrates" %}</td>
- <td class="align-right">{{item.get_nutritional_values.carbohydrates|floatformat}} g</td>
- </tr>
- <tr>
- <td>{% trans "Fat" %}</td>
- <td class="align-right">{{item.get_nutritional_values.fat|floatformat}} g</td>
- </tr>
- </tbody>
- </table>
-
- <a href="{% url 'wger.nutrition.views.meal_item.delete_meal_item' item.id %}"
- title="{% trans 'Delete' %}"
- data-role="button">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Delete' %}">
- {% trans "Delete" %}
- </a>
- <a href="{% url 'mealitem-edit' item.id %}"
- title="{% trans 'Edit' %}"
- data-role="button">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Edit' %}">
- {% trans "Edit" %}
- </a>
- </div>
+
+{% for item in meal.mealitem_set.select_related %}
+ <div class="modal fade" id="editoptions-item-{{ item.id }}">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">
+ {% trans "Options" %}
+ </h4>
+ </div>
+ <div class="modal-body">
+ <h3>{{item.ingredient}}</h3>
+
+ <table class="table">
+ <thead>
+ <tr>
+ <th colspan="2">{% trans "Nutritional data" %}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{% trans "Energy" %}</td>
+ <td class="align-right">{{item.get_nutritional_values.energy|floatformat}} kcal</td>
+ </tr>
+ <tr>
+ <td>{% trans "Protein" %}</td>
+ <td class="align-right">{{item.get_nutritional_values.protein|floatformat}} g</td>
+ </tr>
+ <tr>
+ <td>{% trans "Carbohydrates" %}</td>
+ <td class="align-right">{{item.get_nutritional_values.carbohydrates|floatformat}} g</td>
+ </tr>
+ <tr>
+ <td>{% trans "Fat" %}</td>
+ <td class="align-right">{{item.get_nutritional_values.fat|floatformat}} g</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <a href="{% url 'wger.nutrition.views.meal_item.delete_meal_item' item.id %}"
+ title="{% trans 'Delete' %}"
+ {% auto_link_css flavour %}>
+ <img src="{% static 'images/icons/trash.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Delete' %}">
+ {% trans "Delete" %}
+ </a>
+ <a href="{% url 'mealitem-edit' item.id %}"
+ title="{% trans 'Edit' %}"
+ {% auto_link_css flavour %}>
+ <img src="{% static 'images/icons/edit.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Edit' %}">
+ {% trans "Edit" %}
+ </a>
+ </div>
+ </div>
+ </div>
</div>
+
{% endfor %}
{% endfor %}
{% for meal in plan.meal_set.select_related %}
-<ul data-role="listview"
- data-split-icon="grid"
- data-split-theme="b"
- style="margin-top: 3em;">
+<div class="list-group">
- <li data-theme="b" data-icon="false">
- <a href="#editoptions-meal-{{ meal.id }}" data-rel="popup">
+ <a href="#editoptions-meal-{{ meal.id }}" class="list-group-item active" data-toggle="modal">
+ <span class="glyphicon glyphicon-cog pull-right"></span>
{% trans "Nr."%} {{ forloop.counter }}
- {% if meal.time %} &ndash; {{meal.time|time:"H:i"}}{% endif %}
- </a>
- </li>
+ {% if meal.time %} &ndash; {{meal.time|time:"H:i"}}{% endif %}
+ </a>
+
{% for item in meal.mealitem_set.select_related %}
- <li data-icon="false">
- <a href="#editoptions-item-{{ item.id }}" data-rel="popup">
- <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>
+ <a href="#editoptions-item-{{ item.id }}" data-toggle="modal" class="list-group-item wger-list-group-item">
+ <span class="glyphicon glyphicon-cog pull-right"></span>
+ <h4>{{ item.ingredient.name }}</h4>
+ <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>
{% if forloop.last %}
- <li>
- <a href="{% url 'mealitem-add' meal.id %}"
- data-ajax="false">{% trans "Add item to meal" %}</a>
- </li>
+ <a href="{% url 'mealitem-add' meal.id %}"
+ class="list-group-item list-group-item-success">
+ <span class="glyphicon glyphicon-plus"></span>
+ {% trans "Add item to meal" %}
+ </a>
{% endif %}
{% empty %}
- <li>
<a href="{% url 'mealitem-add' meal.id %}"
title="{% trans 'Add one now.' %}"
- data-ajax="false">
+ class="list-group-item list-group-item-success">
{% trans "No items for this meal." %}<br>
{% trans "Add one now." %}
</a>
- </li>
{% endfor %}
-</ul>
+</div>
{% empty %}
<a href="{% url 'meal-add' plan.id %}"
data-role="button">
@@ -200,8 +203,7 @@ $(document).ready(function() {
<p style="margin-top:2em;">
<a href="{% url 'meal-add' plan.id %}"
- data-role="button"
- data-mini="true">{% trans "Add a new meal" %}</a>
+ {% auto_link_css flavour %}>{% trans "Add a new meal" %}</a>
</p>
@@ -233,7 +235,7 @@ $(document).ready(function() {
{% block sidebar %}
<h3>{% trans "Energy" %}</h3>
-<table id="nutritional-data-energy">
+<table id="nutritional-data-energy" class="table">
<thead>
<tr>
<th>{% trans "Energy" %}</th>
@@ -263,7 +265,7 @@ $(document).ready(function() {
{% endif %}
<h3>{% trans "Nutritional data" %}</h3>
-<table>
+<table class="table table-condensed">
<thead>
<tr style="height:4em;">
<th>{% trans "Macronutrients" %}</th>
@@ -333,8 +335,7 @@ $(document).ready(function() {
<h3>{% trans "Options" %}</h3>
<a href="{% url 'wger.nutrition.views.plan.export_pdf' plan.id %}"
- class="pdf-button"
- data-role="button">
+ {% auto_link_css flavour "pdf-button" %}>
<img src="{% static 'images/icons/save.svg' %}"
width="32"
height="32"
@@ -344,7 +345,7 @@ $(document).ready(function() {
</a>
<a href="{% url 'nutrition-edit' plan.id %}"
- data-role="button">
+ {% auto_link_css flavour %}>
<img src="{% static 'images/icons/edit.svg' %}"
width="32"
height="32"
@@ -353,7 +354,7 @@ $(document).ready(function() {
</a>
<a href="{% url 'nutrition-copy' plan.id %}"
- data-role="button">
+ {% auto_link_css flavour %}>
<img src="{% static 'images/icons/copy.svg' %}"
width="32"
height="32"
@@ -362,7 +363,7 @@ $(document).ready(function() {
</a>
<a href="{% url 'nutrition-delete' plan.id %}"
- data-role="button">
+ {% auto_link_css flavour %}>
<img src="{% static 'images/icons/trash.svg' %}"
width="32"
height="32"