Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Refactor the form rendering tag filters to use bootstrap CSS

Roland Geider3ebf411950c9
diff --git a/wger/core/static/css/custom-yaml.css b/wger/core/static/css/custom-yaml.css
index 114635929..822655a86 100644
--- a/wger/core/static/css/custom-yaml.css
+++ b/wger/core/static/css/custom-yaml.css
@@ -48,23 +48,6 @@ nav {
}
-tr:hover .editoptions, tbody tr:hover td .editoptions, ul:hover .editoptions
-{
- visibility: visible;
-}
-
-
-/*
- * Deactivate the default background color on hover
- */
-.editoptions a:hover,
-.ui-tabs-nav a:hover,
-.ui-tabs-nav a:focus,
-.ajax-exercise-select a:hover,
-.no-hover a:hover,
-.no-hover:hover {
- background-color: transparent;
-}
/*
diff --git a/wger/core/static/css/jquery-ui-custom.css b/wger/core/static/css/jquery-ui-custom.css
index 33b4a9a9d..f22168911 100644
--- a/wger/core/static/css/jquery-ui-custom.css
+++ b/wger/core/static/css/jquery-ui-custom.css
@@ -31,3 +31,7 @@
overflow-x: hidden; /* prevent horizontal scrollbar */
}
+/* Increase the z-index so bootstrap's modals, etc. don't interfere */
+.ui-front {
+ z-index: 9999;
+}
\ No newline at end of file
diff --git a/wger/core/static/css/workout-manager.css b/wger/core/static/css/workout-manager.css
index 773fae436..3f6e37f02 100644
--- a/wger/core/static/css/workout-manager.css
+++ b/wger/core/static/css/workout-manager.css
@@ -85,7 +85,9 @@ a img{
cursor:move
}
-
+/**************************************************************
+ * Mouse hover options
+ **************************************************************/
/*
* Hide the edit options (edit, delete) on tables, only show them when the mouse is over the row
*/
@@ -94,6 +96,25 @@ a img{
visibility: hidden;
}
+tr:hover .editoptions, tbody tr:hover td .editoptions, ul:hover .editoptions
+{
+ visibility: visible;
+}
+
+
+/*
+ * Deactivate the default background color on hover
+ */
+.editoptions a:hover,
+.ui-tabs-nav a:hover,
+.ui-tabs-nav a:focus,
+.ajax-exercise-select a:hover,
+.no-hover a:hover,
+.no-hover:hover {
+ background-color: transparent;
+}
+
+
/*
* Images inside a link are set to greyscale till mouseover
*/
@@ -165,19 +186,12 @@ div.muscle-background
/*
* Workout log entry page needs the horizontal space
*/
-.workout-log-table .narrow-input
-{
- width: 3em;
-
-}
-
-.ym-form .workout-log-table div.ym-fbox-text{
- padding: 0em;
+.workout-log-table .narrow-input {
+ width: 4em;
}
-.ym-form .workout-log-table td{
- padding-left: 0em;
- padding-right: 0em;
+.workout-log-table .form-control {
+ display: inline;
}
diff --git a/wger/core/static/js/workout-manager.js b/wger/core/static/js/workout-manager.js
index 3a74547e4..737d62e7a 100644
--- a/wger/core/static/js/workout-manager.js
+++ b/wger/core/static/js/workout-manager.js
@@ -289,7 +289,7 @@ function hex_random() {
*/
function add_exercise(exercise) {
var result_div = '<div id="DIV-ID" class="ajax-exercise-select"> \
-<a href="#" data-role="button"> \
+<a href="#" data-role="button" class="btn btn-default btn-xs"> \
<img src="/static/images/icons/status-off.svg" \
width="14" \
height="14" \
diff --git a/wger/core/templates/delete.html b/wger/core/templates/delete.html
index b59870cd2..aca1a8ce5 100644
--- a/wger/core/templates/delete.html
+++ b/wger/core/templates/delete.html
@@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load i18n %}
-{% load staticfiles %}
+{% load staticfiles %}
+{% load wger_extras %}
<!--
Title
@@ -14,16 +15,25 @@
{% block content %}
<form action="{{form_action}}"
method="post"
- class="ym-form">
+ class="form-horizontal">
{% csrf_token %}
- <img src="{% static 'images/icons/warning.svg' %}"
+
+ <div class="form-group">
+ <div class="col-md-3">
+ <img src="{% static 'images/icons/warning.svg' %}"
width="48"
height="48"
- class="flexible float-left"
- alt="{% trans "Are you sure you want to delete this? This action cannot be undone." %}">
- <p>{% trans "Are you sure you want to delete this? This action cannot be undone." %}</p>
- <p>{{ delete_message }}</p>
- <p><input type="submit" value="{% trans 'Delete' %}"></p>
+ alt="{% trans 'Are you sure you want to delete this? This action cannot be undone.' %}">
+ </div>
+
+ <div class="col-md-9">
+ {% trans "Are you sure you want to delete this? This action cannot be undone." %}
+ {{ delete_message }}
+ </div>
+ </div>
+
+ {% trans 'Yes, delete' as submit_text %}
+ {% render_form_submit submit_text 'danger' %}
</form>
{% endblock %}
diff --git a/wger/core/templates/form.html b/wger/core/templates/form.html
index babc2c74b..4d3e9c85f 100644
--- a/wger/core/templates/form.html
+++ b/wger/core/templates/form.html
@@ -19,34 +19,12 @@
{% block content %}
-
<form action="{{form_action}}"
method="post"
class="form-horizontal"
role="form"
{% if enctype %}enctype="{{enctype}}"{% endif %}>
- {% csrf_token %}
-
- {% if form.non_field_errors %}
- <div class="has-error">
- {% for error in form.non_field_errors %}
- <p>{% trans error %}</p>
- {% endfor %}
- </div>
- {% endif %}
-
- {% for current_field in form_fields %}
- {% yaml_form_field current_field %}
- {% endfor %}
-
- <div class="form-group">
- <div class="row">
- <div class="col-md-offset-3 col-md-9">
- <input type="submit" value="{{submit_text}}" id="form-save" class="btn btn-default btn-block">
- </div>
- </div>
- </div>
-
+ {% render_form_fields form %}
</form>
{% endblock %}
diff --git a/wger/core/templates/mobile/delete.html b/wger/core/templates/mobile/delete.html
index ce30c3c90..48e970890 100644
--- a/wger/core/templates/mobile/delete.html
+++ b/wger/core/templates/mobile/delete.html
@@ -13,14 +13,13 @@
-->
{% block content %}
<form action="{{form_action}}"
- method="post"
- class="ym-form">
+ method="post">
{% csrf_token %}
<img src="{% static 'images/icons/warning.svg' %}"
width="48"
height="48"
class="flexible float-left"
- alt="{% trans "Are you sure you want to delete this? This action cannot be undone." %}">
+ alt="{% trans 'Are you sure you want to delete this? This action cannot be undone.' %}">
<p>{% trans "Are you sure you want to delete this? This action cannot be undone." %}</p>
<p>{{ delete_message }}</p>
<p>
diff --git a/wger/core/templates/mobile/form.html b/wger/core/templates/mobile/form.html
index ad46e99dd..6e851725b 100644
--- a/wger/core/templates/mobile/form.html
+++ b/wger/core/templates/mobile/form.html
@@ -28,7 +28,6 @@
<form action="{{form_action}}"
enctype="multipart/form-data"
method="post"
- class="ym-form"
data-ajax="false">
{% csrf_token %}
@@ -42,7 +41,7 @@
<table>
{% for current_field in form_fields %}
- {% yaml_form_field current_field %}
+ {% render_form_field current_field %}
{% endfor %}
<tr>
<td colspan="2">
diff --git a/wger/core/templates/mobile/user/login.html b/wger/core/templates/mobile/user/login.html
index af6a93110..e1fd895ac 100644
--- a/wger/core/templates/mobile/user/login.html
+++ b/wger/core/templates/mobile/user/login.html
@@ -12,7 +12,6 @@
{% block content %}
<form action="{% url 'core:login' %}"
method="post"
- class="ym-form"
data-ajax="false">
{% csrf_token %}
<div class="ym-fbox-text ym-error">
@@ -22,8 +21,8 @@
</div>
<input type="hidden" name="next" value="{{next}}">
<table>
-{% yaml_form_field form.username %}
-{% yaml_form_field form.password %}
+{% render_form_field form.username %}
+{% render_form_field form.password %}
<tr>
<td colspan="2">
<input type="submit" value="{% trans 'Login' %}" id="form-save">
diff --git a/wger/core/templates/mobile/user/preferences.html b/wger/core/templates/mobile/user/preferences.html
index c6519eb09..89a5d8ef2 100644
--- a/wger/core/templates/mobile/user/preferences.html
+++ b/wger/core/templates/mobile/user/preferences.html
@@ -8,8 +8,7 @@
{% block content %}
<form action="{% url 'core:preferences' %}"
- method="post"
- class="ym-form">
+ method="post">
{% csrf_token %}
{{ form.non_field_errors }}
@@ -17,30 +16,30 @@
<div data-role="collapsible" data-collapsed="false">
<h3>{% trans "Email" %}</h3>
<table>
- {% yaml_form_field email_form.email %}
+ {% render_form_field email_form.email %}
</table>
</div>
<div data-role="collapsible">
<h3>{% trans "Workout reminders" %}</h3>
<table>
- {% yaml_form_field form.workout_reminder_active %}
- {% yaml_form_field form.workout_duration %}
- {% yaml_form_field form.workout_reminder %}
+ {% render_form_field form.workout_reminder_active %}
+ {% render_form_field form.workout_duration %}
+ {% render_form_field form.workout_reminder %}
</table>
</div>
<div data-role="collapsible">
<h3>{% trans "Gym mode" %}</h3>
<table>
- {% yaml_form_field form.timer_active %}
- {% yaml_form_field form.timer_pause %}
+ {% render_form_field form.timer_active %}
+ {% render_form_field form.timer_pause %}
</table>
</div>
<div data-role="collapsible">
<h3>{% trans "Other settings" %}</h3>
<table>
- {% yaml_form_field form.notification_language %}
- {% yaml_form_field form.show_comments %}
- {% yaml_form_field form.show_english_ingredients %}
+ {% render_form_field form.notification_language %}
+ {% render_form_field form.show_comments %}
+ {% render_form_field form.show_english_ingredients %}
</table>
</div>
</div>
diff --git a/wger/core/templates/user/change_password.html b/wger/core/templates/user/change_password.html
index 3077eb5bb..ae58a05bf 100644
--- a/wger/core/templates/user/change_password.html
+++ b/wger/core/templates/user/change_password.html
@@ -8,18 +8,11 @@
{% block content %}
<form action="{% url 'core:change-password' %}"
method="post"
- class="ym-form">
- {% csrf_token %}
- {{ form.non_field_errors }}
-<table>
-{% yaml_form_field form.old_password %}
-{% yaml_form_field form.new_password1 %}
-{% yaml_form_field form.new_password2 %}
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Change password' %}" id="form-save">
- </td>
- </tr>
+ class="form-horizontal"
+ role="form">
+
+ {% trans 'Change password' as submit_text %}
+ {% render_form_fields form submit_text %}
</table>
</form>
{% endblock %}
diff --git a/wger/core/templates/user/login.html b/wger/core/templates/user/login.html
index 788e147fd..77936836b 100644
--- a/wger/core/templates/user/login.html
+++ b/wger/core/templates/user/login.html
@@ -14,23 +14,9 @@
{% block content %}
<form action="{% url 'core:login' %}"
method="post"
- class="ym-form">
- {% csrf_token %}
- <div class="ym-fbox-text ym-error">
- <div class="ym-message">
- {{ form.non_field_errors }}
- </div>
- </div>
- <input type="hidden" name="next" value="{{next}}">
-<table>
-{% yaml_form_field form.username %}
-{% yaml_form_field form.password %}
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Login' %}" id="form-save">
- </td>
- </tr>
-</table>
+ class="form-horizontal">
+ {% trans 'Login' as submit_text %}
+ {% render_form_fields form submit_text %}
</form>
{% if not hide_persona %}
diff --git a/wger/core/templates/user/password_reset_confirm.html b/wger/core/templates/user/password_reset_confirm.html
index d886e1f3b..b64926434 100644
--- a/wger/core/templates/user/password_reset_confirm.html
+++ b/wger/core/templates/user/password_reset_confirm.html
@@ -14,18 +14,9 @@
<form action=""
method="post"
- class="ym-form">
- {% csrf_token %}
-
- <table>
- {% yaml_form_field form.new_password1 %}
- {% yaml_form_field form.new_password2 %}
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Change my password' %}" id="form-save">
- </td>
- </tr>
- </table>
+ class="form-horizonal">
+ {% trans 'Change my password' as submit_text %}
+ {% render_form_fields form submit_text %}
</form>
{% else %}
diff --git a/wger/core/templates/user/password_reset_form.html b/wger/core/templates/user/password_reset_form.html
index 00d59e710..e2e21fdba 100644
--- a/wger/core/templates/user/password_reset_form.html
+++ b/wger/core/templates/user/password_reset_form.html
@@ -8,16 +8,8 @@
{% block content %}
<form action=""
method="post"
- class="ym-form">
- {% csrf_token %}
- {{ form.non_field_errors }}
-<table>
-{% yaml_form_field form.email %}
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Send' %}" id="form-save">
- </td>
- </tr>
-</table>
+ class="form-horizonal">
+ {% trans 'Change my password' as submit_text %}
+ {% render_form_fields form submit_text %}
</form>
{% endblock %}
diff --git a/wger/core/templates/user/preferences.html b/wger/core/templates/user/preferences.html
index d7dcc8f57..748ab0b9d 100644
--- a/wger/core/templates/user/preferences.html
+++ b/wger/core/templates/user/preferences.html
@@ -36,7 +36,7 @@ $(function() {
</div>
<div id="collapseEmail" class="panel-collapse collapse in">
<div class="panel-body">
- {% yaml_form_field email_form.email %}
+ {% render_form_field email_form.email %}
</div>
</div>
</div>
@@ -52,9 +52,9 @@ $(function() {
</div>
<div id="collapseReminder" class="panel-collapse collapse">
<div class="panel-body">
- {% yaml_form_field form.workout_reminder_active %}
- {% yaml_form_field form.workout_duration %}
- {% yaml_form_field form.workout_reminder %}
+ {% render_form_field form.workout_reminder_active %}
+ {% render_form_field form.workout_duration %}
+ {% render_form_field form.workout_reminder %}
</div>
</div>
</div>
@@ -69,8 +69,8 @@ $(function() {
</div>
<div id="collapseGymMode" class="panel-collapse collapse">
<div class="panel-body">
- {% yaml_form_field form.timer_active %}
- {% yaml_form_field form.timer_pause %}
+ {% render_form_field form.timer_active %}
+ {% render_form_field form.timer_pause %}
</div>
</div>
</div>
@@ -86,9 +86,9 @@ $(function() {
</div>
<div id="collapseOther" class="panel-collapse collapse">
<div class="panel-body">
- {% yaml_form_field form.notification_language "ym-fbox-select" %}
- {% yaml_form_field form.show_comments %}
- {% yaml_form_field form.show_english_ingredients %}
+ {% render_form_field form.notification_language %}
+ {% render_form_field form.show_comments %}
+ {% render_form_field form.show_english_ingredients %}
</div>
</div>
</div>
diff --git a/wger/exercises/static/js/exercises.js b/wger/exercises/static/js/exercises.js
index db5cc49de..b73808830 100644
--- a/wger/exercises/static/js/exercises.js
+++ b/wger/exercises/static/js/exercises.js
@@ -178,7 +178,7 @@ function weight_log_chart(data, div_id, reps_i18n, width_factor) {
svg.selectAll(".dot" + temp_name)
.data(d.values)
.enter().append("circle")
- .attr("class", "dot modal-dialog " + color_class)
+ .attr("class", "dot wger-modal-dialog " + color_class)
.attr("cx", line.x())
.attr("cy", line.y())
.attr("id", function(d) { return d.log_id; })
diff --git a/wger/manager/templates/day/log.html b/wger/manager/templates/day/log.html
index f402e838d..a01af56af 100644
--- a/wger/manager/templates/day/log.html
+++ b/wger/manager/templates/day/log.html
@@ -9,7 +9,6 @@
<script type="text/javascript">
$(document).ready(function () {
$( "#id_date" ).datepicker();
-
get_workout_session();
});
</script>
@@ -17,83 +16,61 @@ $(document).ready(function () {
{% endblock %}
{% block content %}
-<form action="{{form_action}}" method="POST" class="ym-form" style="overflow-x: auto;">
-{% csrf_token %}
-{{formset.management_form}}
-
-{% if session_form.non_field_errors %}
-<div class="ym-fbox-text ym-error">
- {% for error in session_form.non_field_errors %}
- <p class="ym-message">{% trans error %}</p>
- {% endfor %}
-</div>
-{% endif %}
-
-<table class="workout-log-table">
-{% yaml_form_field dateform.date %}
+<form action="{{form_action}}" method="POST" class="form-horizontal">
+ {% csrf_token %}
+ {{formset.management_form}}
-{% for field in session_form %}
- {% if field.name == 'impression' %}
- {% yaml_form_field field "ym-fbox-select" %}
- {% else %}
- {% yaml_form_field field %}
- {% endif %}
-{% endfor %}
-</table>
+ {% render_form_errors session_form %}
+ {% render_form_field dateform.date %}
-<h3>{% trans "Exercises" %}</h3>
-<table class="workout-log-table">
-
-{% for set in day.set_set.select_related %}
-{% for exercise in set.exercises.select_related %}
- {% with value=exercises|get_item:exercise.id %}
- <tr>
- <td style="max-width: 5em; padding-right:0.4em;">
- {{value.obj.name}}
- </td>
-
- {% for form in value.forms %}
- <td class="narrow-input">
- <div class= "ym-fbox-text narrow-input {% if form.reps.errors %}ym-error{% endif %}">
- {{form.reps}}
- </div>
+ {% for field in session_form %}
+ {% render_form_field field %}
+ {% endfor %}
- <div class="ym-fbox-text narrow-input {% if form.reps.errors %}ym-error{% endif %}">
- <span class="ym-message">{% trans "Reps" %}</span>
- </div>
- </td>
- <td>
- <div class= "ym-fbox-text narrow-input {% if form.weight.errors %}ym-error{% endif %}">
- {{form.weight}}
- </div>
- <div class="ym-fbox-text narrow-input {% if form.weight.errors %}ym-error{% endif %}" >
- <span class="ym-message">kg.</span>
+ <div style="overflow-x: auto;margin-bottom: 1em;">
+ {% for set in day.set_set.select_related %}
+ {% for exercise in set.exercises.select_related %}
+ {% with value=exercises|get_item:exercise.id %}
+ <div class="form-group workout-log-table {% if field.errors %}has-error{% endif %}">
+ <div {% if field.errors %}class="has-error has-feedback"{% endif %}>
+ <label class="col-md-3 control-label">
+ {{value.obj.name}}
+ </label>
+
+ <div class="col-md-9">
+ <table class="table">
+ <tr>
+ {% for form in value.forms %}
+ <td>
+ {{ form.reps|form_field_add_css:'form-control narrow-input' }}
+ </td>
+ <td>
+ {{ form.weight|form_field_add_css:'form-control narrow-input' }}
+ </td>
+ {% endfor %}
+ </tr>
+ <tr>
+ {% for form in value.forms %}
+ <td>{% trans "Reps" %}</td>
+ <td>{% trans "kg." %}</td>
+ {% endfor %}
+ </tr>
+ </table>
+ </div>
</div>
- </td>
- {% endfor %}
- </tr>
- {% endwith %}
-{% endfor %}
-{% empty %}
-<tr>
- <td>
+ </div>
+ {% endwith %}
+ {% endfor %}
+ {% empty %}
{% trans "Add exercises to this training day before adding a log." %}
-
<br>
<a href="{% url 'workout-view' day.training.id %}">{% trans "Back to workout" %}</a>
- </td>
-</tr>
-{% endfor %}
-</table>
+ {% endfor %}
+ </div>
+
+ {% render_form_submit %}
-<table>
-<tr>
- <td style="text-align:center;">
- <input type="submit" value="{% trans 'Save' %}" id="form-save" style="width: 95%;">
- </td>
-</tr>
-</table>
</form>
{% endblock %}
diff --git a/wger/manager/templates/mobile/day/log.html b/wger/manager/templates/mobile/day/log.html
index 9c9c9f983..e4bfeb2e6 100644
--- a/wger/manager/templates/mobile/day/log.html
+++ b/wger/manager/templates/mobile/day/log.html
@@ -17,7 +17,6 @@ $(document).ready(function () {
{% block content %}
<form action="{{form_action}}"
method="POST"
- class="ym-form"
style="overflow-x: auto;"
data-ajax="false">
{% csrf_token %}
@@ -32,13 +31,13 @@ $(document).ready(function () {
{% endif %}
<table class="workout-log-table">
-{% yaml_form_field dateform.date %}
+{% render_form_field dateform.date %}
{% for field in session_form %}
{% if field.name == 'impression' %}
- {% yaml_form_field field "ym-fbox-select" %}
+ {% render_form_field field %}
{% else %}
- {% yaml_form_field field %}
+ {% render_form_field field %}
{% endif %}
{% endfor %}
</table>
diff --git a/wger/manager/templates/mobile/set/add.html b/wger/manager/templates/mobile/set/add.html
index d6e616468..21f95c32f 100644
--- a/wger/manager/templates/mobile/set/add.html
+++ b/wger/manager/templates/mobile/set/add.html
@@ -33,12 +33,11 @@ $(document).on('pageinit', function(){
{% block content %}
<form action="{{form_action}}"
- method="post"
- class="ym-form">
+ method="post">
{% csrf_token %}
<table>
- {% yaml_form_field form.exercise_list %}
+ {% render_form_field form.exercise_list %}
<tr>
<td colspan="2">
<div id="exercise-search-log"></div>
diff --git a/wger/manager/templates/mobile/set/edit.html b/wger/manager/templates/mobile/set/edit.html
index cf71e9635..befd5a653 100644
--- a/wger/manager/templates/mobile/set/edit.html
+++ b/wger/manager/templates/mobile/set/edit.html
@@ -17,8 +17,7 @@
<form action="{{form_action}}"
- method="post"
- class="ym-form">
+ method="post">
{% csrf_token %}
<table>
@@ -41,5 +40,5 @@
</td>
</tr>
</table>
-
+</form>
{% endblock %}
diff --git a/wger/manager/templates/mobile/tags/yaml_form_element.html b/wger/manager/templates/mobile/tags/render_form_element.html
similarity index 100%
rename from wger/manager/templates/mobile/tags/yaml_form_element.html
rename to wger/manager/templates/mobile/tags/render_form_element.html
diff --git a/wger/manager/templates/set/add.html b/wger/manager/templates/set/add.html
index 0f9186dd2..bc1c9370b 100644
--- a/wger/manager/templates/set/add.html
+++ b/wger/manager/templates/set/add.html
@@ -31,43 +31,44 @@ function custom_page_init()
<form action="{{form_action}}"
method="post"
- class="ym-form">
+ class="form-horizontal">
-{% csrf_token %}
-<table>
- {% yaml_form_field form.exercises %}
- <tr>
- <td style="text-align:right;">
- <label for="slider">{{form.sets.label}}</label>
- </td>
- <td>
+ {% csrf_token %}
+ {% render_form_field form.exercises %}
+ <div class="form-group">
+ <label for="slider" class="col-md-3 control-label">
+ {{form.sets.label}}
+ </label>
+
+ <div class="col-md-9">
<div id="slider"></div>
<span id="slider-show">{{form.sets.value}}</span>
<input type="hidden" id="id_sets" name="sets" value="{{ form.sets.value }}">
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <p class="dimmed">{% blocktrans %}If you do the same repetitions for all sets,
+ </div>
+ </div>
+
+
+ <div class="form-group">
+ <label class="col-md-3 control-label">
+ {% trans "Repetitions "%}
+ </label>
+ <div class=" col-md-9">
+ <span class="help-block">{% blocktrans %}If you do the same repetitions for all sets,
you can just enter one value: e.g. for 4 sets just enter one "10" for the repetitions, this
-automatically becomes "4 x 10".{% endblocktrans %}</p>
- </td>
- </tr>
+automatically becomes "4 x 10".{% endblocktrans %}</span>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-md-offset-3 col-md-9">
+ <div id="formsets">
+ {% for formset in formsets %}
+ {% include 'set/formset.html' with exercise=formset.exercise formset=formset.formset %}
+ {% endfor %}
+ </div>
+ </div>
+ </div>
+
- <tr>
- <td colspan="2">
- <div id="formsets">
- {% for formset in formsets %}
- {% include 'set/formset.html' with exercise=formset.exercise formset=formset.formset %}
- {% endfor %}
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Save' %}" id="form-save">
- </td>
- </tr>
-</table>
+ {% render_form_submit %}
</form>
{% endblock %}
\ No newline at end of file
diff --git a/wger/manager/templates/set/edit.html b/wger/manager/templates/set/edit.html
index 48fae5dd5..d4878bdbd 100644
--- a/wger/manager/templates/set/edit.html
+++ b/wger/manager/templates/set/edit.html
@@ -14,28 +14,22 @@
Main Content
-->
{% block content %}
-
-
<form action="{{form_action}}"
method="post"
- class="ym-form">
-
-{% csrf_token %}
-<table>
- <tr>
- <td colspan="2">
- <div id="formsets">
- {% for formset in formsets %}
- {% include 'set/formset.html' with exercise=formset.exercise formset=formset.formset %}
- {% endfor %}
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Save' %}" id="form-save">
- </td>
- </tr>
-</table>
-
-{% endblock %}
+ class="form-horizontal">
+
+ {% csrf_token %}
+ <div class="form-group">
+ <label class="col-md-3 control-label">
+ {% trans "Repetitions "%}
+ </label>
+ <div class="col-md-9">
+ {% for formset in formsets %}
+ {% include 'set/formset.html' with exercise=formset.exercise formset=formset.formset %}
+ {% endfor %}
+ </div>
+ </div>
+
+ {% render_form_submit %}
+</form>
+{% endblock %}
\ No newline at end of file
diff --git a/wger/manager/templates/set/formset.html b/wger/manager/templates/set/formset.html
index dc672735d..fb79aacbe 100644
--- a/wger/manager/templates/set/formset.html
+++ b/wger/manager/templates/set/formset.html
@@ -4,30 +4,11 @@
<h4>{{exercise}}</h4>
{{ formset.management_form }}
{% for field in formset %}
- <div style="display:table-cell;vertical-align: middle;">
- {% for i in field %}
- {% if not i.is_hidden %}
- {% if forloop.parentloop.first %}
- <div class="dimmed" style="display:table-row;">{{i.label}}</div>
- {% endif %}
- {% endif %}
- {% endfor %}
- </div>
<div class="ym-fbox-text {% if field.errors %}ym-error{% endif %}" style="display:table-cell;width: 5em;padding-right:0px;">
{% for i in field %}
- {{i}}
+ {{i|form_field_add_css:'form-control'}}
{% endfor %}
</div>
- <!--
- {% if field.errors %}
- <div class="ym-fbox-text ym-error">
- {% for error in field.errors %}
- <p class="ym-message">{% trans error %}</p>
- {% endfor %}
- </div>
- {% endif %}
- -->
{% endfor %}
-{# {{formset}} #}
</div>
diff --git a/wger/manager/templates/tags/render_form_element.html b/wger/manager/templates/tags/render_form_element.html
new file mode 100644
index 000000000..34085dcfa
--- /dev/null
+++ b/wger/manager/templates/tags/render_form_element.html
@@ -0,0 +1,39 @@
+{% load i18n %}
+{% load wger_extras %}
+{% if not field.is_hidden %}
+<div class="form-group {% if field.errors %}has-error{% endif %}" id="form-{{field.name}}">
+ <div {% if field.errors %}class="has-error has-feedback"{% endif %}>
+
+ <label for="{{field.auto_id}}" class="col-md-3 control-label">
+ {% trans field.label %}
+ {% if not field.field.required %}
+ <br>
+ <span style="font-size:90%;">— <em>{% trans "Optional" %}</em></span>
+ {% endif %}
+ </label>
+
+ <div class="col-md-9">
+ {% if not field|is_checkbox %}
+ {{ field|form_field_add_css:'form-control' }}
+ {% else %}
+ {{ field }}
+ {% endif %}
+
+ {% if field.errors %}
+ <span class="glyphicon glyphicon-remove form-control-feedback"></span>
+ {% endif %}
+
+ <span class="help-block">
+ {% for error in field.errors %}
+ <p>{% trans error %}</p>
+ {% endfor %}
+
+ {% if field.help_text %}{% trans field.help_text %}{% endif %}
+ </span>
+ </div>
+
+ </div>
+</div>
+{% else %}
+ {{field}}
+{% endif %}
\ No newline at end of file
diff --git a/wger/manager/templates/tags/render_form_errors.html b/wger/manager/templates/tags/render_form_errors.html
new file mode 100644
index 000000000..f925ac077
--- /dev/null
+++ b/wger/manager/templates/tags/render_form_errors.html
@@ -0,0 +1,15 @@
+{% load i18n %}
+
+{% if form.is_bound and not form.is_valid or form.non_field_errors or form.non_form_errors %}
+<div class="alert alert-danger">
+ {% blocktrans %}The form contains errors. Please verify and correct the
+data in the fields in red and submit the form again.{% endblocktrans %}
+
+ {% if form.non_field_errors %}
+ {{ form.non_field_errors }}
+ {% endif %}
+ {% if form.non_form_errors %}
+ {{ form.non_form_errors }}
+ {% endif %}
+</div>
+{% endif %}
diff --git a/wger/manager/templates/tags/render_form_fields.html b/wger/manager/templates/tags/render_form_fields.html
new file mode 100644
index 000000000..0e7f61974
--- /dev/null
+++ b/wger/manager/templates/tags/render_form_fields.html
@@ -0,0 +1,13 @@
+{% load wger_extras %}
+
+{% csrf_token %}
+
+{% render_form_errors form %}
+
+{% for field in form %}
+ {% render_form_field field %}
+{% endfor %}
+
+{% if show_save and submit_text %}
+ {% render_form_submit submit_text %}
+{% endif %}
diff --git a/wger/manager/templates/tags/render_form_submit.html b/wger/manager/templates/tags/render_form_submit.html
new file mode 100644
index 000000000..60d47f366
--- /dev/null
+++ b/wger/manager/templates/tags/render_form_submit.html
@@ -0,0 +1,7 @@
+{% load i18n %}
+
+<div class="form-group">
+ <div class="col-md-offset-3 col-md-9">
+ <input type="submit" value="{% trans save_text %}" id="form-save" class="btn btn-{{button_class}} btn-block">
+ </div>
+</div>
\ No newline at end of file
diff --git a/wger/manager/templates/tags/yaml_form_element.html b/wger/manager/templates/tags/yaml_form_element.html
deleted file mode 100644
index 4abd68f39..000000000
--- a/wger/manager/templates/tags/yaml_form_element.html
+++ /dev/null
@@ -1,35 +0,0 @@
-{% load i18n %}
-{% load wger_extras %}
-{% if not field.is_hidden %}
-<div class="form-group {% if field.errors %}has-error{% endif %}" id="form-{{field.name}}">
-
- <label for="{{field.auto_id}}" class="col-md-3 control-label">
- {% trans field.label %}
- {% if not field.field.required %}
- <br>
- <span style="font-size:90%;">— <em>{% trans "Optional" %}</em></span>
- {% endif %}
- </label>
-
- <div class="col-md-9">
- {% if not field|is_checkbox %}
- {{ field|form_field_add_css:'form-control' }}
- {% else %}
- {{ field }}
- {% endif %}
-
- <span class="help-block">
- {% for error in field.errors %}
- <p>
- <span class="glyphicon glyphicon-remove form-control-feedback"></span>
- {% trans error %}
- </p>
- {% endfor %}
- {% if field.help_text %}{% trans field.help_text %}{% endif %}
- </span>
- </div>
-
-</div>
-{% else %}
- {{field}}
-{% endif %}
\ No newline at end of file
diff --git a/wger/manager/templatetags/wger_extras.py b/wger/manager/templatetags/wger_extras.py
index d08088e6f..1c66d7fbb 100644
--- a/wger/manager/templatetags/wger_extras.py
+++ b/wger/manager/templatetags/wger_extras.py
@@ -85,7 +85,37 @@ def render_weight_log(log, div_uuid):
return {'log': log,
'div_uuid': div_uuid}
[email protected]_tag('tags/license-sidebar.html')
+def license_sidebar(license, author=None):
+ '''
+ Renders the license notice for exercises
+ '''
+
+ return {'license': license,
+ 'author': author}
+
+
[email protected]_tag('tags/language_select.html', takes_context=True)
+def language_select(context, language):
+ '''
+ Renders a link to change the current language.
+ '''
+
+ return {'language_name': language[1],
+ 'path': 'images/icons/flag-{0}.svg'.format(language[0]),
+ 'i18n_path': context['i18n_path'][language[0]]}
+
+
+def get_item(dictionary, key):
+ '''
+ Allows to access a specific key in a dictionary in a template
+ '''
+ return dictionary.get(key)
+#
+# Form utils
+#
@register.filter(name='form_field_add_css')
def form_field_add_css(field, css):
'''
@@ -106,40 +136,73 @@ def is_checkbox(field):
return field.field.widget.__class__.__name__ == CheckboxInput().__class__.__name__
[email protected]_tag('tags/yaml_form_element.html')
-def yaml_form_field(field, css_class='ym-fbox-text'):
+
[email protected]_tag('tags/render_form_element.html')
+def render_form_field(field):
'''
- Renders a form field in a <tr> with all necessary CSS
+ Renders a form field with all necessary labels, help texts and labels
+ within 'form-group'.
+
+ See bootstrap documentation for details: http://getbootstrap.com/css/#forms
'''
- return {'field': field,
- 'css_class': css_class}
+ return {'field': field}
[email protected]_tag('tags/license-sidebar.html')
-def license_sidebar(license, author=None):
- '''
- Renders the license notice for exercises
- '''
[email protected]_tag('tags/render_form_submit.html')
+def render_form_submit(save_text='Save', button_class='default'):
+ """
+ Comfort function that renders a submit button with all necessary HTML
+ and CSS
- return {'license': license,
- 'author': author}
+ :param save_text: the text to use on the submit button
+ :param button_class: CSS class to apply to the button, default 'default'
+ """
+ if button_class in ('default',
+ 'primary',
+ 'success',
+ 'info',
+ 'warning',
+ 'danger',
+ 'link'):
+ button_class = button_class
+ else:
+ button_class = 'default'
+ return {'save_text': save_text,
+ 'button_class': button_class}
[email protected]_tag('tags/language_select.html', takes_context=True)
-def language_select(context, language):
- '''
- Renders a link to change the current language.
- '''
- return {'language_name': language[1],
- 'path': 'images/icons/flag-{0}.svg'.format(language[0]),
- 'i18n_path': context['i18n_path'][language[0]]}
[email protected]_tag('tags/render_form_errors.html')
+def render_form_errors(form):
+ """
+ Renders the non-field errors of a form with all necessary HTML and CSS
+ (non-field errors refer to errors that can't be associated to any single
+ field)
+ :param form: the form object
+ """
+ return {'form': form}
-def get_item(dictionary, key):
+
[email protected]_tag('tags/render_form_fields.html')
+def render_form_fields(form, submit_text='Save', show_save=True):
'''
- Allows to access a specific key in a dictionary in a template
+ Comfort function that renders all fields in a form, as well as the submit
+ button
+
+ Internally it simply calls the other table_form_* functions and will render
+ the fields in the order they were defined. If you want to change this, you
+ need to call table_form_field for each field yourself. This function will
+ also render a hidden field with a CSRF token, so be sure to pass it to the
+ template.
+
+ It is still necessary to enclose its output in <form> tags!
+
+ :param form: the form to be rendered
+ :param save_text: the text to use on the submit button
'''
- return dictionary.get(key)
+
+ return {'form': form,
+ 'show_save': show_save,
+ 'submit_text': submit_text}
\ No newline at end of file
diff --git a/wger/nutrition/templates/bmi/form.html b/wger/nutrition/templates/bmi/form.html
index ec63c2f70..138ab2da0 100644
--- a/wger/nutrition/templates/bmi/form.html
+++ b/wger/nutrition/templates/bmi/form.html
@@ -57,28 +57,10 @@ $(document).ready(function () {
<form action="{% url 'bmi-calculate' %}"
method="post"
- class="ym-form"
+ class="form-horizontal"
id="bmi-form">
-{% csrf_token %}
-
-{% if form.non_field_errors %}
-<div class="ym-fbox-text ym-error">
- {% for error in form.non_field_errors %}
- <p class="ym-message">{% trans error %}</p>
- {% endfor %}
-</div>
-{% endif %}
-
-<table>
- {% for current_field in form %}
- {% yaml_form_field current_field %}
- {% endfor %}
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Calculate' %}" id="form-save">
- </td>
- </tr>
-</table>
+ {% trans 'Calculate' as submit_text %}
+ {% render_form_fields form submit_text %}
</form>
<div id="bmi-result-container" style="display:hidden;">
diff --git a/wger/nutrition/templates/meal_item/edit.html b/wger/nutrition/templates/meal_item/edit.html
index 2392bb256..2e182193b 100644
--- a/wger/nutrition/templates/meal_item/edit.html
+++ b/wger/nutrition/templates/meal_item/edit.html
@@ -22,40 +22,27 @@ $(document).ready(function() {
{% block content %}
<form action="{{ form_action }}"
method="post"
- class="ym-form">
-{% csrf_token %}
-{{ form.non_field_errors }}
-{{form.ingredient}}
-<table>
- <tr>
- <td style="text-align:right;">
- <label for="id_ingredient_searchfield">
+ class="form-horizontal">
+ {% csrf_token %}
+ {% render_form_errors form %}
+ {{form.ingredient}}
+
+ <div class="form-group {% if field.errors %}has-error{% endif %}" id="form-id_ingredient_searchfield">
+ <label for="id_ingredient_searchfield" class="col-md-3 control-label">
{% trans "Ingredient name" %}
- </label>
- </td>
- <td>
- <div class="ym-fbox-text">
+ </label>
+
+ <div class="col-md-9">
<input type="text"
id="id_ingredient_searchfield"
name="ingredient_searchfield"
- value="{{ingredient_searchfield}}">
- </div>
+ value="{{ingredient_searchfield}}"
+ class="form-control">
<div id="exercise_name" class="ym-fbox-text"></div>
- </td>
- </tr>
-
-
-
- {% yaml_form_field form.amount %}
- {% yaml_form_field form.weight_unit "ym-fbox-select" %}
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Save' %}" id="form-save">
- </td>
- </tr>
-</table>
+ </div>
+ </div>
+ {% render_form_field form.amount %}
+ {% render_form_field form.weight_unit %}
+ {% render_form_submit submit_text %}
</form>
-
-
-
{% endblock %}
diff --git a/wger/nutrition/templates/mobile/ingredient/view.html b/wger/nutrition/templates/mobile/ingredient/view.html
index 5147e7d3e..f5b29942a 100644
--- a/wger/nutrition/templates/mobile/ingredient/view.html
+++ b/wger/nutrition/templates/mobile/ingredient/view.html
@@ -66,8 +66,7 @@ the search.{% endblocktrans %}
<div itemscope itemtype="http://schema.org/NutritionInformation">
<meta itemprop="name" content="{{ingredient.name}}" />
-<form class="ym-form"
- method="post"
+<form method="post"
action="{% url 'ingredient-get-values' ingredient.id %}"
id="nutritional-values-form"
style="background-color: transparent; border-width: 0px; box-shadow: 0px 0px 0px 0px transparent;">
@@ -169,7 +168,7 @@ the search.{% endblocktrans %}
<td>{% trans "Sodium" %}</td>
<td itemprop="sodiumContent" id="value-sodium">
{% if ingredient.sodium %}
- <span id="value-fibres">{{ingredient.sodium}}</span> g
+ <span id="value-sodium">{{ingredient.sodium}}</span> g
{% else %}
{% trans "n.A." %}
{% endif %}
diff --git a/wger/nutrition/templates/mobile/meal_item/edit.html b/wger/nutrition/templates/mobile/meal_item/edit.html
index c4351b195..b6a07c218 100644
--- a/wger/nutrition/templates/mobile/meal_item/edit.html
+++ b/wger/nutrition/templates/mobile/meal_item/edit.html
@@ -20,8 +20,7 @@ $(document).ready(function() {
{% block content %}
<form action="{{ form_action }}"
- method="post"
- class="ym-form">
+ method="post">
{% csrf_token %}
{{ form.non_field_errors }}
{{form.ingredient}}
@@ -44,8 +43,8 @@ $(document).ready(function() {
- {% yaml_form_field form.amount %}
- {% yaml_form_field form.weight_unit "ym-fbox-select" %}
+ {% render_form_field form.amount %}
+ {% render_form_field form.weight_unit %}
<tr>
<td colspan="2">
<a href="{% url 'core:index' %}"
diff --git a/wger/nutrition/templates/mobile/rate/form.html b/wger/nutrition/templates/mobile/rate/form.html
index 92266bf6b..5be185fd6 100644
--- a/wger/nutrition/templates/mobile/rate/form.html
+++ b/wger/nutrition/templates/mobile/rate/form.html
@@ -42,7 +42,7 @@ additional physical activity.{% endblocktrans %}</p>
<table>
{% for current_field in form %}
- {% yaml_form_field current_field %}
+ {% render_form_field current_field %}
{% endfor %}
</table>
</form>
@@ -78,7 +78,7 @@ required per day.{% endblocktrans %}</p>
<table>
- {% yaml_form_field form_activities.sleep_hours %}
+ {% render_form_field form_activities.sleep_hours %}
<tr>
<td class="dimmed">{% trans form_activities.work_hours.help_text %}</td>
<td class="dimmed">{% trans form_activities.work_intensity.label %}</td>
@@ -151,8 +151,8 @@ you might just enter yourself the amount of calories if you know the value.{% en
id="total-calories-form">
{% csrf_token %}
<table>
- {% yaml_form_field form_calories.additional_calories %}
- {% yaml_form_field form_calories.calories %}
+ {% render_form_field form_calories.additional_calories %}
+ {% render_form_field form_calories.calories %}
</table>
<input type="submit" value="{% trans 'Transfer basic intake to total daily calories' %}" id="form-transfer-calories">
diff --git a/wger/nutrition/templates/rate/form.html b/wger/nutrition/templates/rate/form.html
index 440ab00b7..4e2d89fbe 100644
--- a/wger/nutrition/templates/rate/form.html
+++ b/wger/nutrition/templates/rate/form.html
@@ -42,7 +42,7 @@ additional physical activity.{% endblocktrans %}</p>
<table>
{% for current_field in form %}
- {% yaml_form_field current_field %}
+ {% render_form_field current_field %}
{% endfor %}
</table>
</form>
@@ -78,18 +78,18 @@ required per day.{% endblocktrans %}</p>
- {% yaml_form_field form_activities.sleep_hours %}
+ {% render_form_field form_activities.sleep_hours %}
<div class="row">
<div class="col-md-6">
- {% yaml_form_field form_activities.work_hours %}
- {% yaml_form_field form_activities.sport_hours %}
- {% yaml_form_field form_activities.freetime_hours %}
+ {% render_form_field form_activities.work_hours %}
+ {% render_form_field form_activities.sport_hours %}
+ {% render_form_field form_activities.freetime_hours %}
</div>
<div class="col-md-6">
- {% yaml_form_field form_activities.work_intensity %}
- {% yaml_form_field form_activities.sport_intensity %}
- {% yaml_form_field form_activities.freetime_intensity %}
+ {% render_form_field form_activities.work_intensity %}
+ {% render_form_field form_activities.sport_intensity %}
+ {% render_form_field form_activities.freetime_intensity %}
</div>
</div>
@@ -135,8 +135,8 @@ you might just enter yourself the amount of calories if you know the value.{% en
id="total-calories-form">
<div class="row">
{% csrf_token %}
- {% yaml_form_field form_calories.additional_calories %}
- {% yaml_form_field form_calories.calories %}
+ {% render_form_field form_calories.additional_calories %}
+ {% render_form_field form_calories.calories %}
<div class="col-md-12">
<input type="submit" class="btn btn-default btn-block" value="{% trans 'Transfer basic intake to total daily calories' %}" id="form-transfer-calories">
diff --git a/wger/utils/widgets.py b/wger/utils/widgets.py
index f41fff388..8ffb96ec5 100644
--- a/wger/utils/widgets.py
+++ b/wger/utils/widgets.py
@@ -121,8 +121,8 @@ class ExerciseAjaxSelect(SelectMultiple):
if value is None:
value = []
- output = [u'<div class="ym-fbox-text">']
- output.append(u'<input type="text" id="exercise-search">')
+ output = [u'<div>']
+ output.append(u'<input type="text" id="exercise-search" class="form-control">')
output.append(u'</div>')
output.append('<div id="exercise-search-log">')
diff --git a/wger/weight/static/js/weight.js b/wger/weight/static/js/weight.js
index f1ce3df03..a33002448 100644
--- a/wger/weight/static/js/weight.js
+++ b/wger/weight/static/js/weight.js
@@ -156,7 +156,7 @@ function weight_chart(data, width_factor)
.data(data.filter(function(d) { return d.y; }))
.enter().append("circle")
.attr("clip-path", "url(#clip)")
- .attr("class", "dot modal-dialog")
+ .attr("class", "dot wger-modal-dialog")
.attr("href", function(d) { return '/' + get_current_language() + '/weight/' + d.id + '/edit/'; })
.attr("id", function(d) { return d.id; })
.attr("cx", line.x())
diff --git a/wger/weight/templates/edit.html b/wger/weight/templates/edit.html
deleted file mode 100644
index b6e4e2807..000000000
--- a/wger/weight/templates/edit.html
+++ /dev/null
@@ -1,51 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load wger_extras %}
-
-
-{% block title %}{% trans "Weight entry" %}{% endblock %}
-
-
-{% block header %}
-<script src="{% static 'js/weight.js' %}"></script>
-
-<script>
-$(document).ready(function () {
- init_weight_datepicker();
- });
-</script>
-{% endblock %}
-
-
-<!--
- Main Content
--->
-{% block content %}
-
-<h2>{% trans "Weight entry" %}</h2>
-
-
-<form action="{% url 'wger.weight.views.add' weight.id %}"
- method="post"
- class="ym-form">
-{% csrf_token %}
-{{ weight_form.non_field_errors }}
-<table>
- {% yaml_form_field weight_form.weight %}
- {% yaml_form_field weight_form.creation_date %}
- <tr>
- <td><input type="submit" value="{% trans "Save" %}" id="form-save"></td>
- <td></td>
- </tr>
-</table>
-</form>
-
-
-{% endblock %}
-
-
-<!--
- Side bar
--->
-{% block sidebar %}{% endblock %}
diff --git a/wger/weight/templates/import_csv_form.html b/wger/weight/templates/import_csv_form.html
index b9b982fb6..3eeac2167 100644
--- a/wger/weight/templates/import_csv_form.html
+++ b/wger/weight/templates/import_csv_form.html
@@ -7,20 +7,10 @@
{% block content %}
<form action="{{form_action}}"
method="post"
- class="ym-form">
-{% csrf_token %}
-{{ form.non_field_errors }}
-<input type="hidden" name="{{ stage_field }}" value="1" />
-<table>
- {% yaml_form_field form.csv_input %}
- {% yaml_form_field form.date_format "ym-fbox-select" %}
-
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Submit' %}" id="form-save">
- </td>
- </tr>
-</table>
+ class="form-horizontal">
+
+ {% trans 'Submit' as submit_text %}
+ {% render_form_fields form submit_text %}
</form>
{% endblock %}
diff --git a/wger/weight/templates/import_csv_preview.html b/wger/weight/templates/import_csv_preview.html
index ca8ae44e4..32d79c53e 100644
--- a/wger/weight/templates/import_csv_preview.html
+++ b/wger/weight/templates/import_csv_preview.html
@@ -8,8 +8,8 @@
{% block content %}
<h3>{% trans "Successfully converted values" %}</h3>
-<div class="box success">{% trans "The following values could be converted." %}</div>
-<table class="narrow">
+<div class="alert alert-success">{% trans "The following values could be converted." %}</div>
+<table class="table">
<tr>
<th>{% trans "Date" %}</th>
<th>{% trans "Weight" %}</th>
@@ -27,7 +27,7 @@
<h3>{% trans "Errors" %}</h3>
{% if error_list %}
- <div class="box error">{% trans "The following values could not be converted." %}</div>
+ <div class="alert alert-danger">{% trans "The following values could not be converted." %}</div>
<p>{% blocktrans %}These values could not be converted to a weight log entry.
The reasons for this could be anything from an unrecognised date or number
@@ -38,7 +38,7 @@
<p>{% blocktrans %}Remember that the expected structure is <strong>date</strong>
on the first columns and <strong>weight</strong> on the second.{% endblocktrans %}</p>
- <table class="narrow">
+ <table class="table">
<tr>
<th>{% trans "Date" %}</th>
<th>{% trans "Weight" %}</th>
@@ -64,13 +64,12 @@ will simply be ignored. It's up to you to decide whether they are useful
<form action="{{form_action}}"
method="post"
- class="ym-form">
-{% csrf_token %}
-{% for field in form %}{{ field.as_hidden }}{% endfor %}
+ class="form-horizontal">
-<input type="hidden" name="{{ stage_field }}" value="2" />
-<input type="hidden" name="{{ hash_field }}" value="{{ hash_value }}" />
-<p><input type="submit" value="{% trans 'Import' %}" /></p>
+ <input type="hidden" name="{{ stage_field }}" value="2" />
+ <input type="hidden" name="{{ hash_field }}" value="{{ hash_value }}" />
+ {% trans 'Import' as submit_text %}
+ {% render_form_fields form submit_text %}
</form>
@@ -82,19 +81,11 @@ you want.{% endblocktrans %}</p>
<form action="{{form_action}}"
method="post"
- class="ym-form">
-{% csrf_token %}
-{{ form.non_field_errors }}
-<input type="hidden" name="{{ stage_field }}" value="1" />
-<table>
- {% yaml_form_field form.csv_input %}
- {% yaml_form_field form.date_format "ym-fbox-select" %}
- <tr>
- <td colspan="2">
- <input type="submit" value="{% trans 'Re-Submit' %}" id="form-save">
- </td>
- </tr>
-</table>
+ class="form">
+
+ <input type="hidden" name="{{ stage_field }}" value="1" />
+ {% trans 'Re-Submit' as submit_text %}
+ {% render_form_fields form submit_text %}
</form>
{% endblock %}