~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/subject-media/project.js

  • Committer: William Grant
  • Date: 2009-12-14 04:17:46 UTC
  • Revision ID: me@williamgrant.id.au-20091214041746-eurw04xssf4cvszc
Add ivle-dev-setup, a script to do most of the heavy lifting when setting up a new dev installation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
};
19
19
 
20
20
function add_project(){
21
 
    var add_project_form = $(this);
 
21
 
 
22
    $(this).slideToggle('fast');
 
23
    
22
24
    function callback(xhr) {
23
 
        if (xhr.status == 200) {
24
 
            add_project_form.slideToggle('fast');
25
 
            var response = JSON.parse(xhr.responseText);
26
 
            var projectlist = $('#projectslist_' + response.projectset_id);
27
 
            var new_element = response.html.split('\n').slice(1).join('\n');
28
 
            projectlist.children(".list_empty_indicator").remove()
29
 
            add_section = projectlist.children(".add-project");
30
 
            $(add_section).before(new_element).hide().slideDown();
31
 
        } else if (xhr.status == 400) {
32
 
            alert("Could not create project: " + xhr.getResponseHeader("X-IVLE-Error"));
33
 
        } else {
34
 
            alert("Project creation failed due to an internal server error.");
35
 
        }
 
25
        var response = JSON.parse(xhr.responseText);
 
26
        var projectlist = $('#projectslist_' + response.projectset_id);
 
27
        var new_element = response.html.split('\n').slice(1).join('\n');
 
28
        projectlist.children(".list_empty_indicator").remove()
 
29
        add_section = projectlist.children(".add-project");
 
30
        $(add_section).before(new_element).hide().slideDown();
36
31
    };
37
32
 
38
33
    var data = serializeForm($(this));