Fixes to search engine

Changed the search parameter from POST to GET.
Also, adapted the Baggy theme.
This commit is contained in:
tcit 2014-03-23 23:52:05 +01:00
parent a33a3d2afb
commit 2c4e7a1cea
7 changed files with 100 additions and 23 deletions

View file

@ -605,8 +605,8 @@ class Poche
break;
case 'search':
if (isset($_POST['search'])){
$search = $_POST['search'];
if (isset($_GET['search'])){
$search = $_GET['search'];
$tpl_vars['entries'] = $this->store->search($search);
$tpl_vars['nb_results'] = count($tpl_vars['entries']);
}

View file

@ -6,6 +6,9 @@
<li><a href="./?view=tags" {% if view == 'tags' %}class="current"{% endif %}>{% trans "tags" %}</a></li>
<li style="position: relative;"><a href="javascript: void(null);" id="bagit">{% trans "save a link" %}</a>
{% include '_pocheit-form.twig' %}
</li>
<li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans "search" %}</a>
{% include '_search-form.twig' %}
</li>
<li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
<li><a class="icon icon-power" href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>

View file

@ -0,0 +1,21 @@
<div id="search-form" class="messages info">
<form method="get" action="index.php">
<input type="hidden" name="view" value="search"></input>
<label><a href="javascript: void(null);" id="search-form-close">X</a>{% trans "Search" %}</label> : <input type="text" name="search" />
<input id="submit-search" type="submit" value="{% trans "Search" %} !"></input>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#search-form").hide();
$("#search").click(function(){
$("#search-form").toggle();
$("#search").toggleClass("current");
$("#search-arrow").toggleClass("arrow-down");
});
});
</script>

View file

@ -612,6 +612,56 @@ a#bagit-form-close:hover {
margin-top: 10px;
}
/* ==========================================================================
2.2 = "search for articles" popup div related styles
========================================================================== */
#search-form {
background: rgba(0,0,0,0.5);
position: absolute;
top: 0;
left: 10em;
z-index: 20;
height: 100%;
width: 100%;
margin: 0;
margin-top: -30%;
padding: 2em;
display: none;
border-left: 1px #EEE solid;
}
#search-form form {
background: #FFF;
position: absolute;
top: 0;
left: 0;
z-index: 20;
border: 10px solid #000;
width: 400px;
height: 200px;
/* margin: -150px 0 0 -300px; */
padding: 2em;
}
a#search-form-close {
background: #000;
color: #FFF;
padding: 0.2em 0.5em;
text-decoration: none;
display: inline-block;
float: right;
font-size: 1.2em;
}
a#search-form-close:hover {
background: #999;
color: #000;
}
#submit-search{
margin-left: 4em;
margin-top:1em;
}
/* ==========================================================================
3 = Pictos
========================================================================== */

View file

@ -9,4 +9,5 @@
<li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
</ul>
{% include '_pocheit-form.twig' %}
{% include '_search-form.twig' %}

View file

@ -0,0 +1,23 @@
<div id="search-form" class="messages info">
<form method="get" action="index.php">
<p>
<input type="hidden" name="view" value="search"></input>
<label>{% trans "Search" %}</label> : <input type="text" placeholder="{% trans "Enter your search here" %}" name="search" />
<input type="submit" value="{% trans "Search" %} !"></input>
</p>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#search-form").hide();
$("#search").click(function(){
$("#search-form").toggle();
$("#search").toggleClass("current");
$("#search-arrow").toggleClass("arrow-down");
});
});
</script>

View file

@ -12,28 +12,7 @@
{% include '_menu.twig' %}
{% endblock %}
{% block precontent %}
<div id="search-form" class="messages info">
<form method="post" action="index.php?view=search">
<p>
<label>{% trans "Search" %}</label> : <input type="text" placeholder="{% trans "Enter your search here" %}" name="search" />
<input type="submit" value="{% trans "Search" %} !"></input>
</p>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#search-form").hide();
$("#search").click(function(){
$("#search-form").toggle();
$("#search").toggleClass("current");
$("#search-arrow").toggleClass("arrow-down");
});
});
</script>
{% include '_sorting.twig' %}
{% endblock %}
{% block content %}