Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove shariff

Roland Geider7688df25e20e
diff --git a/package.json b/package.json
index 4fe1fa174..4792b6d35 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,6 @@
"jquery": "^3.7.1",
"masonry-layout": "^4.2.2",
"popper.js": "^1.16.1",
- "shariff": "^3.3.0",
"yarn": "^1.22.21"
},
"scripts": {
diff --git a/wger/core/static/js/wger-core.js b/wger/core/static/js/wger-core.js
index 0ff66da86..638a6ff74 100644
--- a/wger/core/static/js/wger-core.js
+++ b/wger/core/static/js/wger-core.js
@@ -132,32 +132,6 @@ function getProfileField(field) {
return result;
}
-
-
-function wgerToggleReadOnlyAccess() {
- $('#toggle-ro-access').click(function (e) {
- var $shariffModal;
- var roAccess;
- e.preventDefault();
- roAccess = getProfileField('ro_access');
-
- // Update user profile
- setProfileField('ro_access', !roAccess);
-
- // Hide and show appropriate divs
-
- $shariffModal = $('#shariffModal');
- if (!roAccess) {
- $shariffModal.find('.shariff').removeClass('d-none');
- $shariffModal.find('.noRoAccess').addClass('d-none');
- } else {
- $shariffModal.find('.shariff').addClass('d-none');
- $shariffModal.find('.noRoAccess').removeClass('d-none');
- }
- });
-}
-
-
/*
Open a modal dialog for form editing
*/
diff --git a/wger/core/templates/base.html b/wger/core/templates/base.html
index ffb6b3bb0..aa822b904 100644
--- a/wger/core/templates/base.html
+++ b/wger/core/templates/base.html
@@ -2,9 +2,7 @@
{% load i18n wger_extras django_bootstrap_breadcrumbs %}
{% block template %}
- {% if show_shariff %}
- {% include 'misc/fragments/shariff_modal.html' %}
- {% endif %}
+
{% if trainer_identity %}
@@ -34,15 +32,6 @@
{% endblock %}
</div>
- {% if show_shariff %}
- <button type="button"
- class="btn btn-link btn-sm float-end"
- data-bs-toggle="modal"
- data-bs-target="#shariffModal"
- title="{% trans 'Share' %}">
- <span class="{% fa_class 'share-alt' %}"></span>
- </button>
- {% endif %}
</div>
</div>
diff --git a/wger/core/templates/base_wide.html b/wger/core/templates/base_wide.html
index bd929d51f..2cdc4c27a 100644
--- a/wger/core/templates/base_wide.html
+++ b/wger/core/templates/base_wide.html
@@ -1,8 +1,5 @@
{% extends "template.html" %}{% load i18n wger_extras django_bootstrap_breadcrumbs %}
{% block template %}
- {% if show_shariff %}
- {% include 'misc/fragments/shariff_modal.html' %}
- {% endif %}
{% if trainer_identity %}
@@ -29,16 +26,6 @@
{% block options %}
{% endblock %}
-
- {% if show_shariff %}
- <button type="button"
- class="btn btn-light btn-sm"
- data-bs-toggle="modal"
- data-bs-target="#shariffModal">
- <span class="glyphicon glyphicon-retweet"></span>
- {% trans "Share" %}
- </button>
- {% endif %}
</div>
</div>
</div>
diff --git a/wger/core/templates/misc/fragments/shariff_modal.html b/wger/core/templates/misc/fragments/shariff_modal.html
deleted file mode 100644
index b08eb76d5..000000000
--- a/wger/core/templates/misc/fragments/shariff_modal.html
+++ /dev/null
@@ -1,37 +0,0 @@
-{% load i18n wger_extras %}
-<div class="modal fade" id="shariffModal">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <h4 class="modal-title">{% translate "Share this page" %}</h4>
- <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
- </button>
- </div>
- <div class="modal-body">
- <div class="shariff {% if is_owner and not owner_user.userprofile.ro_access %}d-none{% endif %}"
- data-lang="{{ language.short_name }}"
- data-orientation="horizontal"
- data-button-style="icon"
- data-services="[&quot;facebook&quot;,&quot;twitter&quot;,&quot;whatsapp&quot;,&quot;telegram&quot;,&quot;info&quot;]"></div>
-
- {% if owner_user %}
- <div
- class="noRoAccess {% if user.is_authenticated and is_owner and owner_user.userprofile.ro_access %}d-none{% endif %}">
- <p>{% blocktranslate %}Before you share links on social media you need to allow external
- access.{% endblocktranslate %}</p>
- <p>
- <a href="{% url 'core:user:preferences' %}" id="toggle-ro-access"
- class="btn btn-success btn-sm">
- <span class="{% fa_class 'check' %}"></span>
- {% translate "That's done here" %}
- </a>
- </p>
- </div>
- {% endif %}
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-light" data-bs-dismiss="modal">{% translate "Close" %}</button>
- </div>
- </div>
- </div>
-</div>
diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html
index a72326cd9..02653d320 100644
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@ -49,8 +49,6 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/workout-manager.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'yarn/bootstrap-compiled.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap-custom.css' %}">
- <link rel="stylesheet" type="text/css"
- href="{% static 'yarn/shariff/dist/shariff.min.css' %}">
<link rel="stylesheet" type="text/css"
href="{% static 'fontawesomefree/css/all.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'react/main.css' %}" id="react-css">
@@ -86,9 +84,6 @@
// Initialise the hook to reload the main-content
wgerLoadMaincontent();
-
- // Check for RO-access before allowing sharing
- wgerToggleReadOnlyAccess();
});
</script>
@@ -226,6 +221,5 @@
</div>
</footer>
-<script src="{% static 'yarn/shariff/dist/shariff.min.js' %}"></script>
</body>
</html>
diff --git a/wger/exercises/api/views.py b/wger/exercises/api/views.py
index 3cdff5f12..322fca10b 100644
--- a/wger/exercises/api/views.py
+++ b/wger/exercises/api/views.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
diff --git a/wger/manager/tests/test_weight_log.py b/wger/manager/tests/test_weight_log.py
index aab7cbeb5..12ea4f9c4 100644
--- a/wger/manager/tests/test_weight_log.py
+++ b/wger/manager/tests/test_weight_log.py
@@ -67,26 +67,6 @@ class WeightLogAccessTestCase(WgerTestCase):
self.assertEqual(response.status_code, 403)
-class CalendarShareButtonTestCase(WgerTestCase):
- """
- Test that the share button is correctly displayed and hidden
- """
-
- def test_share_button(self):
- url = reverse('manager:workout:calendar', kwargs={'username': 'admin'})
-
- response = self.client.get(url)
- self.assertFalse(response.context['show_shariff'])
-
- self.user_login('admin')
- response = self.client.get(url)
- self.assertTrue(response.context['show_shariff'])
-
- self.user_login('test')
- response = self.client.get(url)
- self.assertFalse(response.context['show_shariff'])
-
-
class CalendarAccessTestCase(WgerTestCase):
"""
Test accessing the calendar page
diff --git a/wger/manager/views/log.py b/wger/manager/views/log.py
index 4e292daf2..dd5a39556 100644
--- a/wger/manager/views/log.py
+++ b/wger/manager/views/log.py
@@ -296,7 +296,6 @@ class WorkoutLogDetailView(DetailView, LoginRequiredMixin):
context['workout_log'] = workout_log
context['owner_user'] = self.owner_user
context['is_owner'] = is_owner
- context['show_shariff'] = is_owner
return context
@@ -337,7 +336,6 @@ def calendar(request, username=None, year=None, month=None):
context['is_owner'] = is_owner
context['impressions'] = WorkoutSession.IMPRESSION
context['month_list'] = WorkoutLog.objects.filter(user=user).dates('date', 'month')
- context['show_shariff'] = is_owner and user.userprofile.ro_access
return render(request, 'calendar/month.html', context)
@@ -357,6 +355,5 @@ def day(request, username, year, month, day):
context['date'] = date
context['owner_user'] = user
context['is_owner'] = is_owner
- context['show_shariff'] = is_owner and user.userprofile.ro_access
return render(request, 'calendar/day.html', context)
diff --git a/wger/manager/views/schedule.py b/wger/manager/views/schedule.py
index 759e4a65e..84fd1cea2 100644
--- a/wger/manager/views/schedule.py
+++ b/wger/manager/views/schedule.py
@@ -113,7 +113,6 @@ def view(request, pk):
template_data['token'] = token
template_data['is_owner'] = is_owner
template_data['owner_user'] = user
- template_data['show_shariff'] = is_owner
template_data['download_form'] = WorkoutScheduleDownloadForm()
return render(request, 'schedule/view.html', template_data)
diff --git a/wger/manager/views/workout.py b/wger/manager/views/workout.py
index 602d6784b..98c3cbc00 100644
--- a/wger/manager/views/workout.py
+++ b/wger/manager/views/workout.py
@@ -120,7 +120,6 @@ def view(request, pk):
'token': token,
'is_owner': is_owner,
'owner_user': user,
- 'show_shariff': is_owner,
}
return render(request, 'workout/view.html', context)
diff --git a/wger/nutrition/models/ingredient.py b/wger/nutrition/models/ingredient.py
index 55554a7ab..6ab25fdd0 100644
--- a/wger/nutrition/models/ingredient.py
+++ b/wger/nutrition/models/ingredient.py
@@ -301,8 +301,8 @@ class Ingredient(AbstractSubmissionModel, AbstractLicenseModel, models.Model):
raise ValidationError(
_(
'The total energy ({energy}kcal) is not the approximate sum of the '
- 'energy provided by protein, carbohydrates and fat ({energy_calculated}kcal '
- '+/-{energy_approx}%)'.format(
+ 'energy provided by protein, carbohydrates and fat ({energy_calculated}kcal'
+ ' +/-{energy_approx}%)'.format(
energy=self.energy,
energy_calculated=energy_calculated,
energy_approx=self.ENERGY_APPROXIMATION
@@ -473,6 +473,7 @@ class Ingredient(AbstractSubmissionModel, AbstractLicenseModel, models.Model):
logger.info(f'Got JSONDecodeError from OFF: {e}')
return None
if result['status'] != OFF_SEARCH_PRODUCT_FOUND:
+ logger.info('Product not found')
return None
product = result['product']
diff --git a/wger/nutrition/views/ingredient.py b/wger/nutrition/views/ingredient.py
index a9bcffcaf..6d2094b71 100644
--- a/wger/nutrition/views/ingredient.py
+++ b/wger/nutrition/views/ingredient.py
@@ -82,14 +82,6 @@ class IngredientListView(ListView):
language = load_language()
return Ingredient.objects.accepted().filter(language=language).only('id', 'name')
- def get_context_data(self, **kwargs):
- """
- Pass additional data to the template
- """
- context = super(IngredientListView, self).get_context_data(**kwargs)
- context['show_shariff'] = True
- return context
-
def view(request, pk, slug=None):
context = {}
@@ -108,7 +100,6 @@ def view(request, pk, slug=None):
}
)
- context['show_shariff'] = True
return render(request, 'ingredient/view.html', context)
diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.py
index 151485330..834a59b75 100644
--- a/wger/utils/context_processor.py
+++ b/wger/utils/context_processor.py
@@ -83,7 +83,6 @@ def processor(request):
or '/contact' in request.get_full_path() \
or '/api/v2' in request.get_full_path():
context['active_tab'] = constants.SOFTWARE_TAB
- context['show_shariff'] = True
elif '/exercise/' in request.get_full_path():
context['active_tab'] = constants.WORKOUT_TAB
diff --git a/wger/weight/views.py b/wger/weight/views.py
index a6154f049..92c54f824 100644
--- a/wger/weight/views.py
+++ b/wger/weight/views.py
@@ -159,7 +159,6 @@ def overview(request, username=None):
context = {
'is_owner': is_owner,
'owner_user': user,
- 'show_shariff': False,
}
return render(request, 'overview.html', context)
diff --git a/yarn.lock b/yarn.lock
index 0f0c587f8..85c68bc24 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,11 +2,6 @@
# yarn lockfile v1
-"@fortawesome/fontawesome-free@^5.8.2":
- version "5.14.0"
- resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.14.0.tgz#a371e91029ebf265015e64f81bfbf7d228c9681f"
- integrity sha512-OfdMsF+ZQgdKHP9jUbmDcRrP0eX90XXrsXIdyjLbkmSBzmMXPABB8eobUJtivaupucYaByz6WNe1PI1JuYm3qA==
-
"@types/jquery@^2.0.32":
version "2.0.54"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-2.0.54.tgz#d7999245f77c3fab5d84e7d32b8a6c20bfd1f072"
@@ -331,7 +326,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.1.tgz#33d0fa016185397549fb1a14ea3dbe5a2949d1cd"
integrity sha512-Ujwccrj9FkGqjbY3iVoxD1VV+KdZZeENx0rphrtzmRXbFvkFO88L80BL/zeSIguX/7T+y8k04xqtgWgS5vxwxw==
-jquery@>=1.7, jquery@^3.4.1, jquery@^3.7.1:
+jquery@>=1.7, jquery@^3.7.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de"
integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==
@@ -373,14 +368,6 @@ rw@1:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
-shariff@^3.3.0:
- version "3.3.0"
- resolved "https://registry.yarnpkg.com/shariff/-/shariff-3.3.0.tgz#567b23f929298442a593af2f30258bd13ef4d587"
- integrity sha512-k8aITaDpbdIlun3mJ/SlfSRrc5vvyl4wjsJ0gTrclCNo/wemCVhhY7wEk5HqOy4y/3msVDEarwuF/SU2j7+Auw==
- dependencies:
- "@fortawesome/fontawesome-free" "^5.8.2"
- jquery "^3.4.1"
-
yarn@^1.22.21:
version "1.22.21"
resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.21.tgz#1959a18351b811cdeedbd484a8f86c3cc3bbaf72"