Skip to content

Commit

Permalink
Merge pull request #1627 from siddhantbajaj/registration-ticket
Browse files Browse the repository at this point in the history
Added registration-ticket
  • Loading branch information
Ana06 authored Aug 11, 2017
2 parents 83abc9f + f31651a commit 6efcd04
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/tickets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def destroy
private

def ticket_params
params.require(:ticket).permit(:conference, :title, :url, :description, :conference_id, :price_cents, :price_currency, :price)
params.require(:ticket).permit(:conference, :title, :url, :description, :conference_id, :price_cents, :price_currency, :price, :registration_ticket)
end
end
end
1 change: 1 addition & 0 deletions app/views/admin/tickets/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
= f.input :description, input_html: { rows: 5, data: { provide: "markdown-editable" } }
= f.input :price
= f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY'], include_blank: false
= f.input :registration_ticket, hint: 'A registration ticket is with which user register for the conference.'
%p.text-right
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
3 changes: 3 additions & 0 deletions app/views/admin/tickets/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
%th Price
%th Sold
%th Turnover
%th Registration Ticket
%th Actions
%tbody
- @conference.tickets.each do |ticket|
Expand All @@ -27,6 +28,8 @@
= ticket.tickets_sold
%td
= humanized_money_with_symbol ticket.tickets_turnover
%td
= ticket.registration_ticket? ? 'Yes' : 'No'
%td
.btn-group
= link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, ticket.id),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddRegistrationTicketToTickets < ActiveRecord::Migration
def change
add_column :tickets, :registration_ticket, :boolean, default: false
end
end
3 changes: 2 additions & 1 deletion 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: 20170721001700) do
ActiveRecord::Schema.define(version: 20170807092805) do

create_table "ahoy_events", force: :cascade do |t|
t.integer "visit_id"
Expand Down Expand Up @@ -507,6 +507,7 @@
t.text "description"
t.integer "price_cents", default: 0, null: false
t.string "price_currency", default: "USD", null: false
t.boolean "registration_ticket", default: false
end

create_table "tracks", force: :cascade do |t|
Expand Down

0 comments on commit 6efcd04

Please sign in to comment.