Self hosted FLOSS fitness/workout, nutrition and weight tracker
Use the modal dialog to edit days on the workout view
Roland Geidercb95bf367fee
diff --git a/exercises/templates/view.html b/exercises/templates/view.htmlindex 89b09e291..82426c580 100644--- a/exercises/templates/view.html+++ b/exercises/templates/view.html@@ -10,29 +10,9 @@<script>$(document).ready(function() {-// Initialise a modal dialog- $("#ajax-info").dialog({- autoOpen: false,- width: 600,- modal: true,- });--- // Load the edit dialog when a user wants to edit an exercise- $(".modal-dialog").click(function(e) {- e.preventDefault();- targetUrl = $(this).attr("href");-- $("#ajax-info").load(targetUrl + " .ym-form", function() {-- // Initialise the WYSIWYG editor- init_tinymce();- }- );- $("#ajax-info").dialog("open");--- });++ // Init the modal dialog to edit the exercise+ form_modal_dialog();});</script>diff --git a/manager/static/js/workout-manager.js b/manager/static/js/workout-manager.jsindex 94515d76c..71a8356f6 100644--- a/manager/static/js/workout-manager.js+++ b/manager/static/js/workout-manager.js@@ -155,3 +155,35 @@ function init_tinymce () {theme : "simple"});}+++/*+ * Open a modal dialog for editing+ */+function form_modal_dialog()+{+ // Initialise a modal dialog+ $("#ajax-info").dialog({+ autoOpen: false,+ width: 600,+ modal: true,+ });+++ // Load the edit dialog when the user clicks on an edit link+ $(".modal-dialog").click(function(e) {+ e.preventDefault();+ targetUrl = $(this).attr("href");++ $("#ajax-info").load(targetUrl + " .ym-form", function() {++ // Initialise the WYSIWYG editor+ init_tinymce();+ });++ // Open the dialog+ $("#ajax-info").dialog("open");+++ });+}\ No newline at end of filediff --git a/manager/templates/tags/render_day.html b/manager/templates/tags/render_day.htmlindex 889f634ff..898adf54a 100644--- a/manager/templates/tags/render_day.html+++ b/manager/templates/tags/render_day.html@@ -10,6 +10,10 @@ $(document).ready(function() {setup_sortable();setup_ajax_set_edit();setup_inplace_editing();++ // Init the modal dialog to edit the exercise+ form_modal_dialog();+})</script>@@ -26,7 +30,8 @@ $(document).ready(function() {alt="{% trans 'Delete' %}"></a><a href="{% url manager.views.edit_day workout.id day.id %}"- title="{% trans 'Edit' %}">+ title="{% trans 'Edit' %}"+ class="modal-dialog"><img src="{% static 'images/icons/edit.svg' %}"width="22"height="22"diff --git a/manager/templates/workout/view.html b/manager/templates/workout/view.htmlindex 09b6d0c50..77f897ac6 100644--- a/manager/templates/workout/view.html+++ b/manager/templates/workout/view.html@@ -10,12 +10,13 @@<script src="{% static 'js/workout-manager.js' %}"></script><script>--$(document).ready(function() {// Allow the sets to be sortablesetup_sortable();+ // Init the modal dialog to edit the exercise+ form_modal_dialog();+// Show/Hide the comments to the exercises{% if user.userprofile.show_comments %}showComment = 1;