diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2018-04-11 10:51:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-11 10:51:44 +0800 |
commit | bec69f702ba8ecdc9a77db34ff94b7e55879be59 (patch) | |
tree | f6791e83ddbab715dc2fc9c8e3d004faddc92f6d /templates | |
parent | 1946ce2954d49474b750938a1a6bb541f081485f (diff) | |
download | gitea-bec69f702ba8ecdc9a77db34ff94b7e55879be59.tar.gz gitea-bec69f702ba8ecdc9a77db34ff94b7e55879be59.zip |
Add topic support (#3711)
* add topic models and unit tests
* fix comments
* fix comment
* add the UI to show or add topics for a repo
* show topics on repositories list
* fix test
* don't show manage topics link when no permission
* use green basic as topic label
* fix topic label color
* remove trace content
* remove debug function
Diffstat (limited to 'templates')
-rw-r--r-- | templates/explore/repo_list.tmpl | 3 | ||||
-rw-r--r-- | templates/repo/home.tmpl | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index 041bda8d9a..16507df16a 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -17,6 +17,9 @@ </div> </div> {{if .DescriptionHTML}}<p class="has-emoji">{{.DescriptionHTML}}</p>{{end}} + <div> + {{range .Topics}}<div class="ui green basic label topic">{{.}}</div>{{end}} + </div> <p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}</p> </div> {{else}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 72212a75b6..a403ce6611 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -5,7 +5,7 @@ {{template "base/alert" .}} <div class="ui repo-description"> <div id="repo-desc"> - {{if .Repository.DescriptionHTML}}<span class="description has-emoji">{{.Repository.DescriptionHTML}}</span>{{else if .IsRepositoryAdmin}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}} + {{if .Repository.DescriptionHTML}}<span class="description has-emoji">{{.Repository.DescriptionHTML}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}} <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a> </div> {{if .RepoSearchEnabled}} @@ -23,6 +23,27 @@ </div> {{end}} </div> + <div class="ui repo-topic" id="repo-topic"> + {{range .Topics}}<div class="ui green basic label topic" style="cursor:pointer;">{{.Name}}</div>{{end}} + {{if .IsRepositoryAdmin}}<a id="manage_topic" style="cursor:pointer;margin-left:10px;">{{.i18n.Tr "repo.topic.manage_topics"}}</a>{{end}} + </div> + {{if .IsRepositoryAdmin}} + <div class="ui repo-topic-edit grid" id="topic_edit" > + <div class="fourteen wide column"> + <div class="ui fluid multiple search selection dropdown"> + <input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if lt (Add $i 1) (len $.Topics)}},{{end}}{{end}}"> + {{range .Topics}} + <a class="ui green basic label topic transition visible" data-value="{{.Name}}" style="display: inline-block !important;">{{.Name}}<i class="delete icon"></i></a> + {{end}} + <div class="text"></div> + </div> + </div> + <div class="one wide column"> + <a class="ui compact button primary" href="javascript:;" id="save_topic" + data-link="{{.RepoLink}}/topics">{{.i18n.Tr "repo.topic.done"}}</a> + </div> + </div> + {{end}} {{template "repo/sub_menu" .}} <div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins"> {{if and .PullRequestCtx.Allowed .IsViewBranch}} |