Add vendor picture interface; include in splash

Vendor has a picture atrribute, and was displayed in one form of the
splashpage, but it wasn't exposed in the vendor editing form, nor was it
included in the "map view" on the splash page.

Additionally, the map popup was rendered inline.

This commit:
* Adds a from input for editing Venue#picture, consistent with other
  form elements
* Displays the picture on the splash page in either style (map or
  static)
* Moves the splash page map popup from inline HTML to it's own partial
This commit is contained in:
James Mason 2017-10-11 16:47:51 -07:00 committed by Stella Rouzi
parent eaa8ad8005
commit 8ddcd695f0
3 changed files with 21 additions and 3 deletions

View file

@ -15,6 +15,12 @@
= semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f|
= f.inputs :name, :website
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
= f.label 'Venue Logo'
%br
- if @venue.picture?
= image_tag @venue.picture.thumb.url
= f.input :picture, label: false, hint: 'This will be displayed on the venue are of the splash page.'
= f.hidden_field :picture_cache
= f.inputs :street, :postalcode, :city, :country, :latitude, :longitude
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -1,5 +1,4 @@
#map{style: "height: 500px;" }
- popup = "<h3>#{@conference.venue.name}</h3><br>#{@conference.venue.street}<br>#{@conference.venue.city}<br>#{@conference.venue.country_name}"
- content_for(:script_body) do
:javascript
// create a map in the "map" div, set the view to a given place and zoom
@ -10,8 +9,8 @@
maxZoom: 18
}).addTo(map);
// add a marker in the given location, attach some popup content to it and open the popup
L.marker([#{h(@conference.venue.latitude)}, #{h(@conference.venue.longitude)}]).addTo(map)
.bindPopup("#{h(popup)}")
L.marker([#{h @conference.venue.latitude}, #{h @conference.venue.longitude}]).addTo(map)
.bindPopup("#{escape_javascript(render '/conferences/venue_map_marker', venue: @conference.venue)}")
.openPopup();
// Turn scrollwheel on when user clicks
map.on('focus', function(e) {

View file

@ -0,0 +1,13 @@
- if venue.picture?
= image_tag venue.picture.thumb.url,
alt: venue.name,
class: 'img-responsive pull-right'
%h3= venue.name
%p
= venue.street
%br
= venue.city
%br
= venue.country_name
- if venue.website
%p.text-center.clearfix= sanitize(link_to venue.website, venue.website)