This commit is contained in:
Nicolas Bally 2021-05-19 22:25:59 +02:00
parent e2eae6a0c5
commit 890fe60187
4 changed files with 17 additions and 6 deletions

View File

@ -49,7 +49,7 @@ class Admin::SheetsController < ApplicationController
if params[:sheet_filter]
@sheets = Sheet.search_by_params(params[:sheet_filter])
else
@sheets = Sheet.all(:limit => 100)
@sheets = Sheet.limit(100).all
end
end

View File

@ -0,0 +1,11 @@
module LinkToFunctionHelper
def link_to_function(name, *args, &block)
html_options = args.extract_options!.symbolize_keys
function = block_given? ? update_page(&block) : args[0] || ''
onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function}; return false;"
href = html_options[:href] || '#'
content_tag(:a, name, html_options.merge(:href => href, :onclick => onclick))
end
end

View File

@ -5,8 +5,8 @@
%td
%h4 Dernier renouvellement :
-last_year= SheetYear.find(:first, :order => "year DESC").year
-first_year= SheetYear.find(:first, :order => "year ASC").year
-last_year= SheetYear.order("year DESC").first.year
-first_year= SheetYear.order("year ASC").first.year
-y = last_year
#sheet_years_search_years
%p
@ -28,7 +28,7 @@
%a{:href => "#", :onclick => "$('#cities input:checkbox').attr('checked', false);return false"} Tout désélectionner
-Sheet.find(:all, :group => :city, :order => :city).each do |c|
-Sheet.group(:city).order(:city).all.each do |c|
=check_box_tag "sheet_filter[sheet_city][]", c.city, (true if params[:sheet_filter] and params[:sheet_filter][:sheet_city] and params[:sheet_filter][:sheet_city].include?(c.city))
=c.city
%br

View File

@ -1,5 +1,5 @@
-last_year= SheetYear.find(:first, :order => "year DESC").year
-first_year= SheetYear.find(:first, :order => "year ASC").year
-last_year= SheetYear.order("year DESC").first.year
-first_year= SheetYear.order("year ASC").first.year
-y = last_year
#stat_years