summaryrefslogtreecommitdiffstats
path: root/public/js
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-29 21:16:06 +0800
committerFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-29 21:16:06 +0800
commitecce694d77756264864b03e6b06077592ed1676a (patch)
treee5bf86b7be0cacc065e940fb5dfcffac2242b347 /public/js
parent035facc5641e879b693982f6f4ada1d82915da82 (diff)
downloadgitea-ecce694d77756264864b03e6b06077592ed1676a.tar.gz
gitea-ecce694d77756264864b03e6b06077592ed1676a.zip
issue content ajax preview
Diffstat (limited to 'public/js')
-rw-r--r--public/js/app.js61
1 files changed, 41 insertions, 20 deletions
diff --git a/public/js/app.js b/public/js/app.js
index b03d9070a7..58bda9895e 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -399,21 +399,24 @@ function initRepository() {
function initInstall() {
// database type change
- $('#install-database').on("change", function () {
- var val = $(this).val();
- if (val != "sqlite") {
- $('.server-sql').show();
- $('.sqlite-setting').addClass("hide");
- if (val == "pgsql") {
- $('.pgsql-setting').removeClass("hide");
+ (function () {
+ $('#install-database').on("change", function () {
+ var val = $(this).val();
+ if (val != "sqlite") {
+ $('.server-sql').show();
+ $('.sqlite-setting').addClass("hide");
+ if (val == "pgsql") {
+ $('.pgsql-setting').removeClass("hide");
+ } else {
+ $('.pgsql-setting').addClass("hide");
+ }
} else {
- $('.pgsql-setting').addClass("hide");
+ $('.server-sql').hide();
+ $('.sqlite-setting').removeClass("hide");
}
- } else {
- $('.server-sql').hide();
- $('.sqlite-setting').removeClass("hide");
- }
- });
+ });
+ }());
+
}
function initIssue() {
@@ -445,14 +448,32 @@ function initIssue() {
}());
// issue ajax update
- $('.issue-edit-save').on("click", function () {
- $(this).toggleAjax(function(json){
- if(json.ok){
- $('.issue-head h1.title').text(json.title);
- $('.issue-main > .issue-content .content').html(json.content);
- }
+ (function () {
+ $('.issue-edit-save').on("click", function () {
+ $(this).toggleAjax(function (json) {
+ if (json.ok) {
+ $('.issue-head h1.title').text(json.title);
+ $('.issue-main > .issue-content .content').html(json.content);
+ }
+ });
});
- });
+ }());
+
+ // issue ajax preview
+ (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);
+ }
+ })
+ });
+ $('.issue-write a[data-toggle]').on("click", function () {
+ $('.issue-preview-content').html("loading...");
+ });
+ }())
+
}
(function ($) {