Location component splash view

This commit is contained in:
Gopesh Tulsyan 2014-06-14 18:49:10 +05:30
parent f5c5e6a44b
commit f0b6c32a54
5 changed files with 63 additions and 2 deletions

View file

@ -91,3 +91,17 @@ body {
#submissions {
padding-bottom: 20px;
}
#location{
background-repeat: no-repeat;
background-position: center center;
width: 100%;
min-height: 500px;
background-size: cover;
-webkit-background-size:cover;
}
#location li{
display: inline-block;
margin-right: 2em;
}

View file

@ -5,7 +5,7 @@
= f.input :address, :input_html => {:rows => 1}
= f.input :website
= f.input :description, :input_html => { :rows => 10, :cols => 20 }
- if !@venue.photo.blank?
- unless @venue.photo.blank?
= image_tag @venue.photo(:thumb)
= f.input :photo
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -0,0 +1,35 @@
= content_for :splash_nav do
%li
%a{ href: '#location' } Location
%div.container.text-center
.div.row.col-md-12
- unless @conference.venue.name.blank?
%h1
%strong #{ @conference.venue.name }
- unless @conference.venue.address.blank?
%h2
%strong #{ @conference.venue.address }
- unless @conference.venue.description.blank?
%p
%strong #{ @conference.venue.description }
%ul
- unless @conference.venue.address.blank?
%li
%b
= link_to 'View in Google Maps', "http://maps.google.com/maps?q=#{@conference.venue.address}", target: '_blank'
- unless @conference.venue.website.blank?
%li
%b
= link_to 'Visit Venue Website', @conference.venue.website, target: '_blank'
:javascript
$(document).ready(function(){
var photo = "#{@conference.venue.photo}";
if(photo)
{
$('#location').css('background-image', 'url('+photo+')');
}
});

View file

@ -10,7 +10,10 @@
-unless @conference.call_for_papers.blank?
%div#callforpapers
= render 'call_for_papers'
-unless @conference.venue.blank?
%div#location
= render 'location'
%div#sponsors
= render 'sponsor'
%div#social-media
= render 'social_media'
= render 'social_media'

View file

@ -16,6 +16,7 @@ describe 'conference/show.html.haml' do
@sponsorship_level = @conference.sponsorship_levels.first
@sponsorship_level.sponsors << create(:sponsor, sponsorship_level: @sponsorship_level,
conference: @conference)
@conference.venue = create(:venue)
assign :conference, @conference
render
end
@ -51,4 +52,12 @@ describe 'conference/show.html.haml' do
expect(rendered).to include('http://www.google-example.com')
expect(rendered).to include('http://youtu.be/rtyutut')
end
it 'renders location partial' do
expect(view).to render_template(partial: 'conference/_location')
expect(rendered).to include('Suse Office')
expect(rendered).to include('Maxfeldstrasse 5 \n90409 Nuremberg')
expect(rendered).to include('www.opensuse.org')
expect(rendered).to include('Lorem Ipsum Dolor')
end
end