From 78e252b7301254da7659fd625bfeed215b0cc013 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 7 Feb 2016 09:09:22 +0000 Subject: [PATCH] improve asciidoc and rst editing #40 --- assets/src/js/app.js | 37 +++++++++++++++++++------------------ utils/utils.go | 5 ++++- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/assets/src/js/app.js b/assets/src/js/app.js index f653e0c6..b6fb4c66 100644 --- a/assets/src/js/app.js +++ b/assets/src/js/app.js @@ -1,4 +1,23 @@ $(document).ready(function() { + // Log out the user sending bad credentials to the server + $("#logout").click(function(event) { + event.preventDefault(); + $.ajax({ + type: "GET", + url: "/admin", + async: false, + username: "username", + password: "password", + headers: { + "Authorization": "Basic xxx" + } + }).fail(function() { + window.location = "/"; + }); + return false; + }); + + $(document).pjax('a[data-pjax]', '#content'); }); @@ -20,24 +39,6 @@ $(document).on('ready pjax:success', function() { $("textarea").each(autoGrow); }); - // Log out the user sending bad credentials to the server - $("#logout").click(function(event) { - event.preventDefault(); - $.ajax({ - type: "GET", - url: "/admin", - async: false, - username: "username", - password: "password", - headers: { - "Authorization": "Basic xxx" - } - }).fail(function() { - window.location = "/"; - }); - return false; - }); - if ($('main').hasClass('browse')) { $(document).trigger("page:browse"); } diff --git a/utils/utils.go b/utils/utils.go index e20aa18b..5feb3893 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -19,7 +19,10 @@ import ( // CanBeEdited checks if a filename has a supported extension func CanBeEdited(filename string) bool { - extensions := [...]string{".markdown", ".md", + extensions := [...]string{ + "md", "markdown", "mdown", "mmark", + "asciidoc", "adoc", "ad", + "rst", ".json", ".toml", ".yaml", ".css", ".sass", ".scss", ".js",