diff --git a/app/assets/stylesheets/splash.css.scss b/app/assets/stylesheets/splash.css.scss index d7074a3a..765b0ede 100644 --- a/app/assets/stylesheets/splash.css.scss +++ b/app/assets/stylesheets/splash.css.scss @@ -145,8 +145,8 @@ a:after { } } #gallery{ + min-height: 500px; .modal-body{ - min-height: 500px; i{ margin-top: 35%; } diff --git a/app/controllers/conference_controller.rb b/app/controllers/conference_controller.rb index 0ad2f58c..d9c8935d 100644 --- a/app/controllers/conference_controller.rb +++ b/app/controllers/conference_controller.rb @@ -6,6 +6,6 @@ class ConferenceController < ApplicationController def fetch_gallery_photos @photos = Conference.find(params[:id].to_i).photos - render 'photos', formats: [:js] + render "photos", formats: [:js] end end diff --git a/app/models/photo.rb b/app/models/photo.rb index 22a8d9c2..af9f2eac 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -3,7 +3,7 @@ class Photo < ActiveRecord::Base belongs_to :conference validates_presence_of :picture has_attached_file :picture, - styles: { thumb: '100x100>', large: '300x300>' } + styles: { thumb: "100x100>", large: "300x300>", banner: "500x300>" } validates_attachment_content_type :picture, content_type: [/jpg/, /jpeg/, /png/, /gif/], diff --git a/app/views/conference/_gallery.html.haml b/app/views/conference/_gallery.html.haml index a604b3d2..4f04b20b 100644 --- a/app/views/conference/_gallery.html.haml +++ b/app/views/conference/_gallery.html.haml @@ -15,8 +15,18 @@ :javascript + var count = 0; $('#gallery-btn').click(function(){ - $('#gallery .modal-body').append(''); + if(count == 0){ + $('#gallery').modal('show'); + $('#gallery .modal-body').append(''); + count +=1; + } + else{ + $('#gallery').modal('show'); + return false; + } }); + diff --git a/app/views/conference/_gallery_photo.html.haml b/app/views/conference/_gallery_photo.html.haml index 37df3584..6ecbe6bb 100644 --- a/app/views/conference/_gallery_photo.html.haml +++ b/app/views/conference/_gallery_photo.html.haml @@ -1,3 +1,3 @@ - photos.each_with_index do |photo,index| %div.item{ class: (index==0? 'active' : '') } - = image_tag(photo.picture) + = image_tag(photo.picture(:banner)) diff --git a/app/views/conference/photos.js.haml b/app/views/conference/photos.js.haml index 1f113760..5e24851d 100644 --- a/app/views/conference/photos.js.haml +++ b/app/views/conference/photos.js.haml @@ -1,3 +1,4 @@ $('#gallery .carousel-inner').append("#{escape_javascript(render('gallery_photo', photos: @photos)) }"); $('#gallery .modal-body').children('.fa').remove(); $('#gallery #carousel-example-generic').css('visibility','visible'); + diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 6497bee1..e4dbf6c9 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -17,7 +17,7 @@ .row-fluid .col-md-12.lead %p= @conference.description - = link_to 'Gallery', fetch_gallery_photos_conference_path(@conference.id), class: 'btn btn-primary btn-lg', id: 'gallery-btn', data: {toggle: 'modal', target: '#gallery' }, remote: true + = link_to 'Gallery', fetch_gallery_photos_conference_path(@conference.id), class: 'btn btn-primary btn-lg', id: 'gallery-btn', remote: true = render 'gallery' - if @conference.include_program_in_splash? %section{ id: 'program' } diff --git a/config/routes.rb b/config/routes.rb index 11908eae..01212ac4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -92,7 +92,7 @@ Osem::Application.routes.draw do get "/register" => "conference_registration#register" patch "/register" => "conference_registration#update" delete "/register" => "conference_registration#unregister" - get 'fetch_gallery_photos' + get "fetch_gallery_photos" end end