summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2017-05-08 21:31:30 -0300
committerLunny Xiao <xiaolunwen@gmail.com>2017-05-09 08:31:30 +0800
commitab79069dc79c4a816eb8d53cbd90fc38833ec117 (patch)
treea4d59642968befa76afc4330345b8eaf23028a8f /templates
parent51d0becb4232eab6b18959ccc4a895e5df30c4dc (diff)
downloadgitea-ab79069dc79c4a816eb8d53cbd90fc38833ec117.tar.gz
gitea-ab79069dc79c4a816eb8d53cbd90fc38833ec117.zip
Improve dashboard repo search (#1652)
* Add VueJS * Improve dashboard search * Fix tab switching * Fix input autofocus
Diffstat (limited to 'templates')
-rw-r--r--templates/base/footer.tmpl1
-rw-r--r--templates/base/head.tmpl3
-rw-r--r--templates/user/dashboard/dashboard.tmpl42
3 files changed, 24 insertions, 22 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
index e2494c107b..e8ad0a4d9f 100644
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -65,5 +65,6 @@
<script src="{{AppSubUrl}}/js/libs/autolink.js"></script>
<script src="{{AppSubUrl}}/js/libs/emojify-1.1.0.min.js"></script>
<script src="{{AppSubUrl}}/js/libs/clipboard-1.5.9.min.js"></script>
+ <script src="{{AppSubUrl}}/js/libs/vue.js"></script>
</body>
</html>
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index a80075513d..68a7e43b69 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -11,6 +11,9 @@
<meta name="referrer" content="no-referrer" />
<meta name="_csrf" content="{{.CsrfToken}}" />
<meta name="_suburl" content="{{AppSubUrl}}" />
+ {{if .IsSigned}}
+ <meta name="_uid" content="{{.SignedUser.ID}}" />
+ {{end}}
{{if .GoGetImport}}
<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">
<meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}">
diff --git a/templates/user/dashboard/dashboard.tmpl b/templates/user/dashboard/dashboard.tmpl
index d2714273b9..014a37bc2f 100644
--- a/templates/user/dashboard/dashboard.tmpl
+++ b/templates/user/dashboard/dashboard.tmpl
@@ -7,17 +7,17 @@
<div class="ten wide column">
{{template "user/dashboard/feeds" .}}
</div>
- <div class="six wide column">
+ <div id="dashboard-repo-search" class="six wide column">
<div class="ui {{if not .ContextUser.IsOrganization}}three{{else}}two{{end}} item tabable menu">
- <a class="item active" data-tab="repos">{{.i18n.Tr "repository"}}</a>
+ <a :class="{item: true, active: tab === 'repos'}" @click="changeTab('repos')">{{.i18n.Tr "repository"}}</a>
{{if not .ContextUser.IsOrganization}}
- <a class="item" data-tab="orgs">{{.i18n.Tr "organization"}}</a>
+ <a :class="{item: true, active: tab === 'orgs'}" @click="changeTab('orgs')">{{.i18n.Tr "organization"}}</a>
{{end}}
- <a class="item" data-tab="mirrors">{{.i18n.Tr "mirror"}}</a>
+ <a :class="{item: true, active: tab === 'mirrors'}" @click="changeTab('mirrors')">{{.i18n.Tr "mirror"}}</a>
</div>
- <div class="ui tab active list" data-tab="repos">
+ <div v-if="tab === 'repos'" class="ui tab active list">
<div class="ui fluid input">
- <input id="search_repo" name="q" value="" placeholder="{{.i18n.Tr "home.search_repos"}}" autofocus="">
+ <input @keyUp="searchKeyUp" v-model="searchQuery" id="search_repo" placeholder="{{.i18n.Tr "home.search_repos"}}">
</div>
<h4 class="ui top attached header">
{{.i18n.Tr "home.my_repos"}} <span class="ui grey label">{{.ContextUser.NumRepos}}</span>
@@ -29,18 +29,16 @@
</div>
</h4>
<div class="ui attached table segment">
- <ul class="repo-owner-name-list search-list">
- {{range .Repos}}
- <li {{if .IsPrivate}}class="private"{{end}} data-title="{{.Name}}">
- <a href="{{AppSubUrl}}/{{$.ContextUser.Name}}/{{.Name}}">
- <i class="octicon octicon-{{if .IsFork}}repo-forked{{else if .IsPrivate}}lock{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
- <strong class="text truncate item-name">{{.Name}}</strong>
- <span class="ui right text light grey">
- {{.NumStars}} <i class="octicon octicon-star rear"></i>
- </span>
- </a>
- </li>
- {{end}}
+ <ul class="repo-owner-name-list">
+ <li v-for="repo in repos" :class="{'private': repo.private}">
+ <a :href="'{{AppSubUrl}}/' + repo.full_name">
+ <i :class="repoClass(repo)"></i>
+ <strong class="text truncate item-name"><% repo.full_name %></strong>
+ <span class="ui right text light grey">
+ <% repo.stars_count %> <i class="octicon octicon-star rear"></i>
+ </span>
+ </a>
+ </li>
{{if gt .ContextUser.NumRepos .MaxShowRepoNum}}
<li>
<a href="{{.ContextUser.HomeLink}}">{{.i18n.Tr "home.show_more_repos"}}</a>
@@ -54,9 +52,9 @@
{{.i18n.Tr "home.collaborative_repos"}}
</h4>
<div class="ui attached table segment">
- <ul id="collaborative-repo-list" class="search-list">
+ <ul id="collaborative-repo-list">
{{range .CollaborativeRepos}}
- <li {{if .IsPrivate}}class="private"{{end}} data-title="{{.Name}}">
+ <li {{if .IsPrivate}}class="private"{{end}}>
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">
<i class="octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
<span class="text truncate owner-and-repo">
@@ -74,7 +72,7 @@
</div>
{{if not .ContextUser.IsOrganization}}
- <div class="ui tab list" data-tab="orgs">
+ <div v-if="tab === 'orgs'" class="ui tab active list">
<h4 class="ui top attached header">
{{.i18n.Tr "home.my_orgs"}} <span class="ui grey label">{{.ContextUser.GetOrganizationCount}}</span>
<div class="ui right">
@@ -102,7 +100,7 @@
</div>
{{end}}
- <div class="ui tab list" data-tab="mirrors">
+ <div v-if="tab === 'mirrors'" class="ui tab active list">
<h4 class="ui top attached header">
{{.i18n.Tr "home.my_mirrors"}} <span class="ui grey label">{{.MirrorCount}}</span>
<div class="ui right">