Integrate the splash page into the general layout

* Cleanup the CSS
* Fix more views then you have fingers and toes
* Introduce position(weight) for sponsor levels
* Fix bootstrap/datatable integration
This commit is contained in:
Henne Vogelsang 2014-11-14 11:58:36 +01:00
parent 7acd16f923
commit f2cdea4f1a
56 changed files with 1191 additions and 1266 deletions

View file

@ -11,22 +11,22 @@ feature Room do
visit admin_conference_rooms_path(
conference_id: conference.short_title)
expect(page.has_content?('Room Name')).to be false
expect(page.has_content?('100')).to be false
expect(page.has_no_table?('#rooms')).to be true
# Add room
click_link 'New Room'
fill_in 'room_name', with: 'Room Name'
fill_in 'room_name', with: 'Auditorium'
fill_in 'room_size', with: '100'
click_button 'Create Room'
# Validations
expect(flash).to eq('Room successfully created.')
expect(page.has_content?('Room Name')).to be true
expect(page.has_content?('100')).to be true
within('table#rooms') do
expect(page.has_content?('Auditorium')).to be true
expect(page.assert_selector('tr', count: 2)).to be true
end
end
scenario 'updates a room', feature: true, js: true do
@ -35,17 +35,19 @@ feature Room do
visit edit_admin_conference_room_path(
conference_id: conference.short_title, id: room.id)
fill_in 'room_name', with: 'Room Name'
fill_in 'room_name', with: 'Auditorium'
fill_in 'room_size', with: '100'
click_button 'Update Room'
# Validations
expect(flash).to eq('Room successfully updated.')
expect(page.has_content?('Room Name')).to be true
expect(page.has_content?('100')).to be true
within('table#rooms') do
expect(page.has_content?('Auditorium')).to be true
expect(page.assert_selector('tr', count: 2)).to be true
end
room.reload
expect(room.name).to eq('Room Name')
expect(room.name).to eq('Auditorium')
expect(room.size).to eq(100)
end
end

View file

@ -5,37 +5,51 @@ feature SponsorshipLevel do
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
shared_examples 'sponsorship levels' do
scenario 'adds and updates sponsorship level', feature: true, js: true do
shared_examples 'sponsorship_levels' do
scenario 'adds a sponsorship level', feature: true, js: true do
sign_in organizer
visit admin_conference_sponsorship_levels_path(
conference_id: conference.short_title)
# Add sponsorship level
click_link 'Add sponsorship_level'
expect(page.all('div.nested-fields').count == 1).to be true
page.
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
set('Example sponsorship level')
expect(page.has_no_table?('#sponsorship_levels')).to be true
click_button 'Update Conference'
# Add SponsorshipLevel
click_link 'New Sponsorship Level'
fill_in 'sponsorship_level_title', with: 'Platin'
click_button 'Create Sponsorship level'
# Validations
expect(flash).to eq('Sponsorship levels were successfully updated.')
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
value).to eq('Example sponsorship level')
expect(flash).to eq('Sponsorship level successfully created.')
within('table#sponsorship_levels') do
expect(page.has_content?('Platin')).to be true
expect(page.assert_selector('tr', count: 2)).to be true
end
end
# Remove sponsorship level
click_link 'Remove sponsorship_level'
expect(page.all('div.nested-fields').count == 0).to be true
click_button 'Update Conference'
expect(flash).to eq('Sponsorship levels were successfully updated.')
expect(page.all('div.nested-fields').count == 0).to be true
scenario 'updates a sponsorship level', feature: true, js: true do
level = create(:sponsorship_level, conference_id: conference.id)
sign_in organizer
visit edit_admin_conference_sponsorship_level_path(
conference_id: conference.short_title, id: level.id)
fill_in 'sponsorship_level_title', with: 'Gold'
click_button 'Update Sponsorship level'
# Validations
expect(flash).to eq('Sponsorship level successfully updated.')
within('table#sponsorship_levels') do
expect(page.has_content?('Gold')).to be true
expect(page.assert_selector('tr', count: 2)).to be true
end
level.reload
expect(level.title).to eq('Gold')
end
end
describe 'organizer' do
it_behaves_like 'sponsorship levels'
it_behaves_like 'sponsorship_levels'
end
end

View file

@ -5,9 +5,9 @@ describe 'conference/show.html.haml' do
@conference = create(:conference)
@conference.splashpage = create(:splashpage,
banner_description: 'Lorem Ipsum',
sponsor_description: 'Lorem Ipsum Dolor',
registration_description: 'Lorem Ipsum Dolor',
banner_description: 'Banner Description',
sponsor_description: 'Sponsor Description',
registration_description: 'Registration Description',
include_registrations: true,
include_program: true,
include_sponsors: true,
@ -19,13 +19,13 @@ describe 'conference/show.html.haml' do
include_lodgings: true)
@conference.contact.update(sponsor_email: 'example@example.com',
facebook: 'http://www.fbexample.com',
googleplus: 'http://www.google-example.com',
facebook: 'http://facebook.com',
googleplus: 'http://google.com',
instagram: 'http://instagram.com',
twitter: 'http://twitter.com')
@conference.registration_period = create(:registration_period,
start_date: Date.today,
start_date: Date.yesterday,
end_date: Date.tomorrow)
@conference.call_for_papers = create(:call_for_papers, conference: @conference,
@ -43,8 +43,8 @@ describe 'conference/show.html.haml' do
end
it 'renders banner component' do
expect(view.content_for(:splash)).to include("#{@conference.splashpage.banner_description}")
expect(view.content_for(:splash)).to include("#{@conference.short_title}")
expect(rendered).to match(/#{@conference.splashpage.banner_description}/)
expect(rendered).to match(/#{@conference.short_title}/)
end
it 'renders program partial' do
@ -52,45 +52,43 @@ describe 'conference/show.html.haml' do
end
it 'renders registration partial' do
expect(view.content_for(:splash)).to include("#{@conference.splashpage.registration_description}")
expect(view).to render_template(partial: 'conference/_registration')
end
it 'renders call_for_papers partial' do
expect(view.content_for(:splash)).to include("#{@conference.call_for_papers.description}")
expect(rendered).to match(/#{@conference.call_for_papers.description}/)
end
it 'renders sponsors partial' do
expect(view).to render_template(partial: 'conference/_sponsor')
expect(view.content_for(:splash)).to include('Lorem Ipsum Dolor')
expect(view.content_for(:splash)).to include('example@example.com')
expect(view.content_for(:splash)).to include('Platin')
expect(view.content_for(:splash)).to include('Example sponsor')
expect(view.content_for(:splash)).to include('http://www.example.com')
expect(view.content_for(:splash)).to include('Lorem Ipsum Dolor')
expect(view.content_for(:splash)).to include('rails.jpg')
expect(view).to render_template(partial: 'conference/_sponsors')
expect(rendered).to match(/example@example.com/)
expect(rendered).to match(/Platin/)
expect(rendered).to match(/Example sponsor/)
expect(rendered).to match(/www.example.com/)
expect(rendered).to match(/Lorem Ipsum Dolor/)
expect(rendered).to match(/rails.jpg/)
end
it 'renders social media partial' do
expect(view).to render_template('conference/_social_media')
expect(view.content_for(:splash)).to include('http://www.fbexample.com')
expect(view.content_for(:splash)).to include('http://www.google-example.com')
expect(view.content_for(:splash)).to include('http://instagram.com')
expect(view.content_for(:splash)).to include('http://twitter.com')
expect(rendered).to match(/facebook.com/)
expect(rendered).to match(/google.com/)
expect(rendered).to match(/instagram.com/)
expect(rendered).to match(/twitter.com/)
end
it 'renders location partial' do
expect(view).to render_template(partial: 'conference/_location')
expect(view.content_for(:splash)).to include('Suse Office')
expect(view.content_for(:splash)).to include('Maxfeldstrasse 5 \n90409 Nuremberg')
expect(view.content_for(:splash)).to include('www.opensuse.org')
expect(view.content_for(:splash)).to include('Lorem Ipsum Dolor')
expect(rendered).to match(/Suse Office/)
expect(rendered).to match(/Maxfeldstrasse 5/)
expect(rendered).to match(/www.opensuse.org/)
expect(rendered).to match(/Lorem Ipsum Dolor/)
end
it 'renders lodging partial' do
expect(view).to render_template(partial: 'conference/_lodging')
expect(view.content_for(:splash)).to include('Example Hotel')
expect(view.content_for(:splash)).to include('Lorem Ipsum Dolor')
expect(view.content_for(:splash)).to include('http://www.example.com')
expect(rendered).to match(/Example Hotel/)
expect(rendered).to match(/Lorem Ipsum Dolor/)
expect(rendered).to match(/www.example.com/)
end
end