summaryrefslogtreecommitdiffstats
path: root/apps/files_versioning/js/settings.js
blob: 8dd13bac033529ff130c413d9f6f9efde96d9f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$(document).ready(function(){
    $('#file_versioning_head').chosen();

    $.getJSON(OC.filePath('files_versioning', 'ajax', 'gethead.php'), function(jsondata, status) {

        if (jsondata.head == 'HEAD') {
            // Most recent commit, do nothing
        } else {
            $("#file_versioning_head").val(jsondata.head);
            // Trigger the chosen update call
            // See http://harvesthq.github.com/chosen/
            $("#file_versioning_head").trigger("liszt:updated");
        }
    });

    $('#file_versioning_head').change(function() {

        var data = $(this).serialize();
        $.post( OC.filePath('files_versioning', 'ajax', 'sethead.php'), data, function(data){
	        if(data == 'error'){
		        console.log('Saving new HEAD failed');
	        }
        });
    });
});