Changeset c82fe79 in OpenWorkouts-current for ow/templates/add_workout.pt


Ignore:
Timestamp:
Sep 27, 2019, 1:06:35 PM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current
Children:
c081c35
Parents:
f89b2f1
Message:

(#84) Show a "loading" spinner while adding a workout by uploading a track file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/templates/add_workout.pt

    rf89b2f1 rc82fe79  
    1717
    1818  <metal:content metal:fill-slot="content">
     19
     20    <div class="uploading-workout hidden">
     21      <h2 i18n:translate="">Uploading workout, please wait...</h2>
     22      <p i18n:translate="">
     23        This can take a moment, depending on the size of your tracking file and your connection speed. Be patient and please don't hit the stop or go back buttons on your browser.
     24      </p>
     25      <img src="" alt="Loading workout" i18n:attributes="alt"
     26           tal:attributes="src request.static_url('ow:static/media/img/loading.gif')">
     27    </div>
     28
    1929    <div class="upload-workout ow-forms">
    2030      <a href="" class="back"
    21            tal:attributes="href request.resource_url(context)"
    22            i18n:translate="">Back</a>
     31         tal:attributes="href request.resource_url(context)"
     32         i18n:translate="">Back</a>
    2333      <h2 i18n:translate="">Upload workout file</h2>
    24         ${form.begin(multipart=True)}
    25         ${form.csrf_token()}
     34      ${form.begin(multipart=True)}
     35      ${form.csrf_token()}
    2636
    2737      <tal:is_duplicate tal:condition="duplicate is not None">
     
    107117
    108118      ${form.end()}
    109     </div>
     119        </div>
    110120
    111121  </metal:content>
    112122
     123  <metal:body-js metal:fill-slot="body-js">
     124    <script>
     125        $(document).ready(function(){
     126            $("div.upload-workout form").on("submit", function(){
     127                console.log('Showing spinner');
     128                $("div.upload-workout").fadeOut();
     129                $("div.uploading-workout").fadeIn();
     130            });
     131        });
     132    </script>
     133  </metal:body-js>
     134
     135
    113136</html>
Note: See TracChangeset for help on using the changeset viewer.