Skip to content

Commit

Permalink
Merge pull request #1336 from DigitalCurationCentre/issue1334
Browse files Browse the repository at this point in the history
Issue1334
  • Loading branch information
jollopre authored Mar 29, 2018
2 parents 3837a61 + d4b5e07 commit b28acb0
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/controllers/concerns/paginable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def paginable_base_url_with_query_params(page: 1, **stringify_query_params_optio
# Generates an HTML link to sort given a sort field.
# sort_field {String} - Represents the column name for a table
def paginable_sort_link(sort_field)
return link_to(sort_link_name(sort_field), sort_link_url(sort_field), 'data-remote': true)
return link_to(sort_link_name(sort_field), sort_link_url(sort_field), 'data-remote': true, class: 'paginable-action')
end
# Determines whether or not the latest request included the search functionality
def searchable?
Expand Down
2 changes: 1 addition & 1 deletion app/views/kaminari/_first_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
remote: data-remote
-%>
<span class="first">
<%= link_to_unless current_page.first?, _('First'), url, remote: remote %>
<%= link_to_unless current_page.first?, _('First'), url, remote: remote, class: 'paginable-action' %>
</span>
2 changes: 1 addition & 1 deletion app/views/kaminari/_last_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
remote: data-remote
-%>
<span class="last">
<%= link_to_unless current_page.last?, _('Last'), url, remote: remote %>
<%= link_to_unless current_page.last?, _('Last'), url, remote: remote, class: 'paginable-action' %>
</span>
2 changes: 1 addition & 1 deletion app/views/kaminari/_next_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
remote: data-remote
-%>
<span class="next">
<%= link_to_unless current_page.last?, _('Next'), url, rel: 'next', remote: remote %>
<%= link_to_unless current_page.last?, _('Next'), url, rel: 'next', remote: remote, class: 'paginable-action' %>
</span>
2 changes: 1 addition & 1 deletion app/views/kaminari/_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
remote: data-remote
-%>
<span class="page<%= ' current' if page.current? %>">
<%= link_to_unless page.current?, page, url, {remote: remote, rel: page.rel} %>
<%= link_to_unless page.current?, page, url, {remote: remote, rel: page.rel, class: 'paginable-action'} %>
</span>
2 changes: 1 addition & 1 deletion app/views/kaminari/_prev_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
remote: data-remote
-%>
<span class="prev">
<%= link_to_unless current_page.first?, _('Previous'), url, rel: 'prev', remote: remote %>
<%= link_to_unless current_page.first?, _('Previous'), url, rel: 'prev', remote: remote, class: 'paginable-action' %>
</span>
12 changes: 6 additions & 6 deletions app/views/layouts/_paginable.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@
<% if searchable? %>
<ul class="list-inline">
<% if paginable? %>
<li><%= link_to(_('View all search results'), paginable_base_url_with_query_params(page: 'ALL'), { 'data-remote': true }) %></li>
<li><%= link_to(_('View all search results'), paginable_base_url_with_query_params(page: 'ALL'), { 'data-remote': true, class: 'paginable-action' }) %></li>
<% else %>
<%= link_to(_('View less search results'), paginable_base_url_with_query_params(page: 1), { 'data-remote': true }) %>
<%= link_to(_('View less search results'), paginable_base_url_with_query_params(page: 1), { 'data-remote': true, class: 'paginable-action' }) %>
<% end %>
<li><%= link_to(_('Clear search results'), paginable_base_url_with_query_params(page: 1, search: nil), { 'data-remote': true }) %></li>
<li><%= link_to(_('Clear search results'), paginable_base_url_with_query_params(page: 1, search: nil), { 'data-remote': true, class: 'paginable-action' }) %></li>
</ul>
<% else %>
<% if paginable? %>
<%= link_to(_('View all'), paginable_base_url_with_query_params(page: 'ALL'), { 'data-remote': true }) if @paginable_options[:view_all] %>
<%= link_to(_('View all'), paginable_base_url_with_query_params(page: 'ALL'), { 'data-remote': true, class: 'paginable-action' }) if @paginable_options[:view_all] %>
<% else %>
<%= link_to(_('View less'), paginable_base_url_with_query_params(page: 1), { 'data-remote': true }) %>
<%= link_to(_('View less'), paginable_base_url_with_query_params(page: 1), { 'data-remote': true, class: 'paginable-action' }) %>
<% end %>
<% end %>
<% else %>
<% if searchable? %>
<%= link_to(_('Clear search results'), paginable_base_url_with_query_params(page: 1, search: nil), { 'data-remote': true }) %>
<%= link_to(_('Clear search results'), paginable_base_url_with_query_params(page: 1, search: nil), { 'data-remote': true, class: 'paginable-action' }) %>
<% end %>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_search.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% # locals: { search_term } %>
<%= form_tag(paginable_base_url_with_query_params(page: 1), method: :get, remote: true, class: 'form-inline') do %>
<%= form_tag(paginable_base_url_with_query_params(page: 1), method: :get, remote: true, class: 'form-inline paginable-action') do %>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon" id="search-addon">
Expand Down
2 changes: 1 addition & 1 deletion lib/assets/javascripts/utils/paginable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $(() => {
// search form submitted. Note the presence of a selector for on (e.g. a[data-remote="true"])
// so that descendant elements from .paginable-results that are added in future are also
// automatically handled.
$(paginableSelector).on('ajax:success', 'form[data-remote="true"], a[data-remote="true"]', onAjaxSuccessHandler);
$(paginableSelector).on('ajax:success', 'form.paginable-action[data-remote="true"], a.paginable-action[data-remote="true"]', onAjaxSuccessHandler);
});

export { paginableSelector as default };

0 comments on commit b28acb0

Please sign in to comment.