Skip to content

Commit 68f1196

Browse files
committed
Adicionado filtro por tópicos
1 parent 10526a0 commit 68f1196

File tree

3 files changed

+53
-12
lines changed

3 files changed

+53
-12
lines changed

_stylesheets/docs.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,38 @@ a:active, a:focus, .btn:focus,.btn:active {
1515
ie-dummy: expression(this.hideFocus=true);
1616
}
1717

18+
#myInput {
19+
background-position: 10px 12px; /* Position the search icon */
20+
background-repeat: no-repeat; /* Do not repeat the icon image */
21+
width: 100%; /* Full-width */
22+
font-size: 16px; /* Increase font-size */
23+
padding: 12px 20px 12px 40px; /* Add some padding */
24+
border: 1px solid #ddd; /* Add a grey border */
25+
margin-bottom: 12px; /* Add some space below the input */
26+
}
27+
28+
#myUL {
29+
/* Remove default list styling */
30+
list-style-type: none;
31+
padding: 0;
32+
margin: 0;
33+
}
34+
35+
#myUL li a {
36+
border: 1px solid #ddd; /* Add a border to all links */
37+
margin-top: -1px; /* Prevent double borders */
38+
background-color: #f6f6f6; /* Grey background color */
39+
padding: 12px; /* Add some padding */
40+
text-decoration: none; /* Remove default text underline */
41+
font-size: 18px; /* Increase the font-size */
42+
color: black; /* Add a black text color */
43+
display: block; /* Make it into a block element to fill the whole list */
44+
}
45+
46+
#myUL li a:hover:not(.header) {
47+
background-color: #eee; /* Add a hover effect to all links, except for headers */
48+
}
49+
1850
/*salva*/
1951
.navbar.navbar-default.navbar-openshift .navbar-brand.origin {
2052
background: url("../_images/origin_logo.png") no-repeat scroll 0% 95%;

_templates/_nav.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<ul class="nav nav-sidebar">
1+
<ul class="nav nav-sidebar" id="myUL">
22
<%- navigation.each.with_index do |topic_group, groupidx| -%>
33
<%- current_group = topic_group[:id] == group_id -%>
4-
<li class="nav-header">
4+
<li class="nav-header sarch" >
55
<a class="" href="javascript:void(0);" data-toggle="collapse" data-target="#topicGroup<%= groupidx %>">
66
<span id="tgSpan<%= groupidx %>" class="fa <%= current_group ? 'fa-angle-down' : 'fa-angle-right' %>"></span><%= topic_group[:name] %>
77
</a>

_templates/_search_origin.html.erb

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
<script>
2-
(function() {
3-
var cx = '013769182564158614814:vdyz7waqya4';
4-
var gcse = document.createElement('script');
5-
gcse.type = 'text/javascript';
6-
gcse.async = true;
7-
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//cse.google.com/cse.js?cx=' + cx;
8-
var s = document.getElementsByTagName('script')[0];
9-
s.parentNode.insertBefore(gcse, s);
10-
})();
2+
function myFunction() {
3+
// Declare variables
4+
var input, filter, ul, li, a, i;
5+
input = document.getElementById('myInput');
6+
filter = input.value.toUpperCase();
7+
ul = document.getElementById("myUL");
8+
li = ul.getElementsByClassName('sarch');
9+
10+
// Loop through all list items, and hide those who don't match the search query
11+
for (i = 0; i < li.length; i++) {
12+
a = li[i].getElementsByTagName("a")[0];
13+
if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
14+
li[i].style.display = "";
15+
} else {
16+
li[i].style.display = "none";
17+
}
18+
}
19+
}
1120
</script>
12-
<gcse:search defaultToRefinement="<%= version %>">asdsad</gcse:search>
21+
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Procure por tópicos">

0 commit comments

Comments
 (0)