Skip to content

Commit d078aa3

Browse files
appleboylunny
authored andcommitted
feat: add search repository on dashboard. (#773)
1 parent 7765593 commit d078aa3

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ collaborative_repos = Collaborative Repositories
142142
my_orgs = My Organizations
143143
my_mirrors = My Mirrors
144144
view_home = View %s
145+
search_repos = Find a repository ...
145146
146147
issues.in_your_repos = In your repositories
147148

options/locale/locale_zh-HK.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ collaborative_repos=參與協作的儲存庫
133133
my_orgs=我的組織
134134
my_mirrors=我的鏡像
135135
view_home=訪問 %s
136+
search_repos = 搜尋儲存庫 ...
136137

137138
issues.in_your_repos=屬於該用戶儲存庫的
138139

options/locale/locale_zh-TW.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ collaborative_repos=參與協作的儲存庫
133133
my_orgs=我的組織
134134
my_mirrors=我的鏡像
135135
view_home=訪問 %s
136+
search_repos = 搜尋儲存庫 ...
136137

137138
issues.in_your_repos=屬於該用戶儲存庫的
138139

public/js/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,4 +1464,13 @@ function selectRange($list, $select, $from) {
14641464
$(function () {
14651465
if ($('.user.signin').length > 0) return;
14661466
$('form').areYouSure();
1467+
1468+
$("#search_repo").on('change paste keyup',function(){
1469+
var value = $(this).val();
1470+
if(!value){
1471+
$('.list-search-style').html('');
1472+
} else{
1473+
$('.list-search-style').html('.search-list li:not([data-title*="' + value + '"]) {display: none;}');
1474+
}
1475+
});
14671476
});

templates/base/head.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
{{if .RequireDropzone}}
4646
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/dropzone-4.2.0/dropzone.css">
4747
{{end}}
48+
<style class="list-search-style"></style>
4849
</head>
4950
<body>
5051
<div class="full height">

templates/user/dashboard/dashboard.tmpl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<a class="item" data-tab="mirrors">{{.i18n.Tr "mirror"}}</a>
1616
</div>
1717
<div class="ui tab active list" data-tab="repos">
18+
<div class="ui fluid input">
19+
<input id="search_repo" name="q" value="" placeholder="{{.i18n.Tr "home.search_repos"}}" autofocus="">
20+
</div>
1821
<h4 class="ui top attached header">
1922
{{.i18n.Tr "home.my_repos"}} <span class="ui grey label">{{.ContextUser.NumRepos}}</span>
2023
<div class="ui right">
@@ -25,9 +28,9 @@
2528
</div>
2629
</h4>
2730
<div class="ui attached table segment">
28-
<ul class="repo-owner-name-list">
31+
<ul class="repo-owner-name-list search-list">
2932
{{range .Repos}}
30-
<li {{if .IsPrivate}}class="private"{{end}}>
33+
<li {{if .IsPrivate}}class="private"{{end}} data-title="{{.Name}}">
3134
<a href="{{AppSubUrl}}/{{$.ContextUser.Name}}/{{.Name}}">
3235
<i class="octicon octicon-{{if .IsFork}}repo-forked{{else if .IsPrivate}}lock{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
3336
<strong class="text truncate item-name">{{.Name}}</strong>
@@ -50,9 +53,9 @@
5053
{{.i18n.Tr "home.collaborative_repos"}}
5154
</h4>
5255
<div class="ui attached table segment">
53-
<ul id="collaborative-repo-list">
56+
<ul id="collaborative-repo-list" class="search-list">
5457
{{range .CollaborativeRepos}}
55-
<li {{if .IsPrivate}}class="private"{{end}}>
58+
<li {{if .IsPrivate}}class="private"{{end}} data-title="{{.Name}}">
5659
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">
5760
<i class="octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
5861
<span class="text truncate owner-and-repo">

0 commit comments

Comments
 (0)