ソースを参照

More changes

tags/v0.9.99
evolvedlight 9年前
コミット
29ac3980ff
2個のファイルの変更15行の追加1行の削除
  1. 13
    0
      models/repo.go
  2. 2
    1
      templates/repo/header.tmpl

+ 13
- 0
models/repo.go ファイルの表示

return RepoPath(repo.Owner.Name, repo.Name) return RepoPath(repo.Owner.Name, repo.Name)
} }


func (repo *Repository) IsOwnedBy(u *User) bool {
return repo.OwnerId == u.Id
}

// DescriptionHtml does special handles to description and return HTML string. // DescriptionHtml does special handles to description and return HTML string.
func (repo *Repository) DescriptionHtml() template.HTML { func (repo *Repository) DescriptionHtml() template.HTML {
sanitize := func(s string) string { sanitize := func(s string) string {
sess.Rollback() sess.Rollback()
return err return err
} }
if repo.IsFork {
if _, err = sess.Exec("UPDATE `repository` SET num_forks = num_forks - 1 WHERE id = ?", repo.ForkId); err != nil {
sess.Rollback()
return err
}
}


if _, err = sess.Exec("UPDATE `user` SET num_repos = num_repos - 1 WHERE id = ?", uid); err != nil { if _, err = sess.Exec("UPDATE `user` SET num_repos = num_repos - 1 WHERE id = ?", uid); err != nil {
sess.Rollback() sess.Rollback()
LowerName: oldRepo.LowerName, LowerName: oldRepo.LowerName,
Description: oldRepo.Description, Description: oldRepo.Description,
IsPrivate: oldRepo.IsPrivate, IsPrivate: oldRepo.IsPrivate,
IsFork: true,
ForkId: oldRepo.Id,
} }
if _, err = sess.Insert(repo); err != nil { if _, err = sess.Insert(repo); err != nil {

+ 2
- 1
templates/repo/header.tmpl ファイルの表示

</a> </a>
</li> </li>
<li id="repo-header-fork"> <li id="repo-header-fork">
<a id="repo-header-fork-btn" href="{{.RepoLink}}/action/fork">
<a id="repo-header-fork-btn" {{if not .IsRepositoryOwner}} href="{{.RepoLink}}/action/fork"{{end}}>
<button class="btn btn-gray text-bold btn-radius"> <button class="btn btn-gray text-bold btn-radius">
<i class="octicon octicon-repo-forked"></i>{{.i18n.Tr "repo.fork"}} <i class="octicon octicon-repo-forked"></i>{{.i18n.Tr "repo.fork"}}
<span class="num">{{.Repository.NumForks}}</span> <span class="num">{{.Repository.NumForks}}</span>
</button> </button>
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>

読み込み中…
キャンセル
保存