Browse Source

Merge pull request #296 from nuss-justin/dev

Fix issue 280 & unwatch button in Firefox
pull/295/merge
无闻 11 years ago
parent
commit
dc2e140360
  1. 12
      models/issue.go
  2. 6
      public/js/app.js
  3. 2
      templates/repo/nav.tmpl

12
models/issue.go

@ -108,7 +108,17 @@ func NewIssue(issue *Issue) (err error) {
sess.Rollback() sess.Rollback()
return err return err
} }
return sess.Commit()
if err = sess.Commit(); err != nil {
return err
}
if issue.MilestoneId > 0 {
// FIXES(280): Update milestone counter.
return ChangeMilestoneAssign(0, issue.MilestoneId, issue)
}
return
} }
// GetIssueByIndex returns issue by given index in repository. // GetIssueByIndex returns issue by given index in repository.

6
public/js/app.js

@ -406,8 +406,10 @@ function initRepository() {
// watching script // watching script
(function () { (function () {
var $watch = $('#repo-watching'), var $watch = $('#repo-watching'),
watchLink = $watch.data("watch"), watchLink = $watch.attr("data-watch"),
unwatchLink = $watch.data("unwatch"); // Use $.attr() to work around jQuery not finding $.data("unwatch") in Firefox,
// which has a method "unwatch" on `Object` that gets returned instead.
unwatchLink = $watch.attr("data-unwatch");
$watch.on('click', '.to-watch', function () { $watch.on('click', '.to-watch', function () {
if ($watch.hasClass("watching")) { if ($watch.hasClass("watching")) {
return false; return false;

2
templates/repo/nav.tmpl

@ -31,6 +31,7 @@
</div> </div>
</div> </div>
</div> </div>
{{if .IsSigned}}
<div class="btn-group {{if .IsRepositoryWatching}}watching{{else}}no-watching{{end}}" id="repo-watching" data-watch="/{{.Owner.Name}}/{{.Repository.Name}}/action/watch" data-unwatch="/{{.Owner.Name}}/{{.Repository.Name}}/action/unwatch"> <div class="btn-group {{if .IsRepositoryWatching}}watching{{else}}no-watching{{end}}" id="repo-watching" data-watch="/{{.Owner.Name}}/{{.Repository.Name}}/action/watch" data-unwatch="/{{.Owner.Name}}/{{.Repository.Name}}/action/unwatch">
{{if .IsRepositoryWatching}} {{if .IsRepositoryWatching}}
<button type="button" class="btn btn-default"><i class="fa fa-eye fa-lg fa-m"></i></button> <button type="button" class="btn btn-default"><i class="fa fa-eye fa-lg fa-m"></i></button>
@ -52,6 +53,7 @@
</div> </div>
</div> </div>
</div> </div>
{{end}}
<!-- <div class="btn-group"> <!-- <div class="btn-group">
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Star"><i class="fa fa-star"></i>&nbsp;{{.Repository.NumStars}}</button> <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Star"><i class="fa fa-star"></i>&nbsp;{{.Repository.NumStars}}</button>
</div> --> </div> -->

Loading…
Cancel
Save