Browse Source

Fix #199

pull/251/head
Unknown 11 years ago
parent
commit
fb0972afad
  1. 2
      gogs.go
  2. 4
      public/js/app.js
  3. 7
      routers/repo/release.go
  4. 2
      templates/VERSION
  5. 4
      templates/release/new.tmpl

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.4.3.0610 Alpha" const APP_VER = "0.4.3.0612 Alpha"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

4
public/js/app.js

@ -705,8 +705,8 @@ function initRelease() {
(function () { (function () {
$('[data-ajax-name=release-preview]').on("click", function () { $('[data-ajax-name=release-preview]').on("click", function () {
var $this = $(this); var $this = $(this);
$this.toggleAjax(function (json) { $this.toggleAjax(function (resp) {
$($this.data("preview")).html(json.ok ? json.content : "no content"); $($this.data("preview")).html(resp);
}, function () { }, function () {
$($this.data("preview")).html("no content"); $($this.data("preview")).html("no content");
}) })

7
routers/repo/release.go

@ -23,7 +23,12 @@ func (rs *ReleaseSorter) Len() int {
} }
func (rs *ReleaseSorter) Less(i, j int) bool { 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) { func (rs *ReleaseSorter) Swap(i, j int) {

2
templates/VERSION

@ -1 +1 @@
0.4.3.0610 Alpha 0.4.3.0612 Alpha

4
templates/release/new.tmpl

@ -41,12 +41,12 @@
</div> </div>
<ul class="nav nav-tabs" data-init="tabs"> <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-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> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="release-textarea"> <div class="tab-pane active" id="release-textarea">
<div class="form-group"> <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> </div>
<div class="tab-pane release-preview-content" id="release-preview">loading...</div> <div class="tab-pane release-preview-content" id="release-preview">loading...</div>

Loading…
Cancel
Save