1
0
Fork 0
forked from forgejo/forgejo

Clean api code

This commit is contained in:
Unknown 2014-05-05 13:08:01 -04:00
parent 5f653898f3
commit c1eb4d894a
20 changed files with 277 additions and 121 deletions

View file

@ -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 () {