From 9b87126f0f1acb9321fbb25fe2ec981c57d63fb7 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Thu, 17 May 2012 12:40:27 -0600 Subject: [PATCH] Generate commit messages when using live preview. --- .../public/gollum/livepreview/index.html | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/gollum/frontend/public/gollum/livepreview/index.html b/lib/gollum/frontend/public/gollum/livepreview/index.html index 637710ab..1a38ceef 100644 --- a/lib/gollum/frontend/public/gollum/livepreview/index.html +++ b/lib/gollum/frontend/public/gollum/livepreview/index.html @@ -74,23 +74,29 @@ window.onload = function() { $.save = function() { // if &create=true then handle create instead of edit. var create = $.key("create"); + var POST = "POST"; + var pageName = $.key("page"); + var markdown = "markdown"; + var txt = editorSession.getValue(); + var msg = pageName + " ("+markdown+")" + var newLocation = location + "/" + pageName; if (create) { jQuery.ajax({ - type: "POST", - url: "/create", - data: { page: $.key("page"), format: "markdown", content: editorSession.getValue() }, - success: function() { - window.location = window.location.origin + "/" + $.key("page"); - } + type: POST, + url: "/create", + data: { page: pageName, format: markdown, content: txt, message: "Created " + msg }, + success: function() { + window.location = newLocation; + } }); } else { jQuery.ajax({ - type: "POST", - url: "/edit/" + $.key("page"), - data: { format: "markdown", content: editorSession.getValue() }, - success: function() { - window.location = window.location.origin + "/" + $.key("page"); + type: POST, + url: "/edit/" + pageName, + data: { format: markdown, content: txt, message: "Updated " + msg }, + success: function() { + window.location = newLocation; } }); } // end else