Skip to content

Commit 0e90d5e

Browse files
committed
Replace training with doc_section for search
1 parent a18f60a commit 0e90d5e

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

docs/_static/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ div.section {
120120
#search-form input[type="submit"] {
121121
margin-right: 1rem;
122122
}
123-
ul.search .title_training::before {
123+
ul.search .title_doc_section::before {
124124
content: ' – ';
125125
}
126126
p.search-summary {

docs/_static/searchtools.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ var Search = {
7878
var query = params.q[0];
7979
$('input[name="q"]')[0].value = query;
8080
$('input[name="q"]')[1].value = query;
81-
if (params.training) {
82-
var training = params.training[0];
83-
$('select[name="training"]')[0].value = training;
81+
if (params.doc_section) {
82+
var doc_section = params.doc_section[0];
83+
$('select[name="doc_section"]')[0].value = doc_section;
8484
}
85-
this.performSearch(query, training);
85+
this.performSearch(query, doc_section);
8686
}
8787
},
8888

@@ -136,7 +136,7 @@ var Search = {
136136
/**
137137
* perform a search for something (or wait until index is loaded)
138138
*/
139-
performSearch : function(query, training) {
139+
performSearch : function(query, doc_section) {
140140
// create the required interface elements
141141
this.out = $('#search-results');
142142
this.title = $('').appendTo(this.out);
@@ -149,7 +149,7 @@ var Search = {
149149

150150
// index already loaded, the browser was quick!
151151
if (this.hasIndex()) {
152-
this.query(query, training);
152+
this.query(query, doc_section);
153153
} else {
154154
this.deferQuery(query);
155155
}
@@ -158,7 +158,7 @@ var Search = {
158158
/**
159159
* execute search (requires search index to be loaded)
160160
*/
161-
query : function(query, training) {
161+
query : function(query, doc_section) {
162162
var i;
163163

164164
// stem the searchterms and add them to the correct list
@@ -227,15 +227,15 @@ var Search = {
227227
results[i][4] = Scorer.score(results[i]);
228228
}
229229

230-
// Filter results by training
231-
if (training && training !== 'all') {
230+
// Filter results by doc_section
231+
if (doc_section && doc_section !== 'all') {
232232
results = results.filter(result => {
233-
let condition = result[0].split('/')[0] === training;
233+
let condition = result[0].split('/')[0] === doc_section;
234234
return condition
235235
})
236236
}
237237

238-
// Enrich item with parent training title
238+
// Enrich item with parent doc_section title
239239
for (i = 0; i < results.length; i++)
240240
results[i][6] = results[i][6] || 'TODO Documentation title';
241241

@@ -287,7 +287,7 @@ var Search = {
287287
linkUrl +
288288
highlightstring + item[2]).html(item[1]));
289289

290-
listItem.append($('<span class="title_training">' + item[6] + '</span>'));
290+
listItem.append($('<span class="title_doc_section">' + item[6] + '</span>'));
291291

292292
if (item[3]) {
293293
listItem.append($('<span> (' + item[3] + ')</span>'));
@@ -505,7 +505,7 @@ var Search = {
505505
function getParentTitle(f) {
506506
let parentdocname = docnames[f].split('/')[0] + '/index';
507507
let parentID = docnames.indexOf(parentdocname);
508-
let title = parentID === -1 ? 'Training' : titles[parentID];
508+
let title = parentID === -1 ? 'Plone Documentation' : titles[parentID];
509509
return title
510510
}
511511
results.push([docnames[file], titles[file], '', null, score, filenames[file], getParentTitle(file)]);
@@ -545,7 +545,7 @@ var Search = {
545545
$(document).ready(function() {
546546
Search.init();
547547

548-
$('select[name="training"]').change(function() {
548+
$('select[name="doc_section"]').change(function() {
549549
this.form.submit();
550550
});
551551
});

docs/_templates/search.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ <h1 id="search-documentation">{{ _('Search') }}</h1>
4646

4747
<input type="submit" value="{{ _('search') }}" />
4848

49-
<label for="training" class="visuallyhidden">Filter by training</label>
50-
<select name="training" id="training">
49+
<label for="doc_section" class="visuallyhidden">Filter by section</label>
50+
<select name="doc_section" id="doc_section">
5151
<option value="all">All Documentation</option>
5252
{% for id, title in
5353
[

0 commit comments

Comments
 (0)