-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ft event find insights 129622087 #191
base: master
Are you sure you want to change the base?
Changes from all commits
dac71b6
9d9a09a
bbc5813
614c36a
b558225
9d55469
e0ee2e8
afc20d2
a4496da
ef46677
1689fc3
5ac0888
03770b4
5cce229
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -381,3 +381,14 @@ td, th { | |
text-align: center; | ||
padding: 10px; | ||
} | ||
|
||
input[type=text].modal-text { | ||
height: 1.8rem; | ||
} | ||
|
||
.modal-radio[type="radio"]:not(:checked), | ||
.modal-radio[type="radio"]:checked { | ||
left: 2px; | ||
position: relative; | ||
opacity: 1; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can try to leverage more on SCSS syntax for better performance in .scss files |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,8 @@ def create | |
tickets = [] | ||
ticket_params.each do |ticket_type_id, quantity| | ||
quantity.to_i.times do | ||
user = UserTicket.new(ticket_type_id: ticket_type_id, booking: @booking) | ||
user = UserTicket.new(ticket_type_id: ticket_type_id, booking: @booking, | ||
event_source: source_params) | ||
tickets << user | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is way too much going on in this controller action which can be moved to the model... ( lean controllers fat models ) |
||
end | ||
|
@@ -104,6 +105,14 @@ def ticket_params | |
params.require(:tickets_quantity) | ||
end | ||
|
||
def source_params | ||
params.permit(:event_source, :other) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the need for |
||
if params[:event_source] == "Other" | ||
params[:event_source] = params[:other] unless params[:other].blank? | ||
end | ||
params[:event_source] | ||
end | ||
|
||
def set_event | ||
@event = Event.find(params[:event_id]) | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,44 @@ | ||
<div class="modal" id="purchase_ticket_modal"> | ||
<div class="modal-content row"> | ||
Buy tickets | ||
<%= form_for @booking, url: event_bookings_path(@event) do |f| %> | ||
<%#= f.text_field :ticket_type %> | ||
<div class="col l12 m12"> | ||
<h6>How did you find this event?</h6> | ||
<hr> | ||
<div class="col l2 m4"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NITPICK: Indentation here can be better. |
||
<%= image_tag "Twitter_image.jpg" %><br> | ||
<%= label_tag "event_source", "Twitter" %> | ||
<%= radio_button_tag("event_source", "Twitter", false, class: "modal-radio") %> | ||
</div> | ||
<div class="col l2 m4"> | ||
<%= image_tag "facebook_image.jpg" %><br> | ||
<%= label_tag "event_source", "Facebook" %> | ||
<%= radio_button_tag("event_source", "Facebook", false, class: "modal-radio") %> | ||
</div> | ||
<div class="col l2 m4"> | ||
<%= image_tag "google_image.jpg" %><br> | ||
<%= label_tag "event_source", "Google" %> | ||
<%= radio_button_tag("event_source", "Google", false, class: "modal-radio") %> | ||
</div> | ||
<div class="col l2 m4"> | ||
<%= image_tag "friend-source.jpg" %><br> | ||
<%= label_tag "event_source", "Friend" %> | ||
<%= radio_button_tag("event_source", "Friend", false, class: "modal-radio") %> | ||
</div> | ||
<div class="col l2 m4"> | ||
<%= image_tag "television_image.jpg" %><br> | ||
<%= label_tag "event_source", "TV / Radio" %> | ||
<%= radio_button_tag("event_source", "TV / Radio", false, class: "modal-radio") %> | ||
</div> | ||
<div class="col l2 m4"> | ||
<%= image_tag "question-mark.jpg" %><br> | ||
<%= label_tag "event_source", "Other" %> | ||
<%= radio_button_tag("event_source", "Other", false, class: "modal-radio") %> | ||
<%= text_field_tag("other", "", class: "modal-text") %> | ||
</div> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NITPICK: Indentation on this |
||
<hr> | ||
<!-- Buy tickets<br> --> | ||
<%= f.fields_for :user_tickets do |attendee| %> | ||
<%= render "user_ticket_fields", f: attendee %> | ||
<% end %> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddEventSourceToUserTicket < ActiveRecord::Migration | ||
def change | ||
add_column :user_tickets, :event_source, :string | ||
end | ||
end |
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
FactoryGirl.define do | ||
factory :user_ticket do | ||
ticket_number "MyString" | ||
event_source "Facebook" | ||
booking_id 1 | ||
ticket_type_id 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look into using Faker for getting random attributes here. I can see that it's already included into the project. |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
|
||
scenario "User tries to attend past Event" do | ||
visit events_path | ||
find_link("Old Event").trigger("click") | ||
click_link"Old Event" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space between |
||
expect(page).not_to have_content "ATTEND THIS EVENT" | ||
expect(page).to have_content "This event has ended" | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked
andnot(:checked)
are mutually exclusive. No need to specify the two... this could easily be.modal-radio[type="radio"]