Add sort direction

This commit is contained in:
Sébastien Lucas 2012-06-20 22:33:57 +02:00
parent 1935e05c9c
commit cfcafdf7e4
2 changed files with 11 additions and 8 deletions

View file

@ -45,7 +45,12 @@
$("#sort").click(function(){ $("#sort").click(function(){
$('.book').sortElements(function(a, b){ $('.book').sortElements(function(a, b){
return $(a).find ("." + $("#sortchoice").val()).text() > $(b).find ("." + $("#sortchoice").val()).text() ? 1 : -1; var test = 1;
if ($("#sortorder").val() == "desc")
{
test = -1;
}
return $(a).find ("." + $("#sortchoice").val()).text() > $(b).find ("." + $("#sortchoice").val()).text() ? test : -test;
}); });
$("#search").slideUp(); $("#search").slideUp();
}); });
@ -105,12 +110,16 @@
<input type="image" src="images/search32.png" alt="Search" /> <input type="image" src="images/search32.png" alt="Search" />
</form> </form>
<form action="index.php?page=9" method="get"> <form action="index.php?page=9" method="get">
<select id="sortchoice"> <select id="sortchoice" style="width: 183px">
<option value="st"><?php echo localize("bookword.title") ?></option> <option value="st"><?php echo localize("bookword.title") ?></option>
<option value="sa"><?php echo localize("authors.title") ?></option> <option value="sa"><?php echo localize("authors.title") ?></option>
<option value="ss"><?php echo localize("series.title") ?></option> <option value="ss"><?php echo localize("series.title") ?></option>
<option value="sp"><?php echo localize("content.published") ?></option> <option value="sp"><?php echo localize("content.published") ?></option>
</select> </select>
<select id="sortorder" style="width: 60px">
<option value="asc">Asc</option>
<option value="desc">Desc</option>
</select>
<img id="sort" src="images/sort32.png" alt="Sort" /> <img id="sort" src="images/sort32.png" alt="Sort" />
</form> </form>
</div> </div>

View file

@ -220,12 +220,6 @@ vertical-align: middle;
width: 242px; width: 242px;
} }
.search select
{
width: 248px;
}
.bookpopup .bookpopup
{ {
min-width: 400px; min-width: 400px;