Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove update of preferences about ingredients in English via AJAX

Roland Geider45154d8f24fc
diff --git a/wger/nutrition/static/js/nutrition.js b/wger/nutrition/static/js/nutrition.js
index a2b9bf522..dec39a7fd 100644
--- a/wger/nutrition/static/js/nutrition.js
+++ b/wger/nutrition/static/js/nutrition.js
@@ -67,30 +67,6 @@ function init_ingredient_detail(url)
/*
* Update the user's preferences
*/
-function init_english_ingredients()
-{
- $("#ajax-english-ingredients").click(function(e) {
- e.preventDefault();
-
- // Update the status icon and the data attribute
- var switch_to = $('#english-ingredients-status').data('showIngredients') == 'true' ? 0 : 1;
- if ( switch_to == 1 )
- {
- $('#english-ingredients-status').attr("src", "/static/images/icons/status-on.svg");
- $('#english-ingredients-status').data('showIngredients', 'true');
- }
- else if ( switch_to == 0 )
- {
- $('#english-ingredients-status').attr("src", "/static/images/icons/status-off.svg");
- $('#english-ingredients-status').data('showIngredients', 'false');
- }
-
- // Update the settings
- $("#ajax-info").load('/' + get_current_language() + "/workout/api/user-preferences?do=set_english-ingredients&show=" + switch_to);
- });
-}
-
-
function init_ingredient_autocompleter()
{
// Init the autocompleter
diff --git a/wger/nutrition/templates/plan/view.html b/wger/nutrition/templates/plan/view.html
index 634eb8226..35c78f7cc 100644
--- a/wger/nutrition/templates/plan/view.html
+++ b/wger/nutrition/templates/plan/view.html
@@ -12,12 +12,6 @@ function custom_modal_init()
// Init the autocompleter after loading the modal dialog
init_ingredient_autocompleter();
}
-
-$(document).ready(function() {
-
- // Check if the user wants to see ingredients in english
- init_english_ingredients();
-});
</script>
{% endblock %}
@@ -155,22 +149,7 @@ $(document).ready(function() {
{% if language.short_name != 'en' %}
<p>
{% trans "If you find the ingredient list too short, you might want to activate the preference to also show English ingredients." %}
- <a href="{% url 'core:preferences' %}" id="ajax-english-ingredients">{% trans "That's done here" %}</a>:
- {% if user.userprofile.show_english_ingredients %}
- <img src="{% static 'images/icons/status-on.svg' %}"
- width="20"
- height="20"
- alt=""
- id="english-ingredients-status"
- data-show-ingredients="true">
- {% else %}
- <img src="{% static 'images/icons/status-off.svg' %}"
- width="20"
- height="20"
- alt=""
- id="english-ingredients-status"
- data-show-ingredients="false">
- {% endif %}
+ <a href="{% url 'core:preferences' %}" id="ajax-english-ingredients">{% trans "That's done here" %}</a>.
</p>
{% endif %}