Self hosted FLOSS fitness/workout, nutrition and weight tracker
More removing of mobile/full version code
Roland Geiderd765376ad3da
diff --git a/wger/core/management/commands/clear-cache.py b/wger/core/management/commands/clear-cache.pyindex 209a804e2..6b1ce0699 100644--- a/wger/core/management/commands/clear-cache.py+++ b/wger/core/management/commands/clear-cache.py@@ -103,7 +103,6 @@ class Command(BaseCommand):for language in Language.objects.all():delete_template_fragment_cache('muscle-overview', language.id)delete_template_fragment_cache('exercise-overview', language.id)- delete_template_fragment_cache('exercise-overview-mobile', language.id)delete_template_fragment_cache('equipment-overview', language.id)# Workout canonical formdiff --git a/wger/core/static/css/workout-manager-mobile.css b/wger/core/static/css/workout-manager-mobile.cssdeleted file mode 100644index 3c475f706..000000000--- a/wger/core/static/css/workout-manager-mobile.css+++ /dev/null@@ -1,220 +0,0 @@-/*- This file is part of Workout Manager-- Workout Manager is free software: you can redistribute it and/or modify- it under the terms of the GNU Affero General Public License as published by- the Free Software Foundation, either version 3 of the License, or- (at your option) any later version.-- Workout Manager is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU Affero General Public License for more details.-- You should have received a copy of the GNU Affero General Public License- along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.-*/--/**************************************************************- *- * This file contains custom classes and styles for the mobile version- *- **************************************************************/--body {- background-color: white;- padding-top: 50px;-}--/*- * Set the sizes for the background where the muscles are shown on the exercise view page- */-div.muscle-background {- width: 150px;- height: 276px;- background-size: 150px;- background-repeat: no-repeat;-}--/**************************************************************- * Muscle overview- **************************************************************/-.muscle-list,-.exercise-overview {- padding-left: 0;-}--/**************************************************************- * Headers- **************************************************************/-h1 {- font-size: 220%;-}--h2 {- font-size: 180%;-}--h3 {- font-size: 150%;-}--h4 {- font-size: 133.33%;-}--h5 {- font-size: 116.67%;-}--h6 {- font-size: 100%;-}--h1,-h2,-h3,-h4,-h5,-h6 {- font-family: "Open Sans Light", Arial, Helvetica, sans-serif;- font-weight: 300;-}--/**************************************************************- * Header- **************************************************************/--/*- * Add a shadow to the application name- */-header h1 {- text-shadow: 2px 3px 3px #292929;- font-family: "Open Sans Bold", Arial, Helvetica, sans-serif;- font-weight: 300;-}--/**************************************************************- * Form errors- **************************************************************/-.form-error,-input.form-error {- color: rgb(136, 0, 0);-}--.form-error .ui-input-text {- border-color: rgb(136, 0, 0);-}--/**************************************************************- * Success, info and other alert boxes- **************************************************************/-.success {- background: #b7f774;-}--.warning {- background: rgb(252, 175, 62);- text-shadow: none;-}--/**************************************************************- * Other classes- **************************************************************/-.float-left {- float: left;- display: inline;-}--.align-right {- text-align: right;-}--/**************************************************************- * Gym mode pages- **************************************************************/-div#timer-container ul,-div#timer-container h2 {- padding: 0;- margin: 0;-}--div#timer-container a.wide_link {- padding-left: 0;- padding-right: 0;- padding-top: 0.7em;- padding-bottom: 0.7em;- width: 95%;-}--div#timer-container ul#workout-timer li {- float: left;- list-style: none;- position: relative;-}--div#timer-container {- padding: 13px;- clear: both;- overflow: hidden;- margin: 0 auto;- display: block;-}--div#timer-container canvas,-div#timer-container div.filler_div {- height: 150px;- margin-top: 1em;- margin-bottom: 30px;-}--div#timer-container canvas {- width: 150px;-}--div#timer-container div.sub_header {- position: absolute;- bottom: 65px;- width: 95%;-}--div#timer-container div.sub_header a {- width: 90%;-}--div#timer-container div.sub_header h2 {- font-size: 300%;-}--div#timer-container .bottom_buttons {- position: absolute;- bottom: 12px;- width: 100%;-}--div#timer-container a.bottom_button {- position: absolute;- bottom: 12px;-}--div#timer-container div.progress-bar {- position: absolute;- bottom: 0;- width: 99%;- height: 6px;- border-radius: 3px;- background-color: #eeeeec;- border: 1px solid gray;-}--div#timer-container div.progress-bar span {- height: 6px;- border-radius: 3px;- border: 1px solid gray;- position: absolute;- bottom: -1px;- left: -1px;- background-color: #204a87;-- /* background-color: rgb(170, 170, 170); */-}diff --git a/wger/core/static/js/wger-core-mobile.js b/wger/core/static/js/wger-core-mobile.jsdeleted file mode 100644index e2cb083e2..000000000--- a/wger/core/static/js/wger-core-mobile.js+++ /dev/null@@ -1,30 +0,0 @@-/*- Custom JS code for the mobile version- */-'use strict';--/*- * Handle external links with a Web Activity when in Firefox OS- */-$(document).ready(function () {- if (typeof MozActivity !== 'undefined') {- /*- * External links- */- $('a[href^=http]').click(function (e) {- /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "activity" }] */- var activity;- e.preventDefault();-- activity = new MozActivity({- name: 'view',- data: {- type: 'url',- url: $(this).attr('href')- }- });- });- } else {- console.debug('MozActivity not available, opening links as usual.');- }-});diff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.pyindex 3b4e44579..b7b7b128d 100644--- a/wger/core/tests/base_testcase.py+++ b/wger/core/tests/base_testcase.py@@ -120,7 +120,6 @@ class BaseTestCase(object):'test-schedules')current_user = 'anonymous'current_password = ''- is_mobile = Falsedef setUp(self):"""diff --git a/wger/core/tests/test_index.py b/wger/core/tests/test_index.pyindex 3a5569d59..cec6cd660 100644--- a/wger/core/tests/test_index.py+++ b/wger/core/tests/test_index.py@@ -97,15 +97,12 @@ class DashboardTestCase(WorkoutManagerTestCase):self.user_login('admin')self.dashboard()- def test_mobile_dashboard(self):+ def test_dashboard(self):"""- Test that a mobile request gets the mobile view+ Test that the dashboard has the correct CSS files"""response = self.client.get(reverse('core:dashboard'))self.assertEqual(response.status_code, 200)-- if self.is_mobile:- self.assertContains(response, 'css/workout-manager-mobile.css', html=False)- else:- self.assertContains(response, 'css/workout-manager.css', html=False)+ self.assertContains(response, 'css/workout-manager.css', html=False)+ self.assertContains(response, 'yarn/bootstrap/dist/css/bootstrap.min.css', html=False)diff --git a/wger/exercises/models.py b/wger/exercises/models.pyindex c5f7423cf..e375095c0 100644--- a/wger/exercises/models.py+++ b/wger/exercises/models.py@@ -144,7 +144,6 @@ class ExerciseCategory(models.Model):# Cached template fragmentsfor language in Language.objects.all():delete_template_fragment_cache('exercise-overview', language.id)- delete_template_fragment_cache('exercise-overview-mobile', language.id)def delete(self, *args, **kwargs):"""@@ -152,7 +151,6 @@ class ExerciseCategory(models.Model):"""for language in Language.objects.all():delete_template_fragment_cache('exercise-overview', language.id)- delete_template_fragment_cache('exercise-overview-mobile', language.id)super(ExerciseCategory, self).delete(*args, **kwargs)@@ -242,7 +240,6 @@ class Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):for language in Language.objects.all():delete_template_fragment_cache('muscle-overview', language.id)delete_template_fragment_cache('exercise-overview', language.id)- delete_template_fragment_cache('exercise-overview-mobile', language.id)delete_template_fragment_cache('equipment-overview', language.id)# Cached workouts@@ -261,7 +258,6 @@ class Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):for language in Language.objects.all():delete_template_fragment_cache('muscle-overview', language.id)delete_template_fragment_cache('exercise-overview', language.id)- delete_template_fragment_cache('exercise-overview-mobile', language.id)delete_template_fragment_cache('equipment-overview', language.id)# Cached workoutsdiff --git a/wger/exercises/tests/test_categories.py b/wger/exercises/tests/test_categories.pyindex 5f50aab1d..c02648be8 100644--- a/wger/exercises/tests/test_categories.py+++ b/wger/exercises/tests/test_categories.py@@ -109,28 +109,20 @@ class ExerciseCategoryCacheTestCase(WorkoutManagerTestCase):self.client.get(reverse('exercise:exercise:view', kwargs={'id': 2}))old_exercise_overview = cache.get(get_template_cache_name('exercise-overview', 2))- old_exercise_overview_mobile = cache.get(get_template_cache_name('exercise-overview-mobile',- 2))category = ExerciseCategory.objects.get(pk=2)category.name = 'Cool category'category.save()self.assertFalse(cache.get(get_template_cache_name('exercise-overview', 2)))- self.assertFalse(cache.get(get_template_cache_name('exercise-overview-mobile', 2)))self.client.get(reverse('exercise:exercise:overview'))self.client.get(reverse('exercise:muscle:overview'))self.client.get(reverse('exercise:exercise:view', kwargs={'id': 2}))new_exercise_overview = cache.get(get_template_cache_name('exercise-overview', 2))- new_exercise_overview_mobile = cache.get(get_template_cache_name('exercise-overview-mobile',- 2))- if not self.is_mobile:- self.assertNotEqual(old_exercise_overview, new_exercise_overview)- else:- self.assertNotEqual(old_exercise_overview_mobile, new_exercise_overview_mobile)+ self.assertNotEqual(old_exercise_overview, new_exercise_overview)class ExerciseCategoryApiTestCase(api_base_test.ApiBaseResourceTestCase):diff --git a/wger/exercises/tests/test_equipment.py b/wger/exercises/tests/test_equipment.pyindex a1196f7be..2fa6f1a45 100644--- a/wger/exercises/tests/test_equipment.py+++ b/wger/exercises/tests/test_equipment.py@@ -144,12 +144,9 @@ class EquipmentCacheTestCase(WorkoutManagerTestCase):"""Test the equipment overview cache is correctly generated on visit"""- if self.is_mobile:- self.client.get(reverse('exercise:equipment:overview'))- else:- self.assertFalse(cache.get(get_template_cache_name('equipment-overview', 2)))- self.client.get(reverse('exercise:equipment:overview'))- self.assertTrue(cache.get(get_template_cache_name('equipment-overview', 2)))+ self.assertFalse(cache.get(get_template_cache_name('equipment-overview', 2)))+ self.client.get(reverse('exercise:equipment:overview'))+ self.assertTrue(cache.get(get_template_cache_name('equipment-overview', 2)))def test_equipmet_cache_update(self):"""diff --git a/wger/exercises/tests/test_exercise.py b/wger/exercises/tests/test_exercise.pyindex d48f56c3d..18bd8672f 100644--- a/wger/exercises/tests/test_exercise.py+++ b/wger/exercises/tests/test_exercise.py@@ -419,14 +419,9 @@ class ExercisesCacheTestCase(WorkoutManagerTestCase):"""Test the exercise overview cache is correctly generated on visit"""- if self.is_mobile:- self.assertFalse(cache.get(get_template_cache_name('exercise-overview-mobile', 2)))- self.client.get(reverse('exercise:exercise:overview'))- self.assertTrue(cache.get(get_template_cache_name('exercise-overview-mobile', 2)))- else:- self.assertFalse(cache.get(get_template_cache_name('exercise-overview', 2)))- self.client.get(reverse('exercise:exercise:overview'))- self.assertTrue(cache.get(get_template_cache_name('exercise-overview', 2)))+ self.assertFalse(cache.get(get_template_cache_name('exercise-overview', 2)))+ self.client.get(reverse('exercise:exercise:overview'))+ self.assertTrue(cache.get(get_template_cache_name('exercise-overview', 2)))def test_exercise_detail(self):"""@@ -440,7 +435,6 @@ class ExercisesCacheTestCase(WorkoutManagerTestCase):"""self.assertFalse(cache.get(cache_mapper.get_exercise_muscle_bg_key(2)))self.assertFalse(cache.get(get_template_cache_name('muscle-overview', 2)))- self.assertFalse(cache.get(get_template_cache_name('muscle-overview-mobile', 2)))self.assertFalse(cache.get(get_template_cache_name('muscle-overview-search', 2)))self.assertFalse(cache.get(get_template_cache_name('exercise-overview', 2)))@@ -450,8 +444,6 @@ class ExercisesCacheTestCase(WorkoutManagerTestCase):old_exercise_bg = cache.get(cache_mapper.get_exercise_muscle_bg_key(2))old_muscle_overview = cache.get(get_template_cache_name('muscle-overview', 2))old_exercise_overview = cache.get(get_template_cache_name('exercise-overview', 2))- old_exercise_overview_mobile = cache.get(get_template_cache_name('exercise-overview-mobile',- 2))exercise = Exercise.objects.get(pk=2)exercise.name = 'Very cool exercise 2'@@ -462,7 +454,6 @@ class ExercisesCacheTestCase(WorkoutManagerTestCase):self.assertFalse(cache.get(cache_mapper.get_exercise_muscle_bg_key(2)))self.assertFalse(cache.get(get_template_cache_name('muscle-overview', 2)))self.assertFalse(cache.get(get_template_cache_name('exercise-overview', 2)))- self.assertFalse(cache.get(get_template_cache_name('exercise-overview-mobile', 2)))self.client.get(reverse('exercise:exercise:overview'))self.client.get(reverse('exercise:muscle:overview'))@@ -471,15 +462,10 @@ class ExercisesCacheTestCase(WorkoutManagerTestCase):new_exercise_bg = cache.get(cache_mapper.get_exercise_muscle_bg_key(2))new_muscle_overview = cache.get(get_template_cache_name('muscle-overview', 2))new_exercise_overview = cache.get(get_template_cache_name('exercise-overview', 2))- new_exercise_overview_mobile = cache.get(get_template_cache_name('exercise-overview-mobile',- 2))- if not self.is_mobile:- self.assertNotEqual(old_exercise_bg, new_exercise_bg)- self.assertNotEqual(old_exercise_overview, new_exercise_overview)- self.assertNotEqual(old_muscle_overview, new_muscle_overview)- else:- self.assertNotEqual(old_exercise_overview_mobile, new_exercise_overview_mobile)+ self.assertNotEqual(old_exercise_bg, new_exercise_bg)+ self.assertNotEqual(old_exercise_overview, new_exercise_overview)+ self.assertNotEqual(old_muscle_overview, new_muscle_overview)def test_muscles_cache_update_on_delete(self):"""diff --git a/wger/exercises/tests/test_muscles.py b/wger/exercises/tests/test_muscles.pyindex 76ad1aefa..89c2fdf93 100644--- a/wger/exercises/tests/test_muscles.py+++ b/wger/exercises/tests/test_muscles.py@@ -125,10 +125,9 @@ class MuscleCacheTestCase(WorkoutManagerTestCase):Test the muscle overview cache is correctly generated on visit"""- if not self.is_mobile:- self.assertFalse(cache.get(get_template_cache_name('muscle-overview', 2)))- self.client.get(reverse('exercise:muscle:overview'))- self.assertTrue(cache.get(get_template_cache_name('muscle-overview', 2)))+ self.assertFalse(cache.get(get_template_cache_name('muscle-overview', 2)))+ self.client.get(reverse('exercise:muscle:overview'))+ self.assertTrue(cache.get(get_template_cache_name('muscle-overview', 2)))class MuscleOverviewTestCase(WorkoutManagerAccessTestCase):diff --git a/wger/nutrition/static/js/nutrition.js b/wger/nutrition/static/js/nutrition.jsindex 55acf3cc7..87f2b9f29 100644--- a/wger/nutrition/static/js/nutrition.js+++ b/wger/nutrition/static/js/nutrition.js@@ -100,7 +100,7 @@ function wgerInitIngredientAutocompleter() {/** Draw the BMI chart*/-function wgerRenderBodyMassIndex(w) {+function wgerRenderBodyMassIndex() {var svg;var area;var nest;@@ -120,11 +120,7 @@ function wgerRenderBodyMassIndex(w) {d3.selectAll('svg').remove();// Calculate the size- if (typeof w === 'undefined') {- widthFactor = 600;- } else {- widthFactor = w;- }+ widthFactor = 600;heightFactor = (widthFactor / 600) * 300;diff --git a/wger/nutrition/templates/bmi/form.html b/wger/nutrition/templates/bmi/form.htmlindex 9dfe9e3a9..fe8deb1d6 100644--- a/wger/nutrition/templates/bmi/form.html+++ b/wger/nutrition/templates/bmi/form.html@@ -26,7 +26,7 @@ div.bmi-legend {<script>$(document).ready(function () {- wgerRenderBodyMassIndex({% if request.user_agent.is_mobile %}$('#content').width() * 0.95{% endif %});+ wgerRenderBodyMassIndex();/** Process the formdiff --git a/wger/nutrition/templates/ingredient/overview.html b/wger/nutrition/templates/ingredient/overview.htmlindex 34a0e2fc3..2d91b1bf6 100644--- a/wger/nutrition/templates/ingredient/overview.html+++ b/wger/nutrition/templates/ingredient/overview.html@@ -33,11 +33,7 @@{% if ingredients_list %}<div class="list-group">{% for ingredient in ingredients_list %}- <a class="list-group-item"- href="{{ ingredient.get_absolute_url }}">- {% if request.user_agent.is_mobile %}- <span class="glyphicon glyphicon-chevron-right float-right"></span>- {% endif %}+ <a class="list-group-item" href="{{ ingredient.get_absolute_url }}">{{ ingredient.name }}</a>{% endfor %}