diff options
author | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2012-08-15 16:16:43 +0200 |
---|---|---|
committer | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2012-08-15 16:16:43 +0200 |
commit | 11ffb78a95d27ebf8ed0b238cde640028eff8e25 (patch) | |
tree | 5c9a0d4d102592db4cc0bb51352927d45c65f838 /templates/upload.html | |
parent | ed5e89436e219f0cf0f699c322f23b762d18f385 (diff) | |
download | klausuren-11ffb78a95d27ebf8ed0b238cde640028eff8e25.tar.gz klausuren-11ffb78a95d27ebf8ed0b238cde640028eff8e25.tar.bz2 klausuren-11ffb78a95d27ebf8ed0b238cde640028eff8e25.zip |
refactoring
Diffstat (limited to 'templates/upload.html')
-rw-r--r-- | templates/upload.html | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/templates/upload.html b/templates/upload.html index a248040..8683be0 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -38,13 +38,7 @@ </p> </form> - <div id="module-index"> - {% if module and module_list %} - <h4>{{module}}</h4> - {% from 'module_show.html' import render_module_list %} - {{ render_module_list(module_list)}} - {% endif %} - </div> + <div id="module-index"></div> </div> <script type="text/javascript"> @@ -52,6 +46,15 @@ var elem = $('#module_new'); var module = $('#module'); + var update_modules = function() { + var text = module.find("option:selected").text(); + $.get('/{{study}}/modules/' + text, function(data) { + $('#module-index').replaceWith($(data).find('#module-index')); + }); + }; + + update_modules(); + if(module.val() != 'new') elem.hide(); @@ -61,18 +64,13 @@ var text = current.find("option:selected").text(); if(value == 'new') { - $('#module-index').fadeOut('fast', function() { - elem.fadeIn(); - }); + $('#module-index').fadeOut('fast', function() { elem.fadeIn(); }); } else { elem.fadeOut('fast', function() { - if(value != '') { - $.get('/{{study}}/modules/' + text, function(data) { - $('#upload div').replaceWith($(data).find('#module-index')); - }); - } else { - $('#module-index').fadeOut('fast'); - } + if(value != '') + update_modules(); + else + $('#module-index').fadeOut('fast'); }); } |