summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-06-12 09:35:51 -0400
committerUnknown <joe2010xtmf@163.com>2014-06-12 09:35:51 -0400
commitfb0972afadbd87ae707861acc0986bde01528c3c (patch)
tree83cc2a8562ebb255e11702b32d0c4b06962b45f1
parent9961f9a53c4e3be1b224ad618b35c175143a0daa (diff)
downloadgitea-fb0972afadbd87ae707861acc0986bde01528c3c.tar.gz
gitea-fb0972afadbd87ae707861acc0986bde01528c3c.zip
Fix #199
-rw-r--r--gogs.go2
-rw-r--r--public/js/app.js4
-rw-r--r--routers/repo/release.go7
-rw-r--r--templates/VERSION2
-rw-r--r--templates/release/new.tmpl4
5 files changed, 12 insertions, 7 deletions
diff --git a/gogs.go b/gogs.go
index 41a71c72e3..ebb5f8213f 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.4.3.0610 Alpha"
+const APP_VER = "0.4.3.0612 Alpha"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/public/js/app.js b/public/js/app.js
index f56718067e..2359e7ea2e 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -705,8 +705,8 @@ function initRelease() {
(function () {
$('[data-ajax-name=release-preview]').on("click", function () {
var $this = $(this);
- $this.toggleAjax(function (json) {
- $($this.data("preview")).html(json.ok ? json.content : "no content");
+ $this.toggleAjax(function (resp) {
+ $($this.data("preview")).html(resp);
}, function () {
$($this.data("preview")).html("no content");
})
diff --git a/routers/repo/release.go b/routers/repo/release.go
index 3e2449ecf3..27df3f6d16 100644
--- a/routers/repo/release.go
+++ b/routers/repo/release.go
@@ -23,7 +23,12 @@ func (rs *ReleaseSorter) Len() int {
}
func (rs *ReleaseSorter) Less(i, j int) bool {
- return rs.rels[i].NumCommits > rs.rels[j].NumCommits
+ diffNum := rs.rels[i].NumCommits - rs.rels[j].NumCommits
+ if diffNum != 0 {
+ return diffNum > 0
+ }
+
+ return rs.rels[i].Created.Second() > rs.rels[j].Created.Second()
}
func (rs *ReleaseSorter) Swap(i, j int) {
diff --git a/templates/VERSION b/templates/VERSION
index dc83da7866..1eb3e84514 100644
--- a/templates/VERSION
+++ b/templates/VERSION
@@ -1 +1 @@
-0.4.3.0610 Alpha \ No newline at end of file
+0.4.3.0612 Alpha \ No newline at end of file
diff --git a/templates/release/new.tmpl b/templates/release/new.tmpl
index 6dfe4a5c2d..06cb28c78d 100644
--- a/templates/release/new.tmpl
+++ b/templates/release/new.tmpl
@@ -41,12 +41,12 @@
</div>
<ul class="nav nav-tabs" data-init="tabs">
<li class="release-write active"><a href="#release-textarea" data-toggle="tab">Write</a></li>
- <li class="release-preview"><a href="#release-preview" data-toggle="tab" data-ajax="/api/v1/markdown?repo=repo_id&amp;release=new" data-ajax-name="release-preview" data-ajax-method="post" data-preview="#release-preview">Preview</a></li>
+ <li class="release-preview"><a href="#release-preview" data-toggle="tab" data-ajax="/api/v1/markdown" data-ajax-name="release-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#release-preview">Preview</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="release-textarea">
<div class="form-group">
- <textarea class="form-control" name="content" id="release-new-content" rows="10" placeholder="Write some content" data-ajax-rel="release-preview" data-ajax-val="val" data-ajax-field="content">{{.content}}</textarea>
+ <textarea class="form-control" name="content" id="release-new-content" rows="10" placeholder="Write some content" data-ajax-rel="release-preview" data-ajax-val="val" data-ajax-field="text">{{.content}}</textarea>
</div>
</div>
<div class="tab-pane release-preview-content" id="release-preview">loading...</div>