Skip to content

Commit

Permalink
Merge pull request #319 from enoodle/fix/person_csv_and_email_verific…
Browse files Browse the repository at this point in the history
…ation_print

Fix/person csv and email verification print
  • Loading branch information
enoodle authored Feb 10, 2019
2 parents 9acabda + 41ce269 commit 5489bfb
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/assets/stylesheets/forms.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}

.email_valid {
background-color: lighten($c-green, 30%);
background-color: lighten($c-green, 30%) !important;
}
.email_invalid {
background-color: lighten($c-red, 30%);
background-color: lighten($c-red, 30%) !important;
}

.menu-heading {
Expand Down
2 changes: 0 additions & 2 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ class Person < ActiveRecord::Base
scope :in_camp, -> { joins(:camp) }

def self.to_csv
humanize = lambda { |x| x ? "Yes" : "No" }
CSV.generate(headers: true) do |csv|
csv << CSV_ATTRIBUTES.map{ |attr| attr.titleize}
Person.includes(:camp, :roles).where(:camps => {:event_id => Rails.application.config.default_event}).each do |p|
csv << [
p.email, p.name, p.phone_number, p.roles.pluck(:identifier).join("|"),
p.camp.en_name, p.camp.id,
humanize.call(p.needs_early_arrival), humanize.call(p.has_ticket)
]
end
end
Expand Down
1 change: 0 additions & 1 deletion app/views/camps/_person_fields.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
const email_field = event.target;
if (email_field.value != '') {
verify_email(email_field.value, function (valid) {
console.log(`email is valid: ${valid}`);
if (!valid) {
email_field.classList.remove("email_valid");
email_field.classList.add("email_invalid");
Expand Down
2 changes: 1 addition & 1 deletion spec/models/person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

def person_to_line(p)
[p.email, p.name, p.phone_number, p.roles.pluck(:identifier).join('|'),
camp.en_name, camp.id.to_s, "Yes", "No"]
camp.en_name, camp.id.to_s]
end

describe "#self.to_csv" do
Expand Down

0 comments on commit 5489bfb

Please sign in to comment.