From c1eb4d894a092aed1b87ddf5f80ee824fd56789d Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 5 May 2014 13:08:01 -0400 Subject: Clean api code --- public/js/app.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'public/js') diff --git a/public/js/app.js b/public/js/app.js index 59fffd36..59d44613 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -62,6 +62,12 @@ var Gogits = { var method = $(this).data('ajax-method') || 'get'; var ajaxName = $(this).data('ajax-name'); var data = {}; + + if (ajaxName.endsWith("preview")) { + data["mode"] = "gfm"; + data["context"] = $(this).data('ajax-context'); + } + $('[data-ajax-rel=' + ajaxName + ']').each(function () { var field = $(this).data("ajax-field"); var t = $(this).data("ajax-val"); @@ -547,10 +553,8 @@ function initIssue() { (function () { $('[data-ajax-name=issue-preview]').on("click", function () { var $this = $(this); - $this.toggleAjax(function (json) { - if (json.ok) { - $($this.data("preview")).html(json.content); - } + $this.toggleAjax(function (resp) { + $($this.data("preview")).html(resp); }) }); $('.issue-write a[data-toggle]').on("click", function () { -- cgit v1.2.3