-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bcf6b5f
commit 46b6722
Showing
42 changed files
with
735 additions
and
257 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
class NonAjax::UsersController < ApplicationController | ||
def index | ||
@search = User.new_search(params[:search]) | ||
@search.order_by ||= :first_name | ||
@users, @users_count = @search.all, @search.count | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
login: &login | ||
username: root | ||
password: | ||
|
||
development: | ||
adapter: mysql | ||
database: searchgasm_development | ||
encoding: utf8 | ||
socket: /tmp/mysql.sock | ||
<<: *login | ||
|
||
test: | ||
adapter: mysql | ||
database: searchgasm_test | ||
encoding: utf8 | ||
socket: /tmp/mysql.sock | ||
<<: *login | ||
|
||
production: | ||
adapter: mysql | ||
database: searchgasm_production | ||
encoding: utf8 | ||
socket: /tmp/mysql.sock | ||
<<: *login |
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
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
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,5 @@ | ||
= To Do | ||
|
||
1. Add month condition for date and datetime columns. So you can specify a specific month, by name, number, etc. | ||
2. Add day condition for time and datetime columns. So you can specify that the time is during the day or the night. | ||
3. Add weekend condition for date and datetime columns. So you can specify if the date is on a friday, saturday, or sunday |
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
15 changes: 15 additions & 0 deletions
15
vendor/plugins/searchgasm/lib/searchgasm/active_record/connection_adapters/mysql_adapter.rb
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,15 @@ | ||
module Searchgasm | ||
module ActiveRecord | ||
module ConnectionAdapters | ||
module MysqlAdapter | ||
def hour_sql | ||
"HOUR(?)" | ||
end | ||
|
||
def month_sql | ||
"MONTH(?)" | ||
end | ||
end | ||
end | ||
end | ||
end |
Empty file.
Empty file.
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
11 changes: 5 additions & 6 deletions
11
...gasm/lib/searchgasm/condition/is_blank.rb → ...rchgasm/lib/searchgasm/condition/blank.rb
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
2 changes: 1 addition & 1 deletion
2
vendor/plugins/searchgasm/lib/searchgasm/condition/does_not_equal.rb
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
32 changes: 32 additions & 0 deletions
32
vendor/plugins/searchgasm/lib/searchgasm/condition/during_evening.rb
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,32 @@ | ||
module Searchgasm | ||
module Condition | ||
class DuringEvening < Base | ||
class << self | ||
def name_for_column(column) | ||
return unless time_column?(column) | ||
super | ||
end | ||
|
||
def aliases_for_column(column) | ||
column_names = [column.name] | ||
column_names << column.name.gsub(/_(at|on)$/, "") if column.name =~ /_(at|on)$/ | ||
|
||
aliases = [] | ||
column_names.each { |column_name| aliases += ["#{column_name}_in_the_evening", "#{column_name}_in_evening", "#{column_name}_evening"] } | ||
aliases << "#{column_names.last}_during_evening" if column_names.size > 1 | ||
aliases | ||
end | ||
end | ||
|
||
def to_conditions(value) | ||
evening_start = 17 | ||
evening_end = 22 | ||
|
||
# Need to set up a funcion in each adapter for dealing with dates. Mysql uses HOUR(), sqlite uses strftime(), postgres uses date_part('hour', date). Could potentially be a pain in the ass. | ||
# Also, you could set up an hour = condition, and leverage that to do this. | ||
if value == true | ||
["#{quoted_table_name}.#{quoted_column_name} >= ? AND #{quoted_table_name}.#{quoted_column_name} <= ?", value] | ||
end | ||
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
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
Oops, something went wrong.