Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Show a loading icon while fetching content for modal dialogs

Roland Geider724bff31aeab
diff --git a/manager/static/images/loader.svg b/manager/static/images/loader.svg
new file mode 100644
index 000000000..efc79451d
--- /dev/null
+++ b/manager/static/images/loader.svg
@@ -0,0 +1,45 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1"
+ viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+
+<!--
+Preloader scalable graphics
+author: Jorge C. S. Cardoso
+date: 2012 Oct 07
+-->
+
+<g>
+ <defs>
+ <clipPath id="clip">
+ <path d="M 50 50 L 35 0 L 65 0 z" />
+ </clipPath>
+
+ <ellipse id= "MyEllipse" clip-path="url(#clip)" cx="50" cy="50" rx="40" ry="40" style="fill:none; stroke:#aaa" stroke-width="10" />
+ </defs>
+
+
+<use xlink:href="#MyEllipse" />
+<use xlink:href="#MyEllipse" transform="rotate(40 50 50)" />
+<use xlink:href="#MyEllipse" transform="rotate(80 50 50)" />
+<use xlink:href="#MyEllipse" transform="rotate(120 50 50)"/>
+<use xlink:href="#MyEllipse" transform="rotate(160 50 50)"/>
+<use xlink:href="#MyEllipse" transform="rotate(200 50 50)"/>
+<use xlink:href="#MyEllipse" transform="rotate(240 50 50)"/>
+<use xlink:href="#MyEllipse" transform="rotate(280 50 50)"/>
+<use xlink:href="#MyEllipse" transform="rotate(320 50 50)"/>
+
+
+<ellipse clip-path="url(#clip)" cx="50" cy="50" rx="40" ry="40" style="fill:none; stroke:#FF6633" stroke-width="12" >
+ <animateTransform attributeName="transform" attributeType="XML"
+ type="rotate" values="0 50 50; 40 50 50; 80 50 50; 120 50 50; 160 50 50; 200 50 50; 240 50 50; 280 50 50; 320 50 50; 360 50 50"
+ dur="1s"
+ repeatCount="indefinite"
+ additive="replace"
+ calcMode="discrete"
+ fill="freeze"/>
+</ellipse>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/manager/static/js/workout-manager.js b/manager/static/js/workout-manager.js
index c4f333510..be85538c1 100644
--- a/manager/static/js/workout-manager.js
+++ b/manager/static/js/workout-manager.js
@@ -216,6 +216,14 @@ function form_modal_dialog()
e.preventDefault();
var targetUrl = $(this).attr("href");
+ // Show a loader while we fetch the real page
+ $("#ajax-info").html('<div style="text-align:center;">'+
+ '<img src="/static/images/loader.svg" ' +
+ 'width="48" ' +
+ 'height="48"> ' +
+ '</div>');
+ $("#ajax-info").dialog("open");
+
$("#ajax-info").load(targetUrl + " .ym-form", function(responseText, textStatus) {
// Call other custom initialisation functions
// (e.g. if the form as an autocompleter, it has to be initialised again)
@@ -226,7 +234,7 @@ function form_modal_dialog()
// Set its title and open the dialog
$("#ajax-info").dialog({title: $(responseText).find("#main-content h2").html()});
- $("#ajax-info").dialog("open");
+ //$("#ajax-info").dialog("open");
});
});
}