Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add search repository on dashboard. #773

Merged
merged 1 commit into from
Jan 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ collaborative_repos = Collaborative Repositories
my_orgs = My Organizations
my_mirrors = My Mirrors
view_home = View %s
search_repos = Find a repository ...

issues.in_your_repos = In your repositories

Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_zh-HK.ini
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ collaborative_repos=參與協作的儲存庫
my_orgs=我的組織
my_mirrors=我的鏡像
view_home=訪問 %s
search_repos = 搜尋儲存庫 ...

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

Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_zh-TW.ini
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ collaborative_repos=參與協作的儲存庫
my_orgs=我的組織
my_mirrors=我的鏡像
view_home=訪問 %s
search_repos = 搜尋儲存庫 ...

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

Expand Down
9 changes: 9 additions & 0 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1464,4 +1464,13 @@ function selectRange($list, $select, $from) {
$(function () {
if ($('.user.signin').length > 0) return;
$('form').areYouSure();

$("#search_repo").on('change paste keyup',function(){
var value = $(this).val();
if(!value){
$('.list-search-style').html('');
} else{
$('.list-search-style').html('.search-list li:not([data-title*="' + value + '"]) {display: none;}');
}
});
});
1 change: 1 addition & 0 deletions templates/base/head.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
{{if .RequireDropzone}}
<link rel="stylesheet" href="{{AppSubUrl}}/plugins/dropzone-4.2.0/dropzone.css">
{{end}}
<style class="list-search-style"></style>
</head>
<body>
<div class="full height">
Expand Down
11 changes: 7 additions & 4 deletions templates/user/dashboard/dashboard.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<a class="item" data-tab="mirrors">{{.i18n.Tr "mirror"}}</a>
</div>
<div class="ui tab active list" data-tab="repos">
<div class="ui fluid input">
<input id="search_repo" name="q" value="" placeholder="{{.i18n.Tr "home.search_repos"}}" autofocus="">
</div>
<h4 class="ui top attached header">
{{.i18n.Tr "home.my_repos"}} <span class="ui grey label">{{.ContextUser.NumRepos}}</span>
<div class="ui right">
Expand All @@ -25,9 +28,9 @@
</div>
</h4>
<div class="ui attached table segment">
<ul class="repo-owner-name-list">
<ul class="repo-owner-name-list search-list">
{{range .Repos}}
<li {{if .IsPrivate}}class="private"{{end}}>
<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>
Expand All @@ -50,9 +53,9 @@
{{.i18n.Tr "home.collaborative_repos"}}
</h4>
<div class="ui attached table segment">
<ul id="collaborative-repo-list">
<ul id="collaborative-repo-list" class="search-list">
{{range .CollaborativeRepos}}
<li {{if .IsPrivate}}class="private"{{end}}>
<li {{if .IsPrivate}}class="private"{{end}} data-title="{{.Name}}">
<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">
Expand Down