Self hosted FLOSS fitness/workout, nutrition and weight tracker
Use Webactivities on Firefox OS to open external links and PDFs
Roland Geiderfa6f7126830b
diff --git a/wger/manager/templates/mobile/schedule/view.html b/wger/manager/templates/mobile/schedule/view.htmlindex 7ef2d76c2..bac08bf8a 100644--- a/wger/manager/templates/mobile/schedule/view.html+++ b/wger/manager/templates/mobile/schedule/view.html@@ -6,45 +6,6 @@{% block title %}{{schedule.name}}{% endblock %}{% block header %}-<script type="text/javascript">-function init_sortable()-{- $("#schedule-table tbody").off();- $("#schedule-table tbody").sortable({- handle: '.dragndrop-handle',- revert: true,- update : function (event, ui) {- var schedule_id = ui.item.data('scheduleId');-- // returns something in the form "step-1,step-2,step-3,"- var order = $( this ).sortable('toArray');-- $.get('/' + get_current_language() + "/workout/schedule/api/" + schedule_id + "/edit" + "?do=set_order&order=" + order);- current_url = $("#current-url").data('currentUrl');-- // TODO: again, why do we need to do this twice. Otherwise, sometimes- // it doesn't get current data- $.get(current_url);- $.get(current_url, function(data) {- $('#schedule-table').html($(data).find('#schedule-table').html());- init_sortable();- form_modal_dialog();- });- }- })-}--// Initialise the datepicker for the modal dialog-function custom_modal_init()-{- init_schedule_datepicker();-}--$(function() {- init_sortable();- init_schedule_datepicker();-});-</script>{% endblock %}{% block content %}diff --git a/wger/manager/templates/mobile/template.html b/wger/manager/templates/mobile/template.htmlindex d6d375b06..7ee2b72e0 100644--- a/wger/manager/templates/mobile/template.html+++ b/wger/manager/templates/mobile/template.html@@ -42,6 +42,33 @@function init_weight_datepicker(){}++ /*+ * Handle external links with a Web Activity when in Firefox OS+ */+ $(document).on('pageinit', function () {+ if(typeof MozActivity != 'undefined') {+ /*+ * External links+ */+ $('a[href^=http]').click(function(e){+ e.preventDefault();++ var activity = new MozActivity({+ name: "view",+ data: {+ type: "url",+ url: $(this).attr("href")+ }+ });+ });+ }+ else {+ console.debug('MozActivity not available, opening links as usual.');+ }+ });++</script>{% block header %}{% endblock %}@@ -97,7 +124,7 @@<div data-role="navbar"><ul>- <li {% if active_tab == 'user' %}class="active"{% endif %}>+ <li>{% if not user.is_authenticated %}<a href="{% url 'login' %}" data-ajax="false">{% trans "Login" %}</a>{% else %}@@ -106,20 +133,20 @@</li>{% if user.is_authenticated %}- <li {% if active_tab == 'workout' %}class="active"{% endif %}>+ <li><a href="{% url 'wger.manager.views.workout.overview' %}">{% trans "Workouts" %}</a></li>- <li class="dropdown {% if active_tab == 'nutrition' %}active{% endif %}">+ <li><a href="{% url 'wger.nutrition.views.plan.overview' %}">{% trans "Nutrition" %}</a></li>{% endif %}{% if not user.is_authenticated %}- <li class="dropdown {% if active_tab == 'software' %}active{% endif %}">+ <li><a href="{% url 'software:features' %}">{% trans "Features" %}</a>- </li>- {% endif %}- </ul>+ </li>+ {% endif %}+ </ul></div></div><!-- /page -->diff --git a/wger/manager/templates/mobile/workout/view.html b/wger/manager/templates/mobile/workout/view.htmlindex 018e7ff3e..c985fb3a4 100644--- a/wger/manager/templates/mobile/workout/view.html+++ b/wger/manager/templates/mobile/workout/view.html@@ -110,8 +110,9 @@ $(document).on('pageinit', function () {<h3>{% trans "Options" %}</h3><a href="{% url 'wger.manager.pdf.workout_log' workout.id %}"- target="_blank"- data-role="button">+ data-role="button"+ data-ajax="false"+ class="pdf-button"><img src="{% static 'images/icons/save.svg' %}"width="32"height="32"@@ -121,8 +122,7 @@ $(document).on('pageinit', function () {</a><a href="{% url 'workout-edit' workout.id %}"- data-role="button"- data-ajax="false">+ data-role="button"><img src="{% static 'images/icons/edit.svg' %}"width="32"height="32"diff --git a/wger/software/templates/functions.html b/wger/software/templates/functions.htmlindex 1aeaecf9b..b9b1e3ffa 100644--- a/wger/software/templates/functions.html+++ b/wger/software/templates/functions.html@@ -45,7 +45,7 @@ If you don't want to see the comments for correct execution, you can hidethem.{% endblocktrans %}</p></div></div>-+<div class="item"><img src="{% static 'images/screen2-crop.png' %}" width="700"><div class="carousel-caption">@@ -155,10 +155,11 @@ do.{% endblocktrans %}</p><a name="pdf-export"></a><h3>{% trans "PDF export" %}</h3>-<p>{% blocktrans %}It can also generate a PDF with your current routine.-This is suitable for printing so you can bring it to the gym and keep a log-for 7 weeks. In case you wonder how it looks like,-<a href="/static/pdf/workout-pdf-1.0.3-en.pdf">here's a sample</a>.{% endblocktrans %}</p>+{% with link='href="/static/pdf/nutrition-plan-pdf-1.0-en.pdf" data-ajax="false" class="pdf-button"' %}+<p>{% blocktrans %}It can also be downloaded as a PDF you can keep on your+fridge, so you don't forget to follow the plan... And as with the workout+log, <a {{link}}>here's a sample</a>.{% endblocktrans %}</p>+{% endwith %}<a name="exercise-log"></a><h3>{% trans "Exercise log" %}</h3>@@ -230,9 +231,11 @@ keep track of what you actually ate during the day and how it compares towhat the plan says. It simply shows you the nutritional values of the planyou create.{% endblocktrans %}</p>+{% with link='href="/static/pdf/nutrition-plan-pdf-1.0-en.pdf" data-ajax="false" class="pdf-button"' %}<p>{% blocktrans %}It can also be downloaded as a PDF you can keep on yourfridge, so you don't forget to follow the plan... And as with the workout-log, <a href="/static/pdf/nutrition-plan-pdf-1.0-en.pdf">here's a sample</a>.{% endblocktrans %}</p>+log, <a {{link}}>here's a sample</a>.{% endblocktrans %}</p>+{% endwith %}{% endblock %}@@ -247,7 +250,7 @@ log, <a href="/static/pdf/nutrition-plan-pdf-1.0-en.pdf">here's a sample</a>.{%<li><a href="#workout-schedules">{% trans "Workout schedules" %}</a></li></ul></li>-+<li><a href="#muscle-exercise-db">{% trans "Muscle and exercise database" %}</a></li>diff --git a/wger/software/templates/mobile/functions.html b/wger/software/templates/mobile/functions.htmlindex a68652da5..e81a0923d 100644--- a/wger/software/templates/mobile/functions.html+++ b/wger/software/templates/mobile/functions.html@@ -120,10 +120,12 @@ do.{% endblocktrans %}</p><a name="pdf-export"></a><h3>{% trans "PDF export" %}</h3>+{% with link='href="/static/pdf/workout-pdf-1.0.3-en.pdf" data-ajax="false" class="pdf-button"' %}<p>{% blocktrans %}It can also generate a PDF with your current routine.This is suitable for printing so you can bring it to the gym and keep a logfor 7 weeks. In case you wonder how it looks like,-<a href="/static/pdf/workout-pdf-1.0.3-en.pdf">here's a sample</a>.{% endblocktrans %}</p>+<a {{link}}>here's a sample</a>.{% endblocktrans %}</p>+{% endwith %}<a name="exercise-log"></a><h3>{% trans "Exercise log" %}</h3>@@ -197,9 +199,11 @@ keep track of what you actually ate during the day and how it compares towhat the plan says. It simply shows you the nutritional values of the planyou create.{% endblocktrans %}</p>+{% with link='href="/static/pdf/nutrition-plan-pdf-1.0-en.pdf" data-ajax="false" class="pdf-button"' %}<p>{% blocktrans %}It can also be downloaded as a PDF you can keep on yourfridge, so you don't forget to follow the plan... And as with the workout-log, <a href="/static/pdf/nutrition-plan-pdf-1.0-en.pdf">here's a sample</a>.{% endblocktrans %}</p>+log, <a {{link}}>here's a sample</a>.{% endblocktrans %}</p>+{% endwith %}{% endblock %}