From 20e2b4b76b57360ab89dccb01b7ad1a1f125d805 Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 26 Nov 2017 20:37:02 -0800 Subject: [PATCH] Move sponsor modal to a generic partial & redesign. ... use for booths also. --- app/views/conferences/_booths.html.haml | 28 +++++-------- app/views/conferences/_modal_description.haml | 21 ++++++++++ app/views/conferences/_sponsors.html.haml | 40 +++++++------------ app/views/conferences/_tickets.html.haml | 19 +++++---- app/views/conferences/show.html.haml | 2 + 5 files changed, 58 insertions(+), 52 deletions(-) create mode 100644 app/views/conferences/_modal_description.haml diff --git a/app/views/conferences/_booths.html.haml b/app/views/conferences/_booths.html.haml index cc48fead..9e37ac95 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.html.haml @@ -6,21 +6,15 @@ %h2 Booths .row.row-centered - @conference.confirmed_booths.each do |booth| - .col-md-4.col-sm-4.col-centered.col-top - .thumbnail.text-center + .col-md-2.col-sm-2.col-centered.col-top + %a.thumbnail{ href: '#', + data: { toggle: 'modal', target: "#modal-booth-#{booth.id}" } } - if booth.picture? - = link_to booth.website_url, - class: 'thumbnail', target: '_blank' do - = image_tag booth.picture.large.url, alt: booth.title, - class: 'img-rounded' - .caption - %h3.text-center - - if booth.logo_link - = link_to booth.title, booth.website_url, target: '_blank' - -else - = booth.title - = link_to '', "#booth-detail-#{booth.id}", - data: {toggle: 'collapse'}, class: 'caret', - title: 'more info' - .collapse{ id: "booth-detail-#{booth.id}" } - = markdown(booth.description) + = image_tag get_logo(booth), + class: ['img-responsive', 'img-rounded'], + title: booth.title + - else + .caption + %h3.text-center= booth.title + - content_for :modals do + = render 'modal_description', object: booth diff --git a/app/views/conferences/_modal_description.haml b/app/views/conferences/_modal_description.haml new file mode 100644 index 00000000..a8d1b1d2 --- /dev/null +++ b/app/views/conferences/_modal_description.haml @@ -0,0 +1,21 @@ +- content_for :modals do + .modal.fade{ id: "modal-#{object.class.name.downcase}-#{object.id}" } + .modal-dialog + .modal-content + .modal-header + %button.close{ data: { dismiss: 'modal' } } + %i.fa.fa-close + %h3.modal-title + = object.try(:title) || object.try(:name) + .modal-body + %p.logo + = link_to object.website_url || '#', target: '_blank' do + - img_classes = ['img-responsive center-block'] + - if object.is_a? Sponsor + - img_classes << ['img-sponsor', + "img-sponsor-#{object.sponsorship_level.position}"] + = image_tag get_logo(object), class: img_classes + %p.description + = object.description + .modal-footer + = link_to nil, object.website_url, target: '_blank' diff --git a/app/views/conferences/_sponsors.html.haml b/app/views/conferences/_sponsors.html.haml index 5f961acd..aa15ab5a 100644 --- a/app/views/conferences/_sponsors.html.haml +++ b/app/views/conferences/_sponsors.html.haml @@ -6,34 +6,24 @@ @conference.try(:call_for_sponsors), '#splash#sponsors'] do %section#sponsors .container - .row - .col-md-12.text-center - %h2 Sponsors - @conference.sponsorship_levels.each do |sponsorship_level| -if sponsorship_level.sponsors.any? - - sponsorship_level.sponsors.each_slice(3) do |slice| - .row.row-centered - - slice.each do |sponsor| - .col-md-4.col-sm-4.col-centered.col-top - %a{ href: '#', data: { toggle: 'modal', target: "#modal_#{sponsor.id}" } } - = image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}" + .row.text-center + %h3 + = sponsorship_level.title + = 'Sponsor'.pluralize(sponsorship_level.sponsors.length) + .row.row-centered + - sponsorship_level.sponsors.each do |sponsor| + .col-md-4.col-sm-4.col-centered.col-top + %a{ href: '#', + data: { toggle: 'modal', target: "#modal-sponsor-#{sponsor.id}" } } + = image_tag get_logo(sponsor), + class: ['img-responsive', 'img-sponsor', + "img-sponsor-#{sponsorship_level.position}"], + title: sponsor.name + - content_for :modals do + = render 'modal_description', object: sponsor - .modal.fade{ id: "modal_#{sponsor.id}" } - .modal-dialog - .modal-content - .modal-header - %button.close{ data: { dismiss: 'modal' } } - x - .modal-title - = sponsor.name - .modal-body.text-center - .logo - = link_to sponsor.website_url, target: '_blank' do - = image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}" - .description - = sponsor.description - .modal-footer - = link_to nil, "#{sponsor.website_url}", target: '_blank' - if @conference.call_for_sponsors.try(:open?) .row .col-md-12 diff --git a/app/views/conferences/_tickets.html.haml b/app/views/conferences/_tickets.html.haml index 6f612a6a..a01ad676 100644 --- a/app/views/conferences/_tickets.html.haml +++ b/app/views/conferences/_tickets.html.haml @@ -13,13 +13,12 @@ .row.row-centered - @conference.tickets.each do |ticket| .col-md-3.col-sm-3.col-centered.col-top - %h3.text-center - = ticket.title - %h3.text-center - %i.fa.fa-ticket.fa-3x - = markdown(ticket.description) - %p.text-center - = link_to conference_tickets_path(@conference.short_title), - class: 'btn btn-success' do - Get Ticket - = humanized_money_with_symbol ticket.price + = link_to(conference_tickets_path(@conference.short_title), + class: 'thumbnail') do + .caption + %h3.text-center + = ticket.title + = markdown(ticket.description) + %button.btn-block.btn.btn-lg.btn-success + %i.fa.fa-ticket.fa-fw + = humanized_money_with_symbol(ticket.price) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 86254efd..3905b3a4 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -41,6 +41,8 @@ = render 'social_media' = render 'footer' + = yield :modals + - cache [@conference.color, '#splash#inlinejs'] do - content_for :script_head do :javascript