Created
February 19, 2013 23:17
-
-
Save Fire-Dragon-DoL/4991159 to your computer and use it in GitHub Desktop.
Gist showing kaminari functionality
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
class TripsController < ExtjsController | |
def viewer | |
if true # Ok qua non c'era questa if ma non mi va di andare a prendere in cima quella giusta | |
# ... Lunghissima e inutile configurazione della query... | |
@trips = Trip.joins(table_join_to_cache) | |
.where(trips_find_condition_values) | |
.uniq.order('begin_date ASC, title ASC') | |
.page(params[:page]) | |
.per(15) if do_search | |
end | |
respond_to do |format| | |
format.html { render } # index.html.erb | |
end | |
end | |
end |
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
<%= paginate @trips if @trips.length > 0 %> | |
<% @trips.each do |trip| %> | |
<%= render :partial => 'viewer_trip', :locals => { :trip => trip } %> | |
<% end %> | |
<% if @trips.length == 0 %> | |
<div style="text-align: center;">Nessuna escursione presente</div> | |
<% else %> | |
<%= paginate @trips %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment