diff --git a/public/css/gogs.css b/public/css/gogs.css index e84f31d012..96cf90b4d8 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -1244,7 +1244,7 @@ html, body { margin-bottom: 0; } -#issue-create-form .nav-tabs, #issue .issue-reply .nav-tabs { +#issue-create-form .nav-tabs, #issue .issue-reply .nav-tabs,#issue .issue-edit-content .nav-tabs { margin-bottom: 10px; } diff --git a/public/js/app.js b/public/js/app.js index e88dadc2e0..67b5a5dfc7 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -87,6 +87,7 @@ var Gogits = {}; } return true; }); + console.log("toggleAjax:", method, url, data); $.ajax({ url: url, method: method.toUpperCase(), @@ -501,17 +502,19 @@ function initIssue() { (function () { $("#issue-edit-btn").on("click", function () { $('#issue h1.title,#issue .issue-main > .issue-content .content,#issue-edit-btn').toggleHide(); - $('#issue-edit-title,#issue-edit-content,.issue-edit-cancel,.issue-edit-save').toggleShow(); + $('#issue-edit-title,.issue-edit-content,.issue-edit-cancel,.issue-edit-save').toggleShow(); }); $('.issue-edit-cancel').on("click", function () { $('#issue h1.title,#issue .issue-main > .issue-content .content,#issue-edit-btn').toggleShow(); - $('#issue-edit-title,#issue-edit-content,.issue-edit-cancel,.issue-edit-save').toggleHide(); + $('#issue-edit-title,.issue-edit-content,.issue-edit-cancel,.issue-edit-save').toggleHide(); }) }()); // issue ajax update (function () { + var $cnt = $('#issue-edit-content'); $('.issue-edit-save').on("click", function () { + $cnt.attr('data-ajax-rel', 'issue-edit-save'); $(this).toggleAjax(function (json) { if (json.ok) { $('.issue-head h1.title').text(json.title); @@ -519,12 +522,15 @@ function initIssue() { $('.issue-edit-cancel').trigger("click"); } }); + setTimeout(function () { + $cnt.attr('data-ajax-rel', 'issue-edit-preview'); + }, 200) }); }()); // issue ajax preview (function () { - $('[data-ajax-name=issue-preview]').on("click", function () { + $('[data-ajax-name=issue-preview],[data-ajax-name=issue-edit-preview]').on("click", function () { var $this = $(this); $this.toggleAjax(function (resp) { $($this.data("preview")).html(resp); @@ -533,7 +539,8 @@ function initIssue() { }) }); $('.issue-write a[data-toggle]').on("click", function () { - $('.issue-preview-content').html("loading..."); + var selector = $(this).parent().next(".issue-preview").find('a').data('preview'); + $(selector).html("loading..."); }); }()); @@ -580,7 +587,6 @@ function initIssue() { var $m = $('.milestone'); if ($m.data("milestone") > 0) { $('.clear-milestone').toggleShow(); - console.log("show"); } $('.milestone', '#issue').on('click', 'li.milestone-item', function () { var id = $(this).data("id"); diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 6ff72c19fc..8852dd08f9 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -390,6 +390,10 @@ func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat issue.AssigneeId = form.AssigneeId issue.Labels = form.Labels issue.Content = form.Content + // try get content from text, ignore conflict with preview ajax + if form.Content == "" { + issue.Content = ctx.Query("text") + } if err = models.UpdateIssue(issue); err != nil { ctx.Handle(500, "issue.UpdateIssue(UpdateIssue)", err) return diff --git a/templates/issue/view.tmpl b/templates/issue/view.tmpl index 17365e66d1..ea5777cb15 100644 --- a/templates/issue/view.tmpl +++ b/templates/issue/view.tmpl @@ -23,11 +23,29 @@
-
-
+
+
{{str2html .Issue.RenderedContent}}
- +
{{range .Comments}}