Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
localsearch: replace strange config samples with working setup from i…
…rclogs-site Signed-off-by: Chris Warrick <kwpolska@gmail.com>
- Loading branch information
Showing
7 changed files
with
73 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
If you don't want to depend on Google or DuckDuckGo to implement search for you, | ||
or just want it to work even if you are offline, enable this plugin and the | ||
search will be performed client side. It uses [Tipue](http://www.tipue.com/search/) as its engine. | ||
search will be performed client side. It uses [Tipue Search](http://www.tipue.com/search/) as its engine. | ||
|
||
After you build your site, you will have several new files in assets/css and assets/js | ||
and a tipue_search.html that you can use as a basis for using this in your site. | ||
In ordrer to set up Tipue, you will need: | ||
|
||
For more information about how to customize it and use it, please refer to the tipue | ||
* the sample config from `conf.py.sample` | ||
* a page set up to render `localsearch.tmpl` (which you may customize) — | ||
an example is in `search-EXAMPLE.html` | ||
|
||
For more information about how to customize it and use it, please refer to the Tipue | ||
docs at http://www.tipue.com/search/ | ||
|
||
Tipue is under an MIT license (see MIT-LICENSE.txt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,17 @@ | ||
# This is an example that works well with Nikola's default Bootstrap3 theme. | ||
# It displays the search field in the navigation bar, and the results | ||
# in a modal dialog. | ||
import json | ||
# on a separate page (which needs to be configured, see README.md). | ||
# This snippet assumes the page ends up at /search/. | ||
|
||
SEARCH_FORM = """ | ||
<span class="navbar-form navbar-left"> | ||
<input type="text" id="tipue_search_input" class="form-control" placeholder="Search"> | ||
</span>""" | ||
<form class="navbar-form navbar-left" action="/search/" role="search"> | ||
<div class="form-group"> | ||
<input type="text" class="form-control" id="tipue_search_input" name="q" placeholder="Search" autocomplete="off"> | ||
</div> | ||
<button type="submit" class="btn btn-default">Submit</button> | ||
</form> | ||
""" | ||
|
||
EXTRA_HEAD_DATA = """ | ||
<link rel="stylesheet" type="text/css" href="/assets/css/tipuesearch.css"> | ||
""" | ||
|
||
BODY_END = """ | ||
<!-- Modal --> | ||
<div id="search-results" class="modal fade" role="dialog" style="height: 80%;"> | ||
<div class="modal-dialog"> | ||
|
||
<!-- Modal content--> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal">×</button> | ||
<h4 class="modal-title">Search Results:</h4> | ||
</div> | ||
<div class="modal-body" id="tipue_search_content" style="max-height: 600px; overflow-y: auto;"> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
<script> | ||
var siteUrl = """ + json.dumps(SITE_URL) + """ | ||
$(document).ready(function() { | ||
$.when( | ||
$.getScript( siteUrl + "/assets/js/tipuesearch_set.js" ), | ||
$.getScript( siteUrl + "/assets/js/tipuesearch.js" ), | ||
$.Deferred(function( deferred ){ | ||
$( deferred.resolve ); | ||
}) | ||
).done(function() { | ||
$('#tipue_search_input').tipuesearch({ | ||
'mode': 'json', | ||
'contentLocation': siteUrl + '/assets/js/tipuesearch_content.json' | ||
}); | ||
$('#tipue_search_input').keyup(function (e) { | ||
if (e.keyCode == 13) { | ||
$('#search-results').modal() | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
v7/localsearch/localsearch/templates/jinja/localsearch.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{# -*- coding: utf-8 -*- #} | ||
{% extends 'base.tmpl' %} | ||
{% block content %} | ||
<h1>Search</h1> | ||
<noscript>Search requires JavaScript, sorry for the inconvenience.</noscript> | ||
<div id="tipue_search_content">Use the search box in the navigation bar to search.</div> | ||
{% endblock %} | ||
|
||
{% block extra_js %} | ||
<script src="/assets/js/tipuesearch_set.js"></script> | ||
<script src="/assets/js/tipuesearch.js"></script> | ||
<script> | ||
$(document).ready(function() { | ||
$('#tipue_search_input').tipuesearch({ | ||
'mode': 'json', | ||
'contentLocation': '/assets/js/tipuesearch_content.json', | ||
'showUrl': false | ||
}); | ||
}); | ||
</script> | ||
{% endblock %} |
21 changes: 21 additions & 0 deletions
21
v7/localsearch/localsearch/templates/mako/localsearch.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## -*- coding: utf-8 -*- | ||
<%inherit file="base.tmpl"/> | ||
<%block name="content"> | ||
<h1>Search</h1> | ||
<noscript>Search requires JavaScript, sorry for the inconvenience.</noscript> | ||
<div id="tipue_search_content">Use the search box in the navigation bar to search.</div> | ||
</%block> | ||
|
||
<%block name="extra_js"> | ||
<script src="/assets/js/tipuesearch_set.js"></script> | ||
<script src="/assets/js/tipuesearch.js"></script> | ||
<script> | ||
$(document).ready(function() { | ||
$('#tipue_search_input').tipuesearch({ | ||
'mode': 'json', | ||
'contentLocation': '/assets/js/tipuesearch_content.json', | ||
'showUrl': false | ||
}); | ||
}); | ||
</script> | ||
</%block> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- | ||
.. title: Search | ||
.. slug: search | ||
.. date: 1970-01-01 00:00:00Z | ||
.. tags: | ||
.. category: | ||
.. link: | ||
.. description: | ||
.. type: text | ||
.. template: localsearch.tmpl | ||
--> | ||
|
||
<p style="display: none;">Search results appear here.</p> |