Skip to content

Commit 2bdbd6b

Browse files
committed
added search for bookmark all group
1 parent 15b9823 commit 2bdbd6b

5 files changed

Lines changed: 45 additions & 6 deletions

File tree

‎cache.manifest‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# Build: 20160119110213
2+
# Build: 20160119021450
33

44
CACHE:
55
resources/fonts/Dressedless_Three.svg

‎index.html‎

Lines changed: 11 additions & 3 deletions
Large diffs are not rendered by default.

‎static/app/index.html‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ <h5>Add GitHub accounts to group your stars and repos</h5>
166166
<div class="btn-group btn-group-sm pull-xs-right ctrl">
167167
<button class="btn btn-secondary btn-sm del" data-id="{id}"><i class="fa fa-trash-o"></i></button>
168168
</div>
169+
<form class="form-inline pull-xs-right search">
170+
<div class="form-group">
171+
<div class="input-group input-group-sm">
172+
<input type="text" class="form-control" placeholder="search...">
173+
<div class="input-group-addon submit"><i class="fa fa-search"></i></div>
174+
</div>
175+
</div>
176+
</form>
169177
</header>
170178
<section class="card-block repo-list collapse" id="repo_group_list_{id}" role="tabpanel" aria-labelledby="repo_group_hd_{id}">
171179
{items}
@@ -178,7 +186,7 @@ <h5>Add GitHub accounts to group your stars and repos</h5>
178186
</div>
179187
</script>
180188
<script type="text/html" data-template="repoItem">
181-
<article class="card repo-item" data-id="{id}" data-repoid="{originRepoId}">
189+
<article class="card repo-item" data-id="{id}" data-repoid="{originRepoId}" data-name="{full_name}">
182190
<div class="card-block">
183191
<header class="repo-item__hd"><h6><a href="{html_url}" target="_blank">{full_name}</a></h6></header>
184192
<section class="repo-item__bd">{description}</section>

‎static/app/resources/css/style.css‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,14 @@ html,body{
228228
.bookmark-modal .repo-item .card-footer {
229229
padding: .3rem 1.25rem;
230230
}
231-
.bookmark-modal .repo-group-item[data-id="0"]>.hd .del,
231+
.bookmark-modal .repo-group-item>.hd .search{
232+
display: none;
233+
cursor: pointer;
234+
}
235+
.bookmark-modal .repo-group-item[data-id="0"]>.hd .search{
236+
display: block;
237+
}
238+
.bookmark-modal .repo-group-item[data-id="0"]>.hd .ctrl,
232239
.bookmark-modal .repo-group-item[data-id="0"] .dropdown-menu>.dropdown-item:last-child{
233240
display: none;
234241
}

‎static/app/src/App.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,8 @@ $(function () {
889889
els.bookmarkGroupModal.on('click', '.submit', beforeAddBookmarkGroup);
890890
els.bookmarkModalContent.on('click', '.repo-group-item>.hd .ctrl .del', beforeDelBookmarkGroup);
891891
els.bookmarkModalContent.on('click', '.dropdown-item', beforeAddRepoToGroup);
892+
els.bookmarkModalContent.on('keyup','.repo-group-item>.hd .search input',renderBookmarkSearchRepos);
893+
els.bookmarkModalContent.on('click','.repo-group-item>.hd .search submit',renderBookmarkSearchRepos);
892894
els.bookmarkUserModalUserList.on('click', '.sync', function () {
893895
beforeSyncUser(this.dataset.name);
894896
});
@@ -1340,6 +1342,20 @@ $(function () {
13401342
renderBookmarkUsers(data.users);
13411343
}
13421344

1345+
function renderBookmarkSearchRepos(){
1346+
var gEl = els.bookmarkModalContent.find('.repo-group-item[data-id="0"]'),
1347+
inputEl = gEl.find('.hd .search input'),
1348+
countEl = gEl.find('.hd .count'),
1349+
val = inputEl.val().trim(),
1350+
repoEls = gEl.find('.repo-list .repo-item'),
1351+
matchRepoEls = gEl.find('.repo-list .repo-item[data-name*="'+val+'"]'),
1352+
resultRepoEls = val.length?matchRepoEls:repoEls;
1353+
1354+
repoEls.attr('hidden','true');
1355+
resultRepoEls.removeAttr('hidden');
1356+
countEl.html(resultRepoEls.length);
1357+
1358+
}
13431359
function renderBookmarkUsers(data) {
13441360
var htm = [];
13451361
data.forEach(function (key) {

0 commit comments

Comments
 (0)