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
This commit is contained in:
Matthew Scragg 2014-10-20 17:27:38 -05:00
parent b99128e47a
commit e6bc4928c9
13 changed files with 321 additions and 144 deletions

0
realms/static/humans.txt Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -2,6 +2,8 @@ var $entry_markdown_header = $("#entry-markdown-header");
var $entry_preview_header = $("#entry-preview-header");
var $entry_markdown = $(".entry-markdown");
var $entry_preview = $(".entry-preview");
var $page_name = $("#page-name");
var $page_message = $("#page-message");
// Tabs
$entry_markdown_header.click(function(){
@ -66,12 +68,26 @@ var aced = new Aced({
info: Commit.info,
submit: function(content) {
var data = {
name: $("#page-name").val(),
message: $("#page-message").val(),
name: $page_name.val(),
message: $page_message.val(),
content: content
};
$.post(window.location, data, function() {
location.href = Config['RELATIVE_PATH'] + '/' + data['name'];
var path = Config['RELATIVE_PATH'] + '/' + data['name'];
var type = (Commit.info['sha']) ? "PUT" : "POST";
$.ajax({
type: type,
url: path,
data: data,
dataType: 'json'
}).always(function(data, status, error) {
if (data && data['error']) {
$page_name.addClass('parsley-error');
bootbox.alert("<h3>" + data['message'] + "</h3>");
} else {
location.href = path;
}
});
}
});

40
realms/static/js/main.js Normal file
View file

@ -0,0 +1,40 @@
$(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);
});
});
});

0
realms/static/robots.txt Normal file
View file