diff options
author | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-05-21 20:49:47 +0800 |
---|---|---|
committer | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-05-21 20:49:47 +0800 |
commit | 1331134316e1165d68d2cb6473e16929ed794dea (patch) | |
tree | 2673a86ff25e80a3c0267fc2800dffbafe7c72bc /public/js | |
parent | 4e8a1bf9c927c6619926f09883dbb98af58587f8 (diff) | |
download | gitea-1331134316e1165d68d2cb6473e16929ed794dea.tar.gz gitea-1331134316e1165d68d2cb6473e16929ed794dea.zip |
finish issue edit content preview
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/app.js | 16 |
1 files changed, 11 insertions, 5 deletions
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"); |