Skip to content

Commit

Permalink
Unsubscribe to cancel also in db
Browse files Browse the repository at this point in the history
  • Loading branch information
feliciaan committed Jan 11, 2017
1 parent 5fecdfc commit c2908f9
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/controllers/events_controller.rb
Expand Up @@ -151,7 +151,7 @@ def check_in
end

def event_params
params.require(:event).permit(:name, :club_id, :location, :website, :contact_email, :start_date, :end_date, :description, :bank_number, :registration_close_date, :registration_open_date, :show_ticket_count, :signature, :unsubscribe_option)
params.require(:event).permit(:name, :club_id, :location, :website, :contact_email, :start_date, :end_date, :description, :bank_number, :registration_close_date, :registration_open_date, :show_ticket_count, :signature, :registration_cancelable)
end

def event_create_params
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/welcome_controller.rb
@@ -1,5 +1,7 @@
class WelcomeController < ApplicationController
def index
redirect_to event_path(Event.first)
if Event.first
redirect_to event_path(Event.first)
end
end
end
3 changes: 1 addition & 2 deletions app/models/event.rb
Expand Up @@ -25,8 +25,7 @@
# club_id :integer
# registration_open :boolean default(TRUE)
# signature :text
# unsubscribe_option :boolean
# slug :string
# registration_cancelable :boolean
#

class Event < ActiveRecord::Base
Expand Down
2 changes: 1 addition & 1 deletion app/views/events/_general_form.html.erb
Expand Up @@ -8,7 +8,7 @@
<%= form_email_field f, :contact_email %>
<%= form_date_field f, :start_date, "start", datepicker_time(f.object.start_date) %>
<%= form_date_field f, :end_date, "end", datepicker_time(f.object.end_date) %>
<%= form_check_box f, :unsubscribe_option %>
<%= form_check_box f, :registration_cancelable %>
<%= form_fancy_text_area f, :description %>
<%= f.button :submit, class: 'btn btn-primary' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/registration_mailer/ticket.html.erb
Expand Up @@ -49,7 +49,7 @@

<p>If you have any problems, you can contact us via mail: <%= mail_to @registration.event.contact_email, @registration.event.contact_email %></p>

<% if @event.unsubscribe_option %>
<% if @event.registration_cancelable %>
<p>If you cannot come: <%= link_to "cancel", cancel_event_registration_url(event_id: @registration.event.id, id: @registration.id, barcode: @registration.barcode) %></p>
<%end %>
<p>Kind regards,<br /><%= @registration.event.club.name %></p>
Expand Down
@@ -0,0 +1,5 @@
class AddRegistrationCancelableToEvents < ActiveRecord::Migration
def change
add_column :events, :registration_cancelable, :boolean
end
end
6 changes: 0 additions & 6 deletions db/migrate/20170110175339_add_unsubscribe_option_to_events.rb

This file was deleted.

3 changes: 1 addition & 2 deletions db/schema.rb
Expand Up @@ -104,8 +104,7 @@
t.integer "club_id"
t.boolean "registration_open", default: true
t.text "signature"
t.boolean "unsubscribe_option"
t.string "slug"
t.boolean "registration_cancelable"
end

create_table "included_zones", force: :cascade do |t|
Expand Down
1 change: 0 additions & 1 deletion db/seeds.rb
Expand Up @@ -12,7 +12,6 @@
WebMock.disable_net_connect!

hash.each do |club|
next unless 1 == 0
next unless club['parentAssociation'] == 'FK'

club = Club.new do |c|
Expand Down
14 changes: 0 additions & 14 deletions test/controllers/unsubscribe_controller_test.rb

This file was deleted.

0 comments on commit c2908f9

Please sign in to comment.