Added lodging to splash view
This commit is contained in:
parent
4cc039b358
commit
c1063645da
13 changed files with 53 additions and 5 deletions
|
|
@ -10,7 +10,8 @@ class Conference < ActiveRecord::Base
|
|||
:difficulty_levels_attributes, :use_difficulty_levels,
|
||||
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
|
||||
:media_id, :media_type, :color, :description,
|
||||
:registration_description, :ticket_description
|
||||
:registration_description, :ticket_description,
|
||||
:lodging_description
|
||||
|
||||
has_paper_trail
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class Lodging < ActiveRecord::Base
|
||||
attr_accessible :name, :description, :photo
|
||||
attr_accessible :name, :description, :photo, :website_link
|
||||
belongs_to :venue
|
||||
has_attached_file :photo,
|
||||
styles: { thumb: '100x100>', large: '300x300>' }
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_description, hint: 'This description will appear in registration segment of the splash'
|
||||
= f.input :ticket_description, hint: 'This will appear in the Tickets segment of the splash'
|
||||
|
||||
= f.input :lodging_description, hint: 'This will appear in the lodging segement of the splash'
|
||||
= f.inputs :name => "Media" do
|
||||
- if !@conference.logo.blank?
|
||||
= image_tag @conference.logo(:thumb)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
of what they are offering, about types of rooms, prices and address' %>
|
||||
<%= image_tag f.object.photo(:thumb) if !f.object.photo.blank? %>
|
||||
<%= f.input :photo %>
|
||||
<%= f.input :website_link %>
|
||||
<%= remove_association_link :lodging, f %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@
|
|||
%li
|
||||
%b
|
||||
= link_to 'Visit Venue Website', @conference.venue.website, target: '_blank'
|
||||
- if @conference.venue
|
||||
- unless @conference.venue.lodgings.empty?
|
||||
= render 'lodging'
|
||||
|
||||
|
||||
:javascript
|
||||
|
|
|
|||
17
app/views/conference/_lodging.html.haml
Normal file
17
app/views/conference/_lodging.html.haml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
%div.row.col-md-12
|
||||
%h2 Lodgings
|
||||
-unless @conference.lodging_description.blank?
|
||||
%p.lead
|
||||
= @conference.lodging_description
|
||||
|
||||
%div.row
|
||||
- @conference.venue.lodgings.each do |r|
|
||||
%div.col-md-3.thumbnail
|
||||
-unless r.photo.blank?
|
||||
= image_tag r.photo(:large), class: 'img-responsive'
|
||||
-unless r.name.blank?
|
||||
%h4 #{ r.name }
|
||||
-unless r.description.blank?
|
||||
%p.text-left #{ r.description }
|
||||
- unless r.website_link.blank?
|
||||
= link_to 'Go to Website', r.website_link
|
||||
5
db/migrate/20140606172312_add_website_link_to_lodging.rb
Normal file
5
db/migrate/20140606172312_add_website_link_to_lodging.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddWebsiteLinkToLodging < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :lodgings, :website_link, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddLodgingDescriptionToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :lodging_description, :text
|
||||
end
|
||||
end
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140605125153) do
|
||||
ActiveRecord::Schema.define(version: 20140606173417) do
|
||||
|
||||
create_table "answers", force: true do |t|
|
||||
t.string "title"
|
||||
|
|
@ -84,6 +84,7 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
|||
t.string "facebook_url"
|
||||
t.string "google_url"
|
||||
t.string "twitter_url"
|
||||
t.text "lodging_description"
|
||||
end
|
||||
|
||||
create_table "conferences_questions", id: false, force: true do |t|
|
||||
|
|
@ -199,6 +200,7 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
|||
t.integer "venue_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "website_link"
|
||||
end
|
||||
|
||||
create_table "people", force: true do |t|
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ FactoryGirl.define do
|
|||
factory :lodging do
|
||||
name 'Example Hotel'
|
||||
description 'Lorem Ipsum Dolor'
|
||||
website_link 'http://www.example.com'
|
||||
venue
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ feature Lodging do
|
|||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
set('Lorem Ipsum Dolor')
|
||||
attach_file 'Photo', path
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
||||
set('http://www.example.com')
|
||||
click_button 'Update Venue'
|
||||
|
||||
# Validations
|
||||
|
|
@ -34,6 +36,8 @@ feature Lodging do
|
|||
value).to eq('Example Hotel')
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
value).to eq('Lorem Ipsum Dolor')
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
||||
value).to eq('http://www.example.com')
|
||||
expect(page).to have_selector("img[src*='rails.png']")
|
||||
|
||||
# Remove room
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@ describe 'admin/lodgings/index' do
|
|||
render
|
||||
expect(rendered).to include('Example Hotel')
|
||||
expect(rendered).to include('Lorem Ipsum Dolor')
|
||||
expect(rendered).to include('http://www.example.com')
|
||||
end
|
||||
end
|
||||
|
|
@ -6,6 +6,7 @@ describe 'conference/show.html.haml' do
|
|||
registration_end_date: Date.tomorrow,
|
||||
description: 'Lorem Ipsum')
|
||||
@conference.venue = create(:venue)
|
||||
@conference.venue.lodgings << create(:lodging, venue: @conference.venue)
|
||||
@conference.call_for_papers = create(:call_for_papers, conference: @conference)
|
||||
assign :conference, @conference
|
||||
render
|
||||
|
|
@ -33,4 +34,11 @@ describe 'conference/show.html.haml' do
|
|||
expect(rendered).to include('www.opensuse.org')
|
||||
expect(rendered).to include('Lorem Ipsum Dolor')
|
||||
end
|
||||
|
||||
it 'renders lodging partial' do
|
||||
expect(view).to render_template(partial: 'conference/_lodging')
|
||||
expect(rendered).to include('Example Hotel')
|
||||
expect(rendered).to include('Lorem Ipsum Dolor')
|
||||
expect(rendered).to include('http://www.example.com')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue