Merge remote-tracking branch 'upstream/master'

This commit is contained in:
kolaente 2018-03-20 19:42:52 +01:00
commit 7a57b6d979
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
6 changed files with 20 additions and 7 deletions

View File

@ -11,6 +11,7 @@ import (
"os" "os"
"path" "path"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/util"
api "code.gitea.io/sdk/gitea" api "code.gitea.io/sdk/gitea"
@ -75,6 +76,16 @@ func (a *Attachment) Size() (int64, error) {
return fi.Size(), nil return fi.Size(), nil
} }
// MustSize returns the result of a.Size() by ignoring errors
func (a *Attachment) MustSize() int64 {
size, err := a.Size()
if err != nil {
log.Error(4, "size: %v", err)
return 0
}
return size
}
// DownloadURL returns the download url of the attached file // DownloadURL returns the download url of the attached file
func (a *Attachment) DownloadURL() string { func (a *Attachment) DownloadURL() string {
return fmt.Sprintf("%sattachments/%s", setting.AppURL, a.UUID) return fmt.Sprintf("%sattachments/%s", setting.AppURL, a.UUID)

View File

@ -173,6 +173,7 @@ code=Code
repo_no_results=Es konnten keine passenden Repositories gefunden werden. repo_no_results=Es konnten keine passenden Repositories gefunden werden.
user_no_results=Es konnten keine passenden Benutzer gefunden werden. user_no_results=Es konnten keine passenden Benutzer gefunden werden.
org_no_results=Es konnten keine passenden Organisation gefunden werden. org_no_results=Es konnten keine passenden Organisation gefunden werden.
code_no_results=Es konnte kein Code mit deinem Suchbegriff gefunden werden.
code_search_results=Suchergebnisse für "%s code_search_results=Suchergebnisse für "%s
[auth] [auth]

View File

@ -173,7 +173,7 @@ code=Kód
repo_no_results=Nem található a keresésnek megfelelő tároló. repo_no_results=Nem található a keresésnek megfelelő tároló.
user_no_results=Nem található a keresésnek megfelelő felhasználó. user_no_results=Nem található a keresésnek megfelelő felhasználó.
org_no_results=Nem található a keresésnek megfelelő szervezet. org_no_results=Nem található a keresésnek megfelelő szervezet.
code_no_results=Nem található a keresésnek megfelelő kód. code_no_results=Nem található a keresésnek megfelelő kódrészlet.
code_search_results=Keresési találatok "%s code_search_results=Keresési találatok "%s
[auth] [auth]

View File

@ -173,7 +173,7 @@ code=Код
repo_no_results=Подходящие репозитории не найдены. repo_no_results=Подходящие репозитории не найдены.
user_no_results=Подходящие пользователи не найдены. user_no_results=Подходящие пользователи не найдены.
org_no_results=Подходящие организации не найдены. org_no_results=Подходящие организации не найдены.
code_no_results=Подходящие фрагменты кода не найдены. code_no_results=Подходящие фрагменты кода по вашему запросу не найдены.
code_search_results=Результаты поиска для "%s code_search_results=Результаты поиска для "%s
[auth] [auth]

View File

@ -47,9 +47,9 @@
</div> </div>
<div class="text small"> <div class="text small">
{{if .IsViewBranch}} {{if .IsViewBranch}}
{{.i18n.Tr "repo.branch.create_from" .BranchName | Safe}} {{.i18n.Tr "repo.branch.create_from" .BranchName}}
{{else}} {{else}}
{{.i18n.Tr "repo.branch.create_from" (ShortSha .BranchName) | Safe}} {{.i18n.Tr "repo.branch.create_from" (ShortSha .BranchName)}}
{{end}} {{end}}
</div> </div>
</a> </a>

View File

@ -68,17 +68,18 @@
<ul class="list"> <ul class="list">
{{if $.Repository.UnitEnabled $.UnitTypeCode}} {{if $.Repository.UnitEnabled $.UnitTypeCode}}
<li> <li>
<a href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (ZIP)</a> <a href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><strong><i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (ZIP)</strong></a>
</li> </li>
<li> <li>
<a href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (TAR.GZ)</a> <a href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><strong><i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (TAR.GZ)</strong></a>
</li> </li>
{{end}} {{end}}
{{if .Attachments}} {{if .Attachments}}
{{range .Attachments}} {{range .Attachments}}
<li> <li>
<a target="_blank" rel="noopener" href="{{AppSubUrl}}/attachments/{{.UUID}}"> <a target="_blank" rel="noopener" href="{{AppSubUrl}}/attachments/{{.UUID}}">
<span class="ui image octicon octicon-desktop-download" title='{{.Name}}'></span> {{.Name}} <strong><span class="ui image octicon octicon-package" title='{{.Name}}'></span> {{.Name}}</strong>
<span class="ui text grey right">{{.MustSize | FileSize}}</span>
</a> </a>
</li> </li>
{{end}} {{end}}