-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added pagination template, ajax-enabled js and instructions
- Loading branch information
Showing
4 changed files
with
94 additions
and
1 deletion.
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
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,28 @@ | ||
$ = jQuery | ||
$.fn.xiSearchPaginate = (options) -> | ||
defaultOptions = | ||
page: '#xi_searchbundle_searchtype_page' | ||
submit: '#xi_searchbundle_searchtype_submit' | ||
term: '#xi_searchbundle_searchtype_term' | ||
indices: [] | ||
|
||
options = $.extend true, {}, defaultOptions, options | ||
|
||
# change page | ||
@.on "click", ".pagination a", -> | ||
pageValue = $(this).attr("data-page") | ||
$(options.page).val pageValue | ||
$(options.submit).find("button").trigger "click", silent: true | ||
|
||
# reset page | ||
$(options.term).change -> | ||
$(options.page).val 1 | ||
|
||
if options.indices | ||
for index in options.indices | ||
$(index).change -> | ||
$(options.page).val 1 | ||
|
||
$(options.submit).find("button").click (event, data) -> | ||
unless data and data.silent | ||
$(options.page).val 1 |
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,40 @@ | ||
{# default Sliding pagination control implementation #} | ||
|
||
{% if pageCount > 1 %} | ||
<div class="pages"> | ||
{% if first is defined and current != first %} | ||
<span class="first"> | ||
<a href="#main-content" data-page="{{first}}"><<</a> | ||
</span> | ||
{% endif %} | ||
|
||
{% if previous is defined %} | ||
<span class="previous"> | ||
<a href="#main-content" data-page="{{previous}}"><</a> | ||
</span> | ||
{% endif %} | ||
|
||
{% for page in pagesInRange %} | ||
{% if page != current %} | ||
<span class="page"> | ||
<a href="#main-content" data-page="{{ page }}">{{ page }}</a> | ||
</span> | ||
{% else %} | ||
<span class="current">{{ page }}</span> | ||
{% endif %} | ||
|
||
{% endfor %} | ||
|
||
{% if next is defined %} | ||
<span class="next"> | ||
<a href="#main-content" data-page="{{next}}">></a> | ||
</span> | ||
{% endif %} | ||
|
||
{% if last is defined and current != last %} | ||
<span class="last"> | ||
<a href="#main-content" data-page="{{last}}">>></a> | ||
</span> | ||
{% endif %} | ||
</div> | ||
{% endif %} |
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,7 +1,7 @@ | ||
<form action="{{ path('XiSearchBundle_search') }}" class="ajax-form article-form" method="post" {{ form_enctype(form) }}> | ||
{{ form_widget(form.term, { 'attr': {'placeholder' : ('search.form.term.placeholder')|trans} }) }} | ||
{{ form_rest(form) }} | ||
<p> | ||
<p id="xi_searchbundle_searchtype_submit"> | ||
<button type="submit">{{'search.form.submit_button'|trans}}</button> | ||
</p> | ||
</form> |