diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/module_show.html | 3 | ||||
-rw-r--r-- | templates/upload.html | 32 |
2 files changed, 17 insertions, 18 deletions
diff --git a/templates/module_show.html b/templates/module_show.html index 9e7e336..ea27e05 100644 --- a/templates/module_show.html +++ b/templates/module_show.html @@ -6,7 +6,8 @@ <ul> {% for name,oid in files %} <li> - <a href="{{url_for('study_show', study = study, oid=oid)}}">{{name}}</a> + <a href="{{url_for('study_show', study = study, + oid=oid)}}">{{name|truncate(50,True)}}</a> </li> {% endfor %} </ul> 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'); }); } |