|
|
@ -92,6 +92,7 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{ |
|
|
|
"DiffTypeToStr": DiffTypeToStr, |
|
|
|
"DiffTypeToStr": DiffTypeToStr, |
|
|
|
"DiffLineTypeToStr": DiffLineTypeToStr, |
|
|
|
"DiffLineTypeToStr": DiffLineTypeToStr, |
|
|
|
"ShortSha": ShortSha, |
|
|
|
"ShortSha": ShortSha, |
|
|
|
|
|
|
|
"Oauth2Icon": Oauth2Icon, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type Actioner interface { |
|
|
|
type Actioner interface { |
|
|
@ -109,7 +110,7 @@ func ActionIcon(opType int) string { |
|
|
|
switch opType { |
|
|
|
switch opType { |
|
|
|
case 1: // Create repository.
|
|
|
|
case 1: // Create repository.
|
|
|
|
return "plus-circle" |
|
|
|
return "plus-circle" |
|
|
|
case 5: // Commit repository.
|
|
|
|
case 5, 9: // Commit repository.
|
|
|
|
return "arrow-circle-o-right" |
|
|
|
return "arrow-circle-o-right" |
|
|
|
case 6: // Create issue.
|
|
|
|
case 6: // Create issue.
|
|
|
|
return "exclamation-circle" |
|
|
|
return "exclamation-circle" |
|
|
@ -127,6 +128,7 @@ const ( |
|
|
|
TPL_CREATE_ISSUE = `<a href="/user/%s">%s</a> opened issue <a href="/%s/issues/%s">%s#%s</a> |
|
|
|
TPL_CREATE_ISSUE = `<a href="/user/%s">%s</a> opened issue <a href="/%s/issues/%s">%s#%s</a> |
|
|
|
<div><img src="%s?s=16" alt="user-avatar"/> %s</div>` |
|
|
|
<div><img src="%s?s=16" alt="user-avatar"/> %s</div>` |
|
|
|
TPL_TRANSFER_REPO = `<a href="/user/%s">%s</a> transfered repository <code>%s</code> to <a href="/%s">%s</a>` |
|
|
|
TPL_TRANSFER_REPO = `<a href="/user/%s">%s</a> transfered repository <code>%s</code> to <a href="/%s">%s</a>` |
|
|
|
|
|
|
|
TPL_PUSH_TAG = `<a href="/user/%s">%s</a> pushed tag <a href="/%s/src/%s">%s</a> at <a href="/%s">%s</a>` |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
type PushCommit struct { |
|
|
|
type PushCommit struct { |
|
|
@ -174,6 +176,8 @@ func ActionDesc(act Actioner) string { |
|
|
|
case 8: // Transfer repository.
|
|
|
|
case 8: // Transfer repository.
|
|
|
|
newRepoLink := content + "/" + repoName |
|
|
|
newRepoLink := content + "/" + repoName |
|
|
|
return fmt.Sprintf(TPL_TRANSFER_REPO, actUserName, actUserName, repoLink, newRepoLink, newRepoLink) |
|
|
|
return fmt.Sprintf(TPL_TRANSFER_REPO, actUserName, actUserName, repoLink, newRepoLink, newRepoLink) |
|
|
|
|
|
|
|
case 9: // Push tag.
|
|
|
|
|
|
|
|
return fmt.Sprintf(TPL_PUSH_TAG, actUserName, actUserName, repoLink, branch, branch, repoLink, repoLink) |
|
|
|
default: |
|
|
|
default: |
|
|
|
return "invalid type" |
|
|
|
return "invalid type" |
|
|
|
} |
|
|
|
} |
|
|
@ -197,3 +201,19 @@ func DiffLineTypeToStr(diffType int) string { |
|
|
|
} |
|
|
|
} |
|
|
|
return "same" |
|
|
|
return "same" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func Oauth2Icon(t int) string { |
|
|
|
|
|
|
|
switch t { |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
return "fa-github-square" |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
return "fa-google-plus-square" |
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
return "fa-twitter-square" |
|
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
return "fa-linux" |
|
|
|
|
|
|
|
case 5: |
|
|
|
|
|
|
|
return "fa-weibo" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "" |
|
|
|
|
|
|
|
} |
|
|
|