Skip to content

Commit 20fef7b

Browse files
committed
show more info in searchcode match list hover
1 parent edc71fe commit 20fef7b

8 files changed

Lines changed: 53 additions & 15 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: 20160216055846
2+
# Build: 20160216065753
33

44
CACHE:
55
resources/fonts/Dressedless_Three.svg

‎index.html‎

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

‎static/app/html/main.html‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ <h5><span class="label label-primary">real-world usage</span> <span class="label
3030
<input type="search" name="search" class="form-control" placeholder="2016 gravitational 引力波">
3131
</form>
3232
<span class="input-group-btn">
33-
<button class="btn btn-secondary search" type="button" data-toggle="tooltip" data-placement="left" data-trigger="manual" title="Click here to show more">Search</button>
34-
<a class="btn btn-secondary hidden-sm-down help" href="https://github.com/unbug/codelf/issues?q=is%3Aissue+is%3Aclosed" target="_blank">WTF?</a>
33+
<button class="btn btn-secondary search" type="button" data-toggle="tooltip" data-placement="left" data-trigger="manual" title="Click here to show more">
34+
<i class="fa fa-search normal"></i>
35+
<i class="fa fa-search-plus more"></i>
36+
</button>
37+
<a class="btn btn-secondary hidden-sm-down help" href="https://github.com/unbug/codelf/issues?q=is%3Aissue+is%3Aclosed" target="_blank"><i class="fa fa-question-circle"></i></a>
3538
</span>
3639
</div>
3740
<section class="plugins text-muted">

‎static/app/html/sourcecode.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
</button>
1414
<div class="dropdown-menu">
1515
<script type="text/html">
16-
<div class="dropdown-item">
17-
<button type="button" class="btn btn-primary-outline btn-sm variable-btns__code" data-id="{id}">Codes</button>
18-
<a class="btn btn-primary-outline btn-sm" href="{repo}" target="_blank">Repo</a>
16+
<div class="dropdown-item" title="{repoName}">
17+
<button type="button" class="btn btn-primary-outline btn-sm variable-btns__code" data-id="{id}" title="{repoFilePath}">Codes</button>
18+
<a class="btn btn-primary-outline btn-sm" href="{repo}" target="_blank" title="{repo}">Repo</a>
1919
<span class="label label-{label_type}">{lang}</span>
2020
</div>
2121
</script>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ html, body {
171171
-webkit-overflow-scrolling: touch;
172172
-webkit-transform: translate3d(0, 0, 0);
173173
transform: translate3d(0, 0, 0); }
174+
.search-form button.search .more {
175+
display: none; }
176+
.search-form button.search.more .normal {
177+
display: none; }
178+
.search-form button.search.more .more {
179+
display: inline-block; }
174180

175181
.search-relate a:hover {
176182
text-decoration: underline; }

‎static/app/scss/_main.scss‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@
6161
-webkit-overflow-scrolling: touch;
6262
transform: translate3d(0, 0, 0);
6363
}
64+
button.search{
65+
.more{
66+
display: none;
67+
}
68+
&.more{
69+
.normal{
70+
display: none;
71+
}
72+
.more{
73+
display: inline-block;
74+
}
75+
}
76+
}
6477
}
6578
.search-relate a:hover {
6679
text-decoration: underline;

‎static/app/src/AppBundle.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,15 @@
398398
var prop = els.storeRelatedProperties[name] = els.storeRelatedProperties[name] || {
399399
ids: [],
400400
repos: [],
401+
repoNames: [],
402+
repoFilePaths: [],
401403
languages: []
402404
};
403405
if (!Util.isInArray(prop['ids'], res.id)) {
404406
prop['ids'].push(res.id);
405407
prop['repos'].push(res.repo);
408+
prop['repoNames'].push(res.name);
409+
prop['repoFilePaths'].push(res.repo+(res.location||'').substring(1)+'/'+res.filename);
406410
prop['languages'].push(res.language);
407411
}
408412
}
@@ -497,7 +501,7 @@
497501

498502
function renderSearchBtn(str) {
499503
var val = els.searchInput.val().trim();
500-
els.searchBtn.html(str ? str : (((val.length && val == els.lastInputVal) ? 'More' : 'Search')));
504+
els.searchBtn.removeClass('more').addClass((str || (val.length && val != els.lastInputVal)) ? '' : 'more');
501505
}
502506

503507
function renderSearchResultHeader(cls) {
@@ -601,12 +605,16 @@
601605
if (prop) {
602606
var ids = prop['ids'],
603607
repos = prop['repos'],
608+
repoNames = prop['repoNames'],
609+
repoFilePaths = prop['repoFilePaths'],
604610
langs = prop['languages'],
605611
i = 0, len = ids.length;
606612
for (i; i < len; i++) {
607613
htm.push(
608614
els.sourceCodeModalDropdownTpl.replace(/\{id\}/g, ids[i])
609615
.replace(/\{repo\}/g, repos[i])
616+
.replace(/\{repoName\}/g, repoNames[i])
617+
.replace(/\{repoFilePath\}/g, repoFilePaths[i])
610618
.replace(/\{lang\}/g, langs[i])
611619
.replace(/\{label_type\}/g, Model.beanHelpersModel.getRandomLabelType())
612620
);

‎static/app/src/View.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,15 @@ function storeRelatedProperty(name, res) {
343343
var prop = els.storeRelatedProperties[name] = els.storeRelatedProperties[name] || {
344344
ids: [],
345345
repos: [],
346+
repoNames: [],
347+
repoFilePaths: [],
346348
languages: []
347349
};
348350
if (!Util.isInArray(prop['ids'], res.id)) {
349351
prop['ids'].push(res.id);
350352
prop['repos'].push(res.repo);
353+
prop['repoNames'].push(res.name);
354+
prop['repoFilePaths'].push(res.repo+(res.location||'').substring(1)+'/'+res.filename);
351355
prop['languages'].push(res.language);
352356
}
353357
}
@@ -442,7 +446,7 @@ function renderSearchResult(data) {
442446

443447
function renderSearchBtn(str) {
444448
var val = els.searchInput.val().trim();
445-
els.searchBtn.html(str ? str : (((val.length && val == els.lastInputVal) ? 'More' : 'Search')));
449+
els.searchBtn.removeClass('more').addClass((str || (val.length && val != els.lastInputVal)) ? '' : 'more');
446450
}
447451

448452
function renderSearchResultHeader(cls) {
@@ -546,12 +550,16 @@ function renderRelatedProperty(name) {
546550
if (prop) {
547551
var ids = prop['ids'],
548552
repos = prop['repos'],
553+
repoNames = prop['repoNames'],
554+
repoFilePaths = prop['repoFilePaths'],
549555
langs = prop['languages'],
550556
i = 0, len = ids.length;
551557
for (i; i < len; i++) {
552558
htm.push(
553559
els.sourceCodeModalDropdownTpl.replace(/\{id\}/g, ids[i])
554560
.replace(/\{repo\}/g, repos[i])
561+
.replace(/\{repoName\}/g, repoNames[i])
562+
.replace(/\{repoFilePath\}/g, repoFilePaths[i])
555563
.replace(/\{lang\}/g, langs[i])
556564
.replace(/\{label_type\}/g, Model.beanHelpersModel.getRandomLabelType())
557565
);

0 commit comments

Comments
 (0)