Skip to content

Commit

Permalink
Enhanced the previous/next links to work in the application
Browse files Browse the repository at this point in the history
  • Loading branch information
dpobel committed Oct 30, 2015
1 parent 7e6f510 commit 6b54490
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion Resources/public/js/views/ezconf-listview.js
Expand Up @@ -15,14 +15,29 @@ YUI.add('ezconf-listview', function (Y) {
'.ezconf-list-location': {
// tap is 'fast click' (touch friendly)
'tap': '_navigateToLocation'
}
},
'.ezconf-list-page-link': {
'tap': '_navigateToOffset'
},
},

initializer: function () {
console.log("Hey, I'm the list view");
this.containerTemplate = '<div class="ez-view-ezconflistview"/>';
},

_navigateToOffset: function (e) {
var offset = e.target.getData('offset');

e.preventDefault();
this.fire('navigateTo', {
routeName: 'eZConfListOffset',
routeParams: {
offset: offset,
},
});
},

_navigateToLocation: function (e) {
var link = e.target;

Expand Down
4 changes: 2 additions & 2 deletions Resources/views/List/list.html.twig
Expand Up @@ -19,14 +19,14 @@
<ul class="ezconf-list-pagination">
<li class="ezconf-list-page ezconf-list-previous">
{% if previous is not same as(false) %}
<a href="{{ path('list', {offset: previous}) }}">&laquo; Previous</a>
<a href="{{ path('list', {offset: previous}) }}" class="ezconf-list-page-link" data-offset="{{ previous }}">&laquo; Previous</a>
{% else %}
<span>&laquo; Previous</span>
{% endif %}
</li>
<li class="ezconf-list-page ezconf-list-next">
{% if next %}
<a href="{{ path('list', {offset: next}) }}">Next &raquo;</a>
<a href="{{ path('list', {offset: next}) }}" class="ezconf-list-page-link" data-offset="{{ next }}">Next &raquo;</a>
{% else %}
<span>Next &raquo;</span>
{% endif %}
Expand Down

0 comments on commit 6b54490

Please sign in to comment.