File tree 3 files changed +34
-1
lines changed
3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 41
41
</h4>
42
42
<div class="ui attached segment repos-search">
43
43
<div class="ui fluid right action left icon input" :class="{loading: isLoading}">
44
- <input @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" placeholder="{{.locale.Tr "home.search_repos"}}">
44
+ <input @input="changeReposFilter(reposFilter)" v-on:keyup.enter="onSearchEnter" v-on:keyup.down="onSearchDown" v-on:keyup.up="onSearchUp" v- model="searchQuery" ref="search" placeholder="{{.locale.Tr "home.search_repos"}}">
45
45
<i class="icon df ac jc">{{svg "octicon-search" 16}}</i>
46
46
<div class="ui dropdown icon button" title="{{.locale.Tr "home.filter"}}">
47
47
<i class="icon df ac jc m-0">{{svg "octicon-filter" 16}}</i>
Original file line number Diff line number Diff line change @@ -189,12 +189,41 @@ function initVueComponents(app) {
189
189
}
190
190
} ,
191
191
192
+ onSearchEnter ( ) {
193
+ if ( this . searchQuery . length > 0 ) {
194
+ const items = document . getElementsByClassName ( 'repo-list-link' ) ;
195
+ items [ this . repoIndex ] . click ( ) ;
196
+ }
197
+ } ,
198
+
199
+ onSearchDown ( ) {
200
+ if ( this . repoIndex + 1 < this . repos . length ) {
201
+ const items = document . getElementsByClassName ( 'repo-list-link' ) ;
202
+ items [ this . repoIndex ] . classList . remove ( 'selected' ) ;
203
+ this . repoIndex ++ ;
204
+ items [ this . repoIndex ] . classList . add ( 'selected' ) ;
205
+ }
206
+ } ,
207
+
208
+ onSearchUp ( ) {
209
+ if ( this . repoIndex > 0 ) {
210
+ const items = document . getElementsByClassName ( 'repo-list-link' ) ;
211
+ items [ this . repoIndex ] . classList . remove ( 'selected' ) ;
212
+ this . repoIndex -- ;
213
+ items [ this . repoIndex ] . classList . add ( 'selected' ) ;
214
+ }
215
+ } ,
216
+
192
217
changeReposFilter ( filter ) {
193
218
this . reposFilter = filter ;
194
219
this . repos = [ ] ;
195
220
this . page = 1 ;
196
221
this . counts [ `${ filter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
197
222
this . searchRepos ( ) ;
223
+ setTimeout ( ( ) => {
224
+ const items = document . getElementsByClassName ( 'repo-list-link' ) ;
225
+ items [ 0 ] . classList . add ( 'selected' ) ;
226
+ } , 100 ) ;
198
227
} ,
199
228
200
229
updateHistory ( ) {
Original file line number Diff line number Diff line change 178
178
.star-num {
179
179
font-size : 12px ;
180
180
}
181
+
182
+ & .selected {
183
+ outline : solid 1px grey ;
184
+ }
181
185
}
182
186
}
183
187
}
You can’t perform that action at this time.
0 commit comments