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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2010-02-18 04:16:05 UTC
  • Revision ID: matt.giuca@gmail.com-20100218041605-6s0vu7aphp105owx
ivle.fileservice_lib.listing: No longer detect not-a-working-copy errors by string matching; instead check error code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
$(document).ready(function(){
2
2
    $("#new_projectset_form").submit(add_projectset);
3
3
    $(".new_project").submit(add_project);
4
 
    $('li').slideDown();
 
4
    $('li').show();
5
5
    $('.add-project-link').click(show_add);
 
6
    $('.add-projectset-link').click(show_add);
6
7
});
7
8
 
8
9
function serializeForm(form){
18
19
 
19
20
function add_project(){
20
21
 
21
 
    $(this).slideUp();
 
22
    $(this).slideToggle('fast');
22
23
    
23
24
    function callback(xhr) {
24
25
        var response = JSON.parse(xhr.responseText);
25
26
        var projectlist = $('#projectslist_' + response.projectset_id);
26
27
        var new_element = response.html.split('\n').slice(1).join('\n');
27
 
        if (projectlist.hasClass("emptylist")){
28
 
            projectlist.children().slideUp();
29
 
            projectlist.removeClass("emptylist");
30
 
        }
31
 
        $(new_element).appendTo(projectlist).hide().slideDown();
 
28
        projectlist.children(".list_empty_indicator").remove()
 
29
        add_section = projectlist.children(".add-project");
 
30
        $(add_section).before(new_element).hide().slideDown();
32
31
    };
33
32
 
34
33
    var data = serializeForm($(this));
45
44
    function callback(xhr) {
46
45
        var response = JSON.parse(xhr.responseText);
47
46
        $('#projectset_list').append(response.html);
48
 
        $('#projectset_' + response.projectset_id).hide();
49
 
        $('#projectset_' + response.projectset_id).slideDown();
 
47
        var projectset_div = $('#projectset_' + response.projectset_id);
 
48
        projectset_div.hide();
 
49
        projectset_div.slideDown();
50
50
        $("#add_projectset").removeAttr('disabled');
 
51
        projectset_div.find(".new_project").submit(add_project);
 
52
        projectset_div.find(".add-project-link").click(show_add);
51
53
    };
52
54
 
53
55
    var data = serializeForm($("#new_projectset_form"));