WIP commit. Changed routes to POST/PUT/DELETE on page name endpoint to be more RESTful. Check wiki dir permissions Add comments Add dummy favicon, robots.txt, humans.txt Remove create.html (wasn't being used) Fix version command
		
			
				
	
	
		
			40 lines
		
	
	
		
			No EOL
		
	
	
		
			742 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			No EOL
		
	
	
		
			742 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
$(function(){
 | 
						|
  $(".ajax-form").submit(function(e){
 | 
						|
    e.preventDefault();
 | 
						|
 | 
						|
    var submitting = 'submitting';
 | 
						|
 | 
						|
    if ($(this).data(submitting)) {
 | 
						|
      return;
 | 
						|
    }
 | 
						|
 | 
						|
    $(this).data(submitting, 1);
 | 
						|
 | 
						|
    var action = $(this).attr('action');
 | 
						|
    var method = $(this).attr('method');
 | 
						|
    var redirect = $(this).data('redirect');
 | 
						|
    var data = $(this).serialize();
 | 
						|
 | 
						|
    var req = $.ajax({
 | 
						|
      type: method,
 | 
						|
      url: action,
 | 
						|
      data: data,
 | 
						|
      dataType: 'json'
 | 
						|
    });
 | 
						|
 | 
						|
    req.done(function() {
 | 
						|
      if (redirect) {
 | 
						|
        location.href = redirect;
 | 
						|
      }
 | 
						|
    });
 | 
						|
 | 
						|
    req.fail(function(data, status, error) {
 | 
						|
      console.log(data);
 | 
						|
    });
 | 
						|
 | 
						|
    req.always(function() {
 | 
						|
      $(this).removeData(submitting);
 | 
						|
    });
 | 
						|
 | 
						|
  });
 | 
						|
}); |