Skip to content

Commit

Permalink
Merge branch 'master' into farhan_changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thebitguru committed Dec 24, 2016
2 parents 49a4965 + 20dc4cf commit 933e002
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 132 deletions.
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ gem 'coffee-rails', '~> 4.1.0'
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-rails', '~> 4.2.0'
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
#gem 'turbolinks'
#gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'

Expand All @@ -67,7 +67,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
group :development do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
# gem 'byebug'

Expand Down
147 changes: 71 additions & 76 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,78 +36,79 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.0)
arel (6.0.3)
autoprefixer-rails (6.5.4)
execjs
bcrypt (3.1.7)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-multiselect-rails (0.9.9)
rails (>= 4.0.0)
bootstrap-sass (3.3.1.0)
sass (~> 3.2)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bootstrap-will_paginate (0.0.10)
will_paginate
bootstrap3-datetimepicker-rails (4.0.0)
momentjs-rails (>= 2.8.1)
builder (3.2.2)
coffee-rails (4.1.0)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.8.0)
coffee-script-source (1.12.2)
concurrent-ruby (1.0.3)
debug_inspector (0.0.2)
erubis (2.7.0)
execjs (2.2.2)
execjs (2.7.0)
faker (1.4.2)
i18n (~> 0.5)
fedex (3.10.1)
httparty (>= 0.8.3)
nokogiri (>= 1.5.6)
globalid (0.3.0)
globalid (0.3.7)
activesupport (>= 4.1.0)
heroku-deflater (0.5.3)
heroku-deflater (0.6.2)
rack (>= 1.4.5)
hike (1.2.3)
httparty (0.13.7)
json (~> 1.8)
httparty (0.14.0)
multi_xml (>= 0.5.2)
i18n (0.7.0)
jbuilder (2.2.6)
activesupport (>= 3.0.0, < 5)
jbuilder (2.6.1)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jc-validates_timeliness (3.1.1)
timeliness (~> 0.3.7)
jquery-rails (4.0.3)
rails-dom-testing (~> 1.0)
jquery-rails (4.2.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-turbolinks (2.1.0)
railties (>= 3.1.0)
turbolinks
jquery-ui-rails (5.0.3)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (1.8.1)
kgio (2.9.2)
loofah (2.0.1)
json (1.8.3)
kgio (2.11.0)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.4.3)
mini_portile (0.6.2)
minitest (5.5.0)
momentjs-rails (2.9.0)
mail (2.6.4)
mime-types (>= 1.16, < 4)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.10.1)
momentjs-rails (2.15.1)
railties (>= 3.1)
multi_json (1.10.1)
multi_xml (0.5.5)
nokogiri (1.6.5)
mini_portile (~> 0.6.0)
paranoia (2.1.5)
activerecord (~> 4.0)
pg (0.18.1)
multi_json (1.12.1)
multi_xml (0.6.0)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
paranoia (2.2.0)
activerecord (>= 4.0, < 5.1)
pg (0.19.0)
possessive (1.0.1)
rack (1.6.0)
rack-test (0.6.2)
rack (1.6.5)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.0)
actionmailer (= 4.2.0)
Expand All @@ -122,64 +123,60 @@ GEM
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.3)
rails_stdout_logging (0.0.3)
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.4.2)
rdoc (4.2.0)
sass (3.4.9)
sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0)
raindrops (0.17.0)
rake (12.0.0)
rdoc (4.3.0)
sass (3.4.23)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
sdoc (0.4.1)
tilt (>= 1.1, < 3)
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
spring (1.2.0)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timeliness (0.3.7)
turbolinks (2.5.3)
coffee-rails
spring (2.0.0)
activesupport (>= 4.2)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.5)
timeliness (0.3.8)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.6.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
uglifier (3.0.4)
execjs (>= 0.3.0, < 3)
unicorn (4.8.3)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
web-console (2.0.0)
activemodel (~> 4.0)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (~> 4.0)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
will_paginate (3.0.7)

Expand All @@ -198,8 +195,7 @@ DEPENDENCIES
heroku-deflater
jbuilder (~> 2.0)
jc-validates_timeliness
jquery-rails
jquery-turbolinks
jquery-rails (~> 4.2.0)
jquery-ui-rails
momentjs-rails (>= 2.9.0)
paranoia (~> 2.0)
Expand All @@ -210,7 +206,6 @@ DEPENDENCIES
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring
turbolinks
uglifier (>= 1.3.0)
unicorn (= 4.8.3)
web-console (~> 2.0)
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// about supported directives.
//
//= require jquery
// require jquery.turbolinks
//= require jquery-ui
//= require jquery.turbolinks.js
//= require jquery_ujs
//= require bootstrap
//= require bootstrap-multiselect
//= require moment
//= require bootstrap-datetimepicker
//= require turbolinks
// require turbolinks
//= require_tree .
1 change: 0 additions & 1 deletion app/assets/javascripts/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,5 @@ function add_fields_and_close(link, association, content, parent_selector) {

function change_val(selector, value) {
$(selector).val(value);
return true;
}

45 changes: 37 additions & 8 deletions app/controllers/donations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,27 @@ def report
end

if !params[:city].empty?
organization_where = organization_where.length > 0 ? organization_where + " AND " : organization_where
organization_where += "LOWER(organizations.city) LIKE #{Organization.sanitize(params[:city].downcase + "%")}"
organization_where_city = ""
params[:city].split(",").each do |p|
organization_where_city = organization_where_city.length > 0 ? organization_where_city + " OR " : organization_where_city
organization_where_city += "LOWER(organizations.city) LIKE #{Organization.sanitize(p.strip.downcase + "%")}"
end
if organization_where_city.length > 0
organization_where = organization_where.length > 0 ? organization_where + " AND " : organization_where
organization_where += "(" + organization_where_city + ")"
end
end
if !params[:zip].empty?
organization_where = organization_where.length > 0 ? organization_where + " AND " : organization_where
organization_where += "LOWER(organizations.zip) LIKE #{Organization.sanitize(params[:zip].downcase + "%")}"
organization_where_zip = ""
params[:zip].split(",").each do |p|
organization_where_zip = organization_where_zip.length > 0 ? organization_where_zip + " OR " : organization_where_zip
organization_where_zip += "LOWER(organizations.zip) LIKE #{Organization.sanitize(p.strip.downcase + "%")}"
end
if organization_where_zip.length > 0
organization_where = organization_where.length > 0 ? organization_where + " AND " : organization_where
organization_where += "(" + organization_where_zip + ")"
end

end

@organization_donations = Donation.joins(:organization, :donation_type).where(organization_where).order("organizations.name, donations.date_received")
Expand All @@ -74,12 +89,26 @@ def report
@volunteer_report = true
volunteer_where = where_clause
if !params[:city].empty?
volunteer_where = volunteer_where.length > 0 ? volunteer_where + " AND " : volunteer_where
volunteer_where += "LOWER(volunteers.city) LIKE #{Volunteer.sanitize(params[:city].downcase + "%")}"
volunteer_where_city = ""
params[:city].split(",").each do |p|
volunteer_where_city = volunteer_where_city.length > 0 ? volunteer_where_city + " OR " : volunteer_where_city
volunteer_where_city += "LOWER(volunteers.city) LIKE #{Volunteer.sanitize(p.strip.downcase + "%")}"
end
if volunteer_where_city.length > 0
volunteer_where = volunteer_where.length > 0 ? volunteer_where + " AND " : volunteer_where
volunteer_where += "(" + volunteer_where_city + ")"
end
end
if !params[:zip].empty?
volunteer_where = volunteer_where.length > 0 ? volunteer_where + " AND " : volunteer_where
volunteer_where += "LOWER(volunteers.zip) LIKE #{Volunteer.sanitize(params[:zip].downcase + "%")}"
volunteer_where_zip = ""
params[:zip].split(",").each do |p|
volunteer_where_zip = volunteer_where_zip.length > 0 ? volunteer_where_zip + " OR " : volunteer_where_zip
volunteer_where_zip += "LOWER(volunteers.zip) LIKE #{Volunteer.sanitize(p.strip.downcase + "%")}"
end
if volunteer_where_zip.length > 0
volunteer_where = volunteer_where.length > 0 ? volunteer_where + " AND " : volunteer_where
volunteer_where += "(" + volunteer_where_zip + ")"
end
end
@volunteer_donations = Donation.joins(:volunteer, :donation_type).where("donations.volunteer_id IS NOT NULL").where(volunteer_where).order("volunteers.last_name, volunteers.first_name, donations.date_received")
end
Expand Down
1 change: 1 addition & 0 deletions app/helpers/donations_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ def get_donation_summary(objectName, id)
}]
[donation_years, donations_by_year, year_totals]
end

end
6 changes: 3 additions & 3 deletions app/views/donations/_report_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@
<div class="actions pull-right">
<% if !current_user.non_monetary %>
<%= submit_tag "Monetary Donations", class: "btn btn-primary", onclick: "change_val('.request_format','html'); change_val('.report_type', '1'); return true;" %>
<%= submit_tag "Export", class: "btn btn-primary", onclick: "change_val('.request_format','xls'); change_val('.report_type', '1');" %>
<%= submit_tag "Export", class: "btn btn-primary", onclick: "change_val('.request_format','xls'); change_val('.report_type', '1'); return true;" %>
<% end %>
<%= submit_tag "Non-Monetary Donations", class: "btn btn-primary", onclick: "change_val('.request_format','html'); change_val('.report_type', '2');; return true;" %>
<%= submit_tag "Export", class: "btn btn-primary", onclick: "change_val('.request_format','xls'); change_val('.report_type', '2');" %>
<%= submit_tag "Non-Monetary Donations", class: "btn btn-primary", onclick: "change_val('.request_format','html'); change_val('.report_type', '2'); return true;" %>
<%= submit_tag "Export", class: "btn btn-primary", onclick: "change_val('.request_format','xls'); change_val('.report_type', '2'); return true;" %>
<%= link_to 'Back', root_path, class: "btn btn-primary" %>
</div>
</div>
Expand Down
Loading

0 comments on commit 933e002

Please sign in to comment.