diff options
-rwxr-xr-x | dockerfiles/build.sh | 3 | ||||
-rw-r--r-- | dockerfiles/images/gogits/Dockerfile | 2 | ||||
-rw-r--r-- | public/js/app.js | 60 |
3 files changed, 63 insertions, 2 deletions
diff --git a/dockerfiles/build.sh b/dockerfiles/build.sh index b658db4ecd..4617da1421 100755 --- a/dockerfiles/build.sh +++ b/dockerfiles/build.sh @@ -10,6 +10,9 @@ HOST_PORT="YOUR_HOST_PORT" # The port on host, which will be redirected t # apt source, you can select 'nchc'(mirror in Taiwan) or 'aliyun'(best for mainlance China users) according to your network, if you could connect to the official unbunt mirror in a fast speed, just leave it to "". APT_SOURCE="" +# fail immediately if anything goes wrong +set -e + DOCKER_BIN=$(which docker.io || which docker) if [ -z "$DOCKER_BIN" ] ; then echo "Please install docker. You can install docker by running \"wget -qO- https://get.docker.io/ | sh\"." diff --git a/dockerfiles/images/gogits/Dockerfile b/dockerfiles/images/gogits/Dockerfile index 1f67d41ed9..a171e15e3b 100644 --- a/dockerfiles/images/gogits/Dockerfile +++ b/dockerfiles/images/gogits/Dockerfile @@ -13,7 +13,7 @@ ENV GOPATH /go RUN apt-get update && apt-get install --yes --force-yes curl git mercurial zip wget ca-certificates build-essential RUN apt-get install -yq vim sudo -RUN curl -s http://docker.u.qiniudn.com/go1.2.1.src.tar.gz | tar -v -C /usr/local -xz +RUN curl -sL https://golang.org/dl/go1.3.linux-amd64.tar.gz | tar -v -C /usr/local -xz RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1 RUN go get -u -d github.com/gogits/gogs diff --git a/public/js/app.js b/public/js/app.js index 6f4676f624..eb3eb6b5a7 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -520,6 +520,50 @@ function initIssue() { }); }()); + // store unsend text in session storage. + (function() { + var $textArea = $("#issue-content,#issue-reply-content"); + var current = ""; + + if ($textArea == null || !('sessionStorage' in window)) { + return; + } + + var path = location.pathname.split("/"); + var key = "issue-" + path[1] + "-" + path[2] + "-"; + + if (/\/issues\/\d+$/.test(location.pathname)) { + key = key + path[4]; + } else { + key = key + "new"; + } + + if ($textArea.val() !== undefined && $textArea.val() !== "") { + sessionStorage.setItem(key, $textArea.val()); + } else { + $textArea.val(sessionStorage.getItem(key) || ""); + + if ($textArea.attr("id") == "issue-reply-content") { + var $closeBtn = $('#issue-close-btn'); + var $openBtn = $('#issue-open-btn'); + + if ($textArea.val().length) { + $closeBtn.val($closeBtn.data("text")); + $openBtn.val($openBtn.data("text")); + } else { + $closeBtn.val($closeBtn.data("origin")); + $openBtn.val($openBtn.data("origin")); + } + } + } + + $textArea.on("keyup", function() { + if ($textArea.val() !== current) { + sessionStorage.setItem(key, current = $textArea.val()); + } + }); + }()); + // Preview for images. (function() { var $hoverElement = $("<div></div>"); @@ -659,8 +703,22 @@ function initIssue() { $button.text("An error encoured!") return; - } + } + + if (!('sessionStorage' in window)) { + return; + } + + var path = location.pathname.split("/"); + var key = "issue-" + path[1] + "-" + path[2] + "-"; + + if (/\/issues\/\d+$/.test(location.pathname)) { + key = key + path[4]; + } else { + key = key + "new"; + } + sessionStorage.removeItem(key); window.location.href = response.data; }); |