Skip to content

Commit

Permalink
Add comment_title and show telephone disclaimer as fields
Browse files Browse the repository at this point in the history
  • Loading branch information
feliciaan committed Jan 29, 2017
1 parent 6872b18 commit 16da59a
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 93 deletions.
67 changes: 28 additions & 39 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,34 @@
#
# Table name: events
#
# id :integer not null, primary key
# name :string
# start_date :datetime
# end_date :datetime
# location :string
# website :string
# description :text
# created_at :datetime
# updated_at :datetime
# registration_open_date :datetime
# registration_close_date :datetime
# bank_number :string
# show_ticket_count :boolean default(TRUE)
# contact_email :string
# export_file_name :string
# export_content_type :string
# export_file_size :integer
# export_updated_at :datetime
# show_statistics :boolean
# export_status :string
# club_id :integer
# registration_open :boolean default(TRUE)
# signature :text
# registration_cancelable :boolean
# phone_number_state :string default("optional")
# id :integer not null, primary key
# name :string
# start_date :datetime
# end_date :datetime
# location :string
# website :string
# description :text
# created_at :datetime
# updated_at :datetime
# registration_open_date :datetime
# registration_close_date :datetime
# bank_number :string
# show_ticket_count :boolean default(TRUE)
# contact_email :string
# export_file_name :string
# export_content_type :string
# export_file_size :integer
# export_updated_at :datetime
# show_statistics :boolean
# export_status :string
# club_id :integer
# registration_open :boolean default(TRUE)
# signature :text
# registration_cancelable :boolean
# phone_number_state :string default("optional")
# extra_info :boolean default(FALSE)
# comment_title :string
# show_telephone_disclaimer :boolean default(FALSE)
#

class Event < ActiveRecord::Base
Expand Down Expand Up @@ -77,20 +80,6 @@ def prettify_bank_number
self.bank_number = IBANTools::IBAN.new(self.bank_number).prettify if bank_number_changed?
end

def comment_title
if id == 1
return 'Afstudeerjaar en -richting' #TODO: maybe add to database if this used in more cases
end
nil
end

def show_telephone_disclaimer
if id == 1
return true
end
false
end

def generate_xls
self.export_status = 'generating'
self.save
Expand Down
2 changes: 2 additions & 0 deletions app/models/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# barcode_data :string
# payment_code :string
# phone_number :string
# title :string
# job_function :string
#

class Registration < ActiveRecord::Base
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddCommentTitleAndShowTelephoneDisclaimerToEvents < ActiveRecord::Migration
def change
add_column :events, :comment_title, :string
add_column :events, :show_telephone_disclaimer, :boolean, default: false
end
end
13 changes: 9 additions & 4 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170111204432) do
ActiveRecord::Schema.define(version: 20170129135614) do

create_table "access_levels", force: :cascade do |t|
t.string "name"
Expand Down Expand Up @@ -93,7 +93,7 @@
t.datetime "registration_open_date"
t.datetime "registration_close_date"
t.string "bank_number"
t.boolean "show_ticket_count", default: true
t.boolean "show_ticket_count", default: true
t.string "contact_email"
t.string "export_file_name"
t.string "export_content_type"
Expand All @@ -102,10 +102,13 @@
t.boolean "show_statistics"
t.string "export_status"
t.integer "club_id"
t.boolean "registration_open", default: true
t.boolean "registration_open", default: true
t.text "signature"
t.boolean "registration_cancelable"
t.string "phone_number_state", default: "optional"
t.string "phone_number_state", default: "optional"
t.boolean "extra_info", default: false
t.string "comment_title"
t.boolean "show_telephone_disclaimer", default: false
end

create_table "included_zones", force: :cascade do |t|
Expand Down Expand Up @@ -179,6 +182,8 @@
t.string "barcode_data"
t.string "payment_code"
t.string "phone_number"
t.string "title"
t.string "job_function"
end

add_index "registrations", ["event_id"], name: "index_registrations_on_event_id"
Expand Down
53 changes: 28 additions & 25 deletions test/fixtures/events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,34 @@
#
# Table name: events
#
# id :integer not null, primary key
# name :string
# start_date :datetime
# end_date :datetime
# location :string
# website :string
# description :text
# created_at :datetime
# updated_at :datetime
# registration_open_date :datetime
# registration_close_date :datetime
# bank_number :string
# show_ticket_count :boolean default(TRUE)
# contact_email :string
# export_file_name :string
# export_content_type :string
# export_file_size :integer
# export_updated_at :datetime
# show_statistics :boolean
# export_status :string
# club_id :integer
# registration_open :boolean default(TRUE)
# signature :text
# registration_cancelable :boolean
# phone_number_state :string default("optional")
# id :integer not null, primary key
# name :string
# start_date :datetime
# end_date :datetime
# location :string
# website :string
# description :text
# created_at :datetime
# updated_at :datetime
# registration_open_date :datetime
# registration_close_date :datetime
# bank_number :string
# show_ticket_count :boolean default(TRUE)
# contact_email :string
# export_file_name :string
# export_content_type :string
# export_file_size :integer
# export_updated_at :datetime
# show_statistics :boolean
# export_status :string
# club_id :integer
# registration_open :boolean default(TRUE)
# signature :text
# registration_cancelable :boolean
# phone_number_state :string default("optional")
# extra_info :boolean default(FALSE)
# comment_title :string
# show_telephone_disclaimer :boolean default(FALSE)
#

# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/registrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# barcode_data :string
# payment_code :string
# phone_number :string
# title :string
# job_function :string
#

# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
Expand Down
53 changes: 28 additions & 25 deletions test/models/event_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,34 @@
#
# Table name: events
#
# id :integer not null, primary key
# name :string
# start_date :datetime
# end_date :datetime
# location :string
# website :string
# description :text
# created_at :datetime
# updated_at :datetime
# registration_open_date :datetime
# registration_close_date :datetime
# bank_number :string
# show_ticket_count :boolean default(TRUE)
# contact_email :string
# export_file_name :string
# export_content_type :string
# export_file_size :integer
# export_updated_at :datetime
# show_statistics :boolean
# export_status :string
# club_id :integer
# registration_open :boolean default(TRUE)
# signature :text
# registration_cancelable :boolean
# phone_number_state :string default("optional")
# id :integer not null, primary key
# name :string
# start_date :datetime
# end_date :datetime
# location :string
# website :string
# description :text
# created_at :datetime
# updated_at :datetime
# registration_open_date :datetime
# registration_close_date :datetime
# bank_number :string
# show_ticket_count :boolean default(TRUE)
# contact_email :string
# export_file_name :string
# export_content_type :string
# export_file_size :integer
# export_updated_at :datetime
# show_statistics :boolean
# export_status :string
# club_id :integer
# registration_open :boolean default(TRUE)
# signature :text
# registration_cancelable :boolean
# phone_number_state :string default("optional")
# extra_info :boolean default(FALSE)
# comment_title :string
# show_telephone_disclaimer :boolean default(FALSE)
#

require 'test_helper'
Expand Down
2 changes: 2 additions & 0 deletions test/models/registration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# barcode_data :string
# payment_code :string
# phone_number :string
# title :string
# job_function :string
#

require 'test_helper'
Expand Down

0 comments on commit 16da59a

Please sign in to comment.