Merge pull request #970 from hennevogel/feature_cloudinary
Switch to carrierwave for for upload management
This commit is contained in:
commit
3ce62979bd
37 changed files with 252 additions and 153 deletions
68
Gemfile
68
Gemfile
|
|
@ -21,14 +21,19 @@ gem 'rails-observers'
|
||||||
# for tracking data changes
|
# for tracking data changes
|
||||||
gem 'paper_trail'
|
gem 'paper_trail'
|
||||||
|
|
||||||
# Internationalizing gem , use gem according to version of your rails application
|
# for upload management
|
||||||
gem 'rails-i18n', '~> 4.0.0' # For 4.0.x
|
gem 'carrierwave'
|
||||||
|
gem 'mini_magick'
|
||||||
|
gem 'carrierwave-bombshelter'
|
||||||
|
|
||||||
|
# for internationalizing
|
||||||
|
gem 'rails-i18n', '~> 4.0.0'
|
||||||
|
|
||||||
# as authentification framework
|
# as authentification framework
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
gem 'devise_ichain_authenticatable'
|
gem 'devise_ichain_authenticatable'
|
||||||
|
|
||||||
# to support openID authentication
|
# for openID authentication
|
||||||
gem 'omniauth'
|
gem 'omniauth'
|
||||||
gem 'omniauth-facebook'
|
gem 'omniauth-facebook'
|
||||||
gem 'omniauth-openid'
|
gem 'omniauth-openid'
|
||||||
|
|
@ -37,7 +42,8 @@ gem 'omniauth-github'
|
||||||
|
|
||||||
# as authorization framework
|
# as authorization framework
|
||||||
gem 'cancancan'
|
gem 'cancancan'
|
||||||
# to set roles
|
|
||||||
|
# for roles
|
||||||
gem 'rolify'
|
gem 'rolify'
|
||||||
|
|
||||||
# to show flash messages from ajax requests
|
# to show flash messages from ajax requests
|
||||||
|
|
@ -66,17 +72,16 @@ gem 'formtastic-bootstrap'
|
||||||
gem 'formtastic', '~> 3.1.1'
|
gem 'formtastic', '~> 3.1.1'
|
||||||
gem 'cocoon'
|
gem 'cocoon'
|
||||||
|
|
||||||
# frontend javascripts
|
|
||||||
|
|
||||||
# as the JavaScript library
|
# as the JavaScript library
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
|
||||||
|
# frontend javascripts
|
||||||
source 'https://rails-assets.org' do
|
source 'https://rails-assets.org' do
|
||||||
# for placeholder images
|
# for placeholder images
|
||||||
gem 'rails-assets-holderjs'
|
gem 'rails-assets-holderjs'
|
||||||
# for formating dates
|
# for formating dates
|
||||||
gem 'rails-assets-date.format'
|
gem 'rails-assets-date.format'
|
||||||
# for or parsing, validating, manipulating, and formatting dates.
|
# for or parsing, validating, manipulating, and formatting dates
|
||||||
gem 'rails-assets-momentjs'
|
gem 'rails-assets-momentjs'
|
||||||
# for smooth scrolling
|
# for smooth scrolling
|
||||||
gem 'rails-assets-jquery-smooth-scroll'
|
gem 'rails-assets-jquery-smooth-scroll'
|
||||||
|
|
@ -97,8 +102,10 @@ end
|
||||||
# as date picker
|
# as date picker
|
||||||
gem 'bootstrap3-datetimepicker-rails', '~> 3.0.2'
|
gem 'bootstrap3-datetimepicker-rails', '~> 3.0.2'
|
||||||
gem 'jquery-datatables-rails', '~> 2.2.1'
|
gem 'jquery-datatables-rails', '~> 2.2.1'
|
||||||
|
|
||||||
# for charts
|
# for charts
|
||||||
gem 'chart-js-rails'
|
gem 'chart-js-rails'
|
||||||
|
|
||||||
# for displaying maps
|
# for displaying maps
|
||||||
gem 'leaflet-rails'
|
gem 'leaflet-rails'
|
||||||
|
|
||||||
|
|
@ -108,9 +115,6 @@ gem 'gravtastic'
|
||||||
# for country selects
|
# for country selects
|
||||||
gem 'country_select'
|
gem 'country_select'
|
||||||
|
|
||||||
# for upload management
|
|
||||||
gem 'paperclip'
|
|
||||||
|
|
||||||
# as PDF generator
|
# as PDF generator
|
||||||
gem 'prawn_rails'
|
gem 'prawn_rails'
|
||||||
|
|
||||||
|
|
@ -120,24 +124,21 @@ gem 'axlsx_rails'
|
||||||
# as error catcher
|
# as error catcher
|
||||||
gem 'hoptoad_notifier', '~> 2.3'
|
gem 'hoptoad_notifier', '~> 2.3'
|
||||||
|
|
||||||
# to make links faster. Read more: https://github.com/rails/turbolinks
|
# to make links faster
|
||||||
gem 'turbolinks'
|
gem 'turbolinks'
|
||||||
|
|
||||||
# for JSON serialization of our API
|
# for JSON serialization of our API
|
||||||
gem 'active_model_serializers'
|
gem 'active_model_serializers'
|
||||||
|
|
||||||
# for icon fonts
|
# as icon font
|
||||||
gem 'font-awesome-rails'
|
gem 'font-awesome-rails'
|
||||||
|
|
||||||
# for Markdown in description
|
# for markdown
|
||||||
gem 'redcarpet'
|
gem 'redcarpet'
|
||||||
|
|
||||||
# as rdoc generator
|
# as rdoc generator
|
||||||
gem 'rdoc-generator-fivefish'
|
gem 'rdoc-generator-fivefish'
|
||||||
|
|
||||||
# for seeds
|
|
||||||
gem 'factory_girl_rails'
|
|
||||||
|
|
||||||
# for visitor tracking
|
# for visitor tracking
|
||||||
gem 'ahoy_matey'
|
gem 'ahoy_matey'
|
||||||
gem 'activeuuid'
|
gem 'activeuuid'
|
||||||
|
|
@ -162,44 +163,51 @@ gem 'bootstrap-switch-rails', '~> 3.0.0'
|
||||||
# for parsing OEmbed data
|
# for parsing OEmbed data
|
||||||
gem 'ruby-oembed'
|
gem 'ruby-oembed'
|
||||||
|
|
||||||
# Use guard and spring for testing in development
|
# for uploading images to the cloud
|
||||||
|
gem 'cloudinary'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# rspec Guard rules
|
# to launch specs when files are modified
|
||||||
gem 'guard-rspec', '~> 4.2.8'
|
gem 'guard-rspec', '~> 4.2.8'
|
||||||
gem 'spring-commands-rspec'
|
gem 'spring-commands-rspec'
|
||||||
# Get HoundCi comments locally
|
# for static code analisys
|
||||||
gem 'rubocop'
|
gem 'rubocop'
|
||||||
# Silence rack assests messages
|
# to silence rack assests messages
|
||||||
gem 'quiet_assets'
|
gem 'quiet_assets'
|
||||||
# Use sqlite3 as the database in development
|
# as database
|
||||||
gem 'sqlite3'
|
gem 'sqlite3'
|
||||||
# Use letter_opener to open mails in development
|
# to open mails
|
||||||
gem 'letter_opener'
|
gem 'letter_opener'
|
||||||
# Use letter_opener_web to open mails in browser (e.g. necessary for Vagrant)
|
# to open mails in browser
|
||||||
gem 'letter_opener_web'
|
gem 'letter_opener_web'
|
||||||
# mina is a blazing fast deployment system
|
# as deployment system
|
||||||
gem 'mina'
|
gem 'mina'
|
||||||
|
# as debugger on error pages
|
||||||
gem 'web-console', '~> 2.0'
|
gem 'web-console', '~> 2.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Use rspec and capybara as testing framework
|
|
||||||
group :test do
|
group :test do
|
||||||
# We use coveralls for measuring test coverage
|
# as test framework
|
||||||
gem 'coveralls', require: false
|
|
||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
gem 'capybara'
|
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
|
gem 'capybara'
|
||||||
gem 'poltergeist'
|
gem 'poltergeist'
|
||||||
gem 'phantomjs', :require => 'phantomjs/poltergeist'
|
gem 'phantomjs', :require => 'phantomjs/poltergeist'
|
||||||
# Set of rails validations matchers to describe models
|
# for measuring test coverage
|
||||||
|
gem 'coveralls', require: false
|
||||||
|
# for describing models
|
||||||
gem 'shoulda-matchers', require: false
|
gem 'shoulda-matchers', require: false
|
||||||
# Extracted from RSpec 3 stub_model and mock_model
|
# for stubing/mocking models
|
||||||
gem 'rspec-activemodel-mocks'
|
gem 'rspec-activemodel-mocks'
|
||||||
|
# to freeze time
|
||||||
gem 'timecop'
|
gem 'timecop'
|
||||||
# for mocking external requests
|
# for mocking external requests
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
# as debugger
|
||||||
gem 'byebug'
|
gem 'byebug'
|
||||||
|
# for seeds
|
||||||
|
gem 'factory_girl_rails'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
47
Gemfile.lock
47
Gemfile.lock
|
|
@ -64,6 +64,7 @@ GEM
|
||||||
json
|
json
|
||||||
awesome_nested_set (3.0.0.rc.5)
|
awesome_nested_set (3.0.0.rc.5)
|
||||||
activerecord (>= 4.0.0, < 5)
|
activerecord (>= 4.0.0, < 5)
|
||||||
|
aws_cf_signer (0.1.3)
|
||||||
axlsx (2.0.1)
|
axlsx (2.0.1)
|
||||||
htmlentities (~> 4.3.1)
|
htmlentities (~> 4.3.1)
|
||||||
nokogiri (>= 1.4.1)
|
nokogiri (>= 1.4.1)
|
||||||
|
|
@ -93,6 +94,15 @@ GEM
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
xpath (~> 2.0)
|
xpath (~> 2.0)
|
||||||
|
carrierwave (0.11.0)
|
||||||
|
activemodel (>= 3.2.0)
|
||||||
|
activesupport (>= 3.2.0)
|
||||||
|
json (>= 1.7)
|
||||||
|
mime-types (>= 1.16)
|
||||||
|
carrierwave-bombshelter (0.1.1.6)
|
||||||
|
activesupport (>= 3.2.0)
|
||||||
|
carrierwave
|
||||||
|
fastimage
|
||||||
celluloid (0.15.2)
|
celluloid (0.15.2)
|
||||||
timers (~> 1.1.0)
|
timers (~> 1.1.0)
|
||||||
celluloid-io (0.15.0)
|
celluloid-io (0.15.0)
|
||||||
|
|
@ -101,11 +111,10 @@ GEM
|
||||||
chart-js-rails (0.0.6)
|
chart-js-rails (0.0.6)
|
||||||
railties (> 3.1)
|
railties (> 3.1)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
climate_control (0.0.3)
|
|
||||||
activesupport (>= 3.0)
|
|
||||||
cliver (0.3.2)
|
cliver (0.3.2)
|
||||||
cocaine (0.5.8)
|
cloudinary (1.1.6)
|
||||||
climate_control (>= 0.0.3, < 1.0)
|
aws_cf_signer
|
||||||
|
rest-client
|
||||||
cocoon (1.2.6)
|
cocoon (1.2.6)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
coffee-rails (4.1.1)
|
coffee-rails (4.1.1)
|
||||||
|
|
@ -151,6 +160,8 @@ GEM
|
||||||
devise (>= 2.2)
|
devise (>= 2.2)
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
docile (1.1.5)
|
docile (1.1.5)
|
||||||
|
domain_name (0.5.20160310)
|
||||||
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.6.0)
|
execjs (2.6.0)
|
||||||
factory_girl (4.5.0)
|
factory_girl (4.5.0)
|
||||||
|
|
@ -160,6 +171,8 @@ GEM
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
faraday (0.9.0)
|
faraday (0.9.0)
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
|
fastimage (2.0.0)
|
||||||
|
addressable (~> 2)
|
||||||
ffi (1.9.3)
|
ffi (1.9.3)
|
||||||
font-awesome-rails (4.1.0.0)
|
font-awesome-rails (4.1.0.0)
|
||||||
railties (>= 3.2, < 5.0)
|
railties (>= 3.2, < 5.0)
|
||||||
|
|
@ -194,6 +207,8 @@ GEM
|
||||||
activesupport
|
activesupport
|
||||||
builder
|
builder
|
||||||
htmlentities (4.3.1)
|
htmlentities (4.3.1)
|
||||||
|
http-cookie (1.0.2)
|
||||||
|
domain_name (~> 0.5)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
i18n_data (0.7.0)
|
i18n_data (0.7.0)
|
||||||
inversion (0.12.3)
|
inversion (0.12.3)
|
||||||
|
|
@ -228,10 +243,10 @@ GEM
|
||||||
mime-types (>= 1.16, < 3)
|
mime-types (>= 1.16, < 3)
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
mime-types (2.99.1)
|
mime-types (2.99.1)
|
||||||
mimemagic (0.3.0)
|
|
||||||
mina (0.3.8)
|
mina (0.3.8)
|
||||||
open4 (~> 1.3.4)
|
open4 (~> 1.3.4)
|
||||||
rake
|
rake
|
||||||
|
mini_magick (4.5.1)
|
||||||
mini_portile2 (2.0.0)
|
mini_portile2 (2.0.0)
|
||||||
minitest (5.8.4)
|
minitest (5.8.4)
|
||||||
momentjs-rails (2.8.1)
|
momentjs-rails (2.8.1)
|
||||||
|
|
@ -250,6 +265,7 @@ GEM
|
||||||
multi_xml (0.5.5)
|
multi_xml (0.5.5)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
mysql2 (0.4.2)
|
mysql2 (0.4.2)
|
||||||
|
netrc (0.11.0)
|
||||||
nio4r (1.2.1)
|
nio4r (1.2.1)
|
||||||
nokogiri (1.6.7.2)
|
nokogiri (1.6.7.2)
|
||||||
mini_portile2 (~> 2.0.0.rc2)
|
mini_portile2 (~> 2.0.0.rc2)
|
||||||
|
|
@ -283,12 +299,6 @@ GEM
|
||||||
paper_trail (3.0.1)
|
paper_trail (3.0.1)
|
||||||
activerecord (>= 3.0, < 5.0)
|
activerecord (>= 3.0, < 5.0)
|
||||||
activesupport (>= 3.0, < 5.0)
|
activesupport (>= 3.0, < 5.0)
|
||||||
paperclip (4.3.2)
|
|
||||||
activemodel (>= 3.2.0)
|
|
||||||
activesupport (>= 3.2.0)
|
|
||||||
cocaine (~> 0.5.5)
|
|
||||||
mime-types
|
|
||||||
mimemagic (= 0.3.0)
|
|
||||||
parser (2.3.0.3)
|
parser (2.3.0.3)
|
||||||
ast (~> 2.2)
|
ast (~> 2.2)
|
||||||
pdf-core (0.2.5)
|
pdf-core (0.2.5)
|
||||||
|
|
@ -384,6 +394,10 @@ GEM
|
||||||
request_store (1.0.6)
|
request_store (1.0.6)
|
||||||
responders (2.1.1)
|
responders (2.1.1)
|
||||||
railties (>= 4.2.0, < 5.1)
|
railties (>= 4.2.0, < 5.1)
|
||||||
|
rest-client (1.8.0)
|
||||||
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
|
mime-types (>= 1.16, < 3.0)
|
||||||
|
netrc (~> 0.7)
|
||||||
rolify (5.0.0)
|
rolify (5.0.0)
|
||||||
rspec (3.0.0)
|
rspec (3.0.0)
|
||||||
rspec-core (~> 3.0.0)
|
rspec-core (~> 3.0.0)
|
||||||
|
|
@ -466,6 +480,9 @@ GEM
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (3.0.0)
|
uglifier (3.0.0)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
|
unf (0.1.4)
|
||||||
|
unf_ext
|
||||||
|
unf_ext (0.0.7.2)
|
||||||
unicode-display_width (0.3.1)
|
unicode-display_width (0.3.1)
|
||||||
unicode_utils (1.4.0)
|
unicode_utils (1.4.0)
|
||||||
unobtrusive_flash (3.1.0)
|
unobtrusive_flash (3.1.0)
|
||||||
|
|
@ -510,7 +527,10 @@ DEPENDENCIES
|
||||||
byebug
|
byebug
|
||||||
cancancan
|
cancancan
|
||||||
capybara
|
capybara
|
||||||
|
carrierwave
|
||||||
|
carrierwave-bombshelter
|
||||||
chart-js-rails
|
chart-js-rails
|
||||||
|
cloudinary
|
||||||
cocoon
|
cocoon
|
||||||
country_select
|
country_select
|
||||||
coveralls
|
coveralls
|
||||||
|
|
@ -533,6 +553,7 @@ DEPENDENCIES
|
||||||
letter_opener
|
letter_opener
|
||||||
letter_opener_web
|
letter_opener_web
|
||||||
mina
|
mina
|
||||||
|
mini_magick
|
||||||
money-rails
|
money-rails
|
||||||
mysql2
|
mysql2
|
||||||
omniauth
|
omniauth
|
||||||
|
|
@ -541,7 +562,6 @@ DEPENDENCIES
|
||||||
omniauth-google-oauth2
|
omniauth-google-oauth2
|
||||||
omniauth-openid
|
omniauth-openid
|
||||||
paper_trail
|
paper_trail
|
||||||
paperclip
|
|
||||||
phantomjs
|
phantomjs
|
||||||
piwik_analytics (~> 1.0.1)
|
piwik_analytics (~> 1.0.1)
|
||||||
poltergeist
|
poltergeist
|
||||||
|
|
@ -581,3 +601,6 @@ DEPENDENCIES
|
||||||
web-console (~> 2.0)
|
web-console (~> 2.0)
|
||||||
webmock
|
webmock
|
||||||
whenever
|
whenever
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.11.2
|
||||||
|
|
|
||||||
|
|
@ -180,12 +180,12 @@ module Admin
|
||||||
params.require(:conference).permit(:title, :short_title, :description, :timezone,
|
params.require(:conference).permit(:title, :short_title, :description, :timezone,
|
||||||
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
|
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
|
||||||
:tickets_attributes, :event_types_attributes,
|
:tickets_attributes, :event_types_attributes,
|
||||||
:logo, :questions_attributes,
|
:picture, :picture_cache, :questions_attributes,
|
||||||
:question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes,
|
:question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes,
|
||||||
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
||||||
:vpositions_attributes, :use_volunteers, :color,
|
:vpositions_attributes, :use_volunteers, :color,
|
||||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||||
:photos_attributes, :targets, :targets_attributes,
|
:targets, :targets_attributes,
|
||||||
:campaigns, :campaigns_attributes, :registration_limit)
|
:campaigns, :campaigns_attributes, :registration_limit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def lodging_params
|
def lodging_params
|
||||||
params.require(:lodging).permit(:name, :description, :photo, :website_link, :conference_id)
|
params.require(:lodging).permit(:name, :description, :picture, :picture_cache, :website_link, :conference_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def sponsor_params
|
def sponsor_params
|
||||||
params.require(:sponsor).permit(:name, :description, :website_url, :logo, :sponsorship_level_id, :conference_id)
|
params.require(:sponsor).permit(:name, :description, :website_url, :picture, :picture_cache, :sponsorship_level_id, :conference_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def venue_params
|
def venue_params
|
||||||
params.require(:venue).permit(:name, :street, :postalcode, :city, :country, :longitude, :latitude, :description, :website, :photo, :lodgings_attributes, :conference_id)
|
params.require(:venue).permit(:name, :street, :postalcode, :city, :country, :longitude, :latitude, :description, :website, :picture, :picture_cache, :lodgings_attributes, :conference_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,6 @@ class ConferenceController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def gallery_photos
|
|
||||||
@photos = @conference.photos
|
|
||||||
render 'photos', formats: [:js]
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def respond_to_options
|
def respond_to_options
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ module SponsorsHelper
|
||||||
# returns the url to be used for logo on basis of sponsorship level position
|
# returns the url to be used for logo on basis of sponsorship level position
|
||||||
def get_logo(sponsor)
|
def get_logo(sponsor)
|
||||||
if sponsor.sponsorship_level.position == 1
|
if sponsor.sponsorship_level.position == 1
|
||||||
sponsor.logo.url(:first)
|
sponsor.picture.first.url
|
||||||
elsif sponsor.sponsorship_level.position == 2
|
elsif sponsor.sponsorship_level.position == 2
|
||||||
sponsor.logo.url(:second)
|
sponsor.picture.second.url
|
||||||
else
|
else
|
||||||
sponsor.logo.url(:others)
|
sponsor.picture.others.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ class Conference < ActiveRecord::Base
|
||||||
has_many :vpositions, dependent: :destroy
|
has_many :vpositions, dependent: :destroy
|
||||||
has_many :sponsorship_levels, -> { order('position ASC') }, dependent: :destroy
|
has_many :sponsorship_levels, -> { order('position ASC') }, dependent: :destroy
|
||||||
has_many :sponsors, dependent: :destroy
|
has_many :sponsors, dependent: :destroy
|
||||||
has_many :photos, dependent: :destroy
|
|
||||||
has_many :targets, dependent: :destroy
|
has_many :targets, dependent: :destroy
|
||||||
has_many :campaigns, dependent: :destroy
|
has_many :campaigns, dependent: :destroy
|
||||||
has_many :commercials, as: :commercialable, dependent: :destroy
|
has_many :commercials, as: :commercialable, dependent: :destroy
|
||||||
|
|
@ -44,16 +43,10 @@ class Conference < ActiveRecord::Base
|
||||||
accepts_nested_attributes_for :questions, allow_destroy: true
|
accepts_nested_attributes_for :questions, allow_destroy: true
|
||||||
accepts_nested_attributes_for :vdays, allow_destroy: true
|
accepts_nested_attributes_for :vdays, allow_destroy: true
|
||||||
accepts_nested_attributes_for :vpositions, allow_destroy: true
|
accepts_nested_attributes_for :vpositions, allow_destroy: true
|
||||||
accepts_nested_attributes_for :photos, allow_destroy: true
|
|
||||||
accepts_nested_attributes_for :targets, allow_destroy: true
|
accepts_nested_attributes_for :targets, allow_destroy: true
|
||||||
accepts_nested_attributes_for :campaigns, allow_destroy: true
|
accepts_nested_attributes_for :campaigns, allow_destroy: true
|
||||||
|
|
||||||
has_attached_file :logo,
|
mount_uploader :picture, PictureUploader, mount_on: :logo_file_name
|
||||||
styles: { thumb: '100x100>', large: '300x300>' }
|
|
||||||
|
|
||||||
validates_attachment_content_type :logo,
|
|
||||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
|
||||||
size: { in: 0..500.kilobytes }
|
|
||||||
|
|
||||||
validates_presence_of :title,
|
validates_presence_of :title,
|
||||||
:short_title,
|
:short_title,
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,5 @@ class Lodging < ActiveRecord::Base
|
||||||
|
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
|
|
||||||
has_attached_file :photo,
|
mount_uploader :picture, PictureUploader, mount_on: :photo_file_name
|
||||||
styles: { thumb: '100x100>', large: '300x300>' }
|
|
||||||
|
|
||||||
validates_attachment_content_type :photo,
|
|
||||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
|
||||||
size: { in: 0..500.kilobytes }
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
class Photo < ActiveRecord::Base
|
|
||||||
belongs_to :conference
|
|
||||||
validates_presence_of :picture
|
|
||||||
has_attached_file :picture,
|
|
||||||
styles: { thumb: '100x100>', large: '300x300>', banner: '600x300>' }
|
|
||||||
|
|
||||||
validates_attachment_content_type :picture,
|
|
||||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
|
||||||
size: { in: 0..500.kilobytes }
|
|
||||||
end
|
|
||||||
|
|
@ -1,21 +1,8 @@
|
||||||
class Sponsor < ActiveRecord::Base
|
class Sponsor < ActiveRecord::Base
|
||||||
belongs_to :sponsorship_level
|
belongs_to :sponsorship_level
|
||||||
belongs_to :conference
|
belongs_to :conference
|
||||||
has_attached_file :logo,
|
|
||||||
styles: { thumb: '100x100>',
|
|
||||||
first: '320x180>',
|
|
||||||
second: '320x150>',
|
|
||||||
others: '320x120>' },
|
|
||||||
# places logo on a white background to maintain size
|
|
||||||
convert_options: {
|
|
||||||
first: '-background white -gravity center -extent 320x180',
|
|
||||||
second: '-background white -gravity center -extent 320x150',
|
|
||||||
others: '-background white -gravity center -extent 320x120'
|
|
||||||
}
|
|
||||||
|
|
||||||
validates_attachment_content_type :logo,
|
mount_uploader :picture, PictureUploader, mount_on: :logo_file_name
|
||||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
|
||||||
size: { in: 0..500.kilobytes }
|
|
||||||
|
|
||||||
validates_presence_of :name, :website_url, :sponsorship_level, :logo
|
validates_presence_of :name, :website_url, :sponsorship_level
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,7 @@ class Venue < ActiveRecord::Base
|
||||||
validates :name, :street, :city, :country, presence: true
|
validates :name, :street, :city, :country, presence: true
|
||||||
validates :conference_id, presence: true, uniqueness: true
|
validates :conference_id, presence: true, uniqueness: true
|
||||||
|
|
||||||
has_attached_file :photo,
|
mount_uploader :picture, PictureUploader, mount_on: :photo_file_name
|
||||||
styles: { thumb: '100x100>', large: '300x300>' }
|
|
||||||
validates_attachment_content_type :photo,
|
|
||||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
|
||||||
size: { in: 0..500.kilobytes }
|
|
||||||
|
|
||||||
before_save :send_mail_notification
|
before_save :send_mail_notification
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
class ConferenceSerializer < ActiveModel::Serializer
|
class ConferenceSerializer < ActiveModel::Serializer
|
||||||
attributes :short_title, :title, :description, :start_date, :end_date, :logo,
|
attributes :short_title, :title, :description, :start_date, :end_date, :picture_url,
|
||||||
:difficulty_levels, :event_types, :rooms, :tracks,
|
:difficulty_levels, :event_types, :rooms, :tracks,
|
||||||
:date_range, :revision
|
:date_range, :revision
|
||||||
|
|
||||||
|
|
|
||||||
87
app/uploaders/picture_uploader.rb
Normal file
87
app/uploaders/picture_uploader.rb
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
class PictureUploader < CarrierWave::Uploader::Base
|
||||||
|
include CarrierWave::MiniMagick
|
||||||
|
include CarrierWave::Compatibility::Paperclip
|
||||||
|
include CarrierWave::BombShelter
|
||||||
|
|
||||||
|
# use cloudinary if it's configured
|
||||||
|
if Cloudinary.config.cloud_name
|
||||||
|
include Cloudinary::CarrierWave
|
||||||
|
end
|
||||||
|
|
||||||
|
def paperclip_path
|
||||||
|
"system/#{object_class_name}/#{extra_store_dir}/#{id_partition}/:style/:basename.:extension"
|
||||||
|
end
|
||||||
|
|
||||||
|
def object_class_name
|
||||||
|
model.class.to_s.underscore.pluralize
|
||||||
|
end
|
||||||
|
|
||||||
|
# compatibility with our paperclip storage paths..
|
||||||
|
def extra_store_dir
|
||||||
|
case object_class_name
|
||||||
|
when 'conferences'
|
||||||
|
'logos'
|
||||||
|
when 'lodgings'
|
||||||
|
'photos'
|
||||||
|
when 'sponsors'
|
||||||
|
'logos'
|
||||||
|
when 'venues'
|
||||||
|
'photos'
|
||||||
|
else mounted_as
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the id of the instance in a split path form. e.g. returns
|
||||||
|
# 000/001/234 for an id of 1234. Stolen from paperclip...
|
||||||
|
def id_partition
|
||||||
|
('%09d'.freeze % model.id).scan(/\d{3}/).join('/'.freeze)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Override the directory where uploaded files will be stored.
|
||||||
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
|
def store_dir
|
||||||
|
"system/#{object_class_name}/#{mounted_as}/#{model.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create different versions of your uploaded files:
|
||||||
|
version :large do
|
||||||
|
process resize_to_fit: [300, 300]
|
||||||
|
end
|
||||||
|
|
||||||
|
version :thumb, from_version: :large do
|
||||||
|
process resize_to_fit: [100, 100]
|
||||||
|
end
|
||||||
|
|
||||||
|
version :first, if: :sponsor?
|
||||||
|
version :first do
|
||||||
|
process resize_and_pad: [320, 180, 'white']
|
||||||
|
end
|
||||||
|
|
||||||
|
version :second, if: :sponsor?
|
||||||
|
version :second, from_version: :first do
|
||||||
|
process resize_and_pad: [320, 150, 'white']
|
||||||
|
end
|
||||||
|
|
||||||
|
version :others, if: :sponsor?
|
||||||
|
version :others, from_version: :second do
|
||||||
|
process resize_and_pad: [320, 120, 'white']
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add a white list of extensions which are allowed to be uploaded.
|
||||||
|
# For images you might use something like this:
|
||||||
|
def extension_white_list
|
||||||
|
%w(jpg jpeg gif png)
|
||||||
|
end
|
||||||
|
|
||||||
|
def content_type_whitelist
|
||||||
|
%r{/image\//}
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def sponsor?(_picture)
|
||||||
|
object_class_name == 'sponsors'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -11,9 +11,12 @@
|
||||||
= f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs"
|
= f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs"
|
||||||
= f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } }
|
= f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } }
|
||||||
= f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"}
|
= f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"}
|
||||||
- if !@conference.logo.blank?
|
= f.label 'Conference Logo'
|
||||||
= image_tag @conference.logo(:thumb)
|
%br
|
||||||
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
|
- if @conference.picture?
|
||||||
|
= image_tag @conference.picture.thumb.url
|
||||||
|
= f.input :picture, :label => false, :hint => "This will be displayed on the front page."
|
||||||
|
= f.hidden_field :picture_cache
|
||||||
= f.inputs :name => "Scheduling" do
|
= f.inputs :name => "Scheduling" do
|
||||||
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
|
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
|
||||||
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
|
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@
|
||||||
= f.input :name
|
= f.input :name
|
||||||
= f.input :website_link
|
= f.input :website_link
|
||||||
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
||||||
- unless @lodging.photo.blank?
|
- if @lodging.picture?
|
||||||
= image_tag @lodging.photo(:thumb)
|
= image_tag @lodging.picture.thumb.url
|
||||||
= f.input :photo
|
= f.input :picture
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,15 @@
|
||||||
- slice.each do |lodging|
|
- slice.each do |lodging|
|
||||||
.col-md-4
|
.col-md-4
|
||||||
.thumbnail
|
.thumbnail
|
||||||
- if lodging.photo.blank?
|
- if !lodging.picture?
|
||||||
%p.text-center
|
%p.text-center
|
||||||
%i.fa.fa-home.fa-5x
|
%i.fa.fa-home.fa-5x
|
||||||
- else
|
- else
|
||||||
-if lodging.website_link.present?
|
-if lodging.website_link.present?
|
||||||
= link_to(lodging.website_link, class: 'thumbnail') do
|
= link_to(lodging.website_link, class: 'thumbnail') do
|
||||||
= image_tag lodging.photo(:thumb), class: 'img-responsive img-lodging'
|
= image_tag lodging.picture.thumb, class: 'img-responsive img-lodging'
|
||||||
- else
|
- else
|
||||||
= image_tag lodging.photo(:thumb), class: 'img-responsive img-lodging'
|
= image_tag lodging.picture.thumb, class: 'img-responsive img-lodging'
|
||||||
.caption
|
.caption
|
||||||
%h3.text-center
|
%h3.text-center
|
||||||
= lodging.name
|
= lodging.name
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
= semantic_form_for(@sponsor, :url => (@sponsor.new_record? ? admin_conference_sponsors_path : admin_conference_sponsor_path(@conference.short_title, @sponsor))) do |f|
|
= semantic_form_for(@sponsor, :url => (@sponsor.new_record? ? admin_conference_sponsors_path : admin_conference_sponsor_path(@conference.short_title, @sponsor))) do |f|
|
||||||
= f.input :name
|
= f.input :name
|
||||||
= f.input :description
|
= f.input :description
|
||||||
= image_tag f.object.logo(:thumb) if !f.object.logo.blank?
|
= image_tag f.object.picture.thumb.url if f.object.picture?
|
||||||
= f.input :logo
|
= f.input :picture
|
||||||
= f.input :website_url
|
= f.input :website_url
|
||||||
= f.input :sponsorship_level, collection: @conference.sponsorship_levels
|
= f.input :sponsorship_level, collection: @conference.sponsorship_levels
|
||||||
%p.text-right
|
%p.text-right
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
- @conference.sponsors.each do |sponsor|
|
- @conference.sponsors.each do |sponsor|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= image_tag(sponsor.logo(:thumb), width: '20%')
|
= image_tag(sponsor.picture.thumb.url, width: '20%')
|
||||||
%td
|
%td
|
||||||
= sponsor.name
|
= sponsor.name
|
||||||
%td
|
%td
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
= link_to 'Details', '#details-content', 'data-toggle' => 'tab'
|
= link_to 'Details', '#details-content', 'data-toggle' => 'tab'
|
||||||
%li
|
%li
|
||||||
= link_to 'Commercials', '#commercials-content', 'data-toggle' => 'tab'
|
= link_to 'Commercials', '#commercials-content', 'data-toggle' => 'tab'
|
||||||
|
|
||||||
.tab-content
|
.tab-content
|
||||||
#details-content.tab-pane.active
|
#details-content.tab-pane.active
|
||||||
.col-md-8
|
.col-md-8
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
= f.inputs :name, :website
|
= f.inputs :name, :website
|
||||||
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
||||||
= f.inputs :street, :postalcode, :city, :country, :latitude, :longitude
|
= f.inputs :street, :postalcode, :city, :country, :latitude, :longitude
|
||||||
- unless @venue.photo.blank?
|
- if @venue.picture?
|
||||||
= image_tag @venue.photo(:thumb)
|
= image_tag @venue.picture.thumb.url
|
||||||
= f.input :photo
|
= f.input :picture
|
||||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||||
|
|
||||||
#commercials-content.tab-pane
|
#commercials-content.tab-pane
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
.well
|
.well
|
||||||
.row
|
.row
|
||||||
.col-md-4.text-center
|
.col-md-4.text-center
|
||||||
= image_tag(conference.logo(:original), class: 'img-responsive') if conference.logo?
|
= image_tag(conference.picture_url, class: 'img-responsive') if conference.picture?
|
||||||
.col-md-6
|
.col-md-6
|
||||||
%h3
|
%h3
|
||||||
= conference.title
|
= conference.title
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
- photos.each_with_index do |photo,index|
|
|
||||||
%div.item{ class: (index==0? 'active' : '') }
|
|
||||||
= image_tag(photo.picture(:banner))
|
|
||||||
- unless photo.description.blank?
|
|
||||||
%div.carousel-caption
|
|
||||||
.lead
|
|
||||||
= photo.description
|
|
||||||
|
|
@ -13,18 +13,17 @@
|
||||||
- slice.each do |lodging|
|
- slice.each do |lodging|
|
||||||
.col-md-4.col-sm-4.ticket.col-centered.col-top
|
.col-md-4.col-sm-4.ticket.col-centered.col-top
|
||||||
.thumbnail
|
.thumbnail
|
||||||
- if lodging.photo.blank?
|
- if !lodging.picture?
|
||||||
%p.text-center
|
%p.text-center
|
||||||
%i.fa.fa-home.fa-5x
|
%i.fa.fa-home.fa-5x
|
||||||
- else
|
- else
|
||||||
-if lodging.website_link.present?
|
-if lodging.website_link.present?
|
||||||
= link_to(lodging.website_link, class: 'thumbnail') do
|
= link_to(lodging.website_link, class: 'thumbnail') do
|
||||||
= image_tag lodging.photo(:large), class: 'img-responsive img-lodging'
|
= image_tag lodging.picture.large.url, class: 'img-responsive img-lodging'
|
||||||
- else
|
- else
|
||||||
= image_tag lodging.photo(:large), class: 'img-responsive img-lodging'
|
= image_tag lodging.picture.large.url, class: 'img-responsive img-lodging'
|
||||||
.caption
|
.caption
|
||||||
%h3.text-center
|
%h3.text-center
|
||||||
= lodging.name
|
= lodging.name
|
||||||
-if lodging.description.present?
|
-if lodging.description.present?
|
||||||
= markdown(lodging.description)
|
= markdown(lodging.description)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
.col-md-8.col-md-offset-2#header
|
.col-md-8.col-md-offset-2#header
|
||||||
.row
|
.row
|
||||||
.col-md-4
|
.col-md-4
|
||||||
= image_tag(@conference.logo(:original), class: 'img-responsive img-center', id: 'splash-logo') if @conference.logo?
|
= image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture?
|
||||||
.col-md-8
|
.col-md-8
|
||||||
%h1
|
%h1
|
||||||
= @conference.title
|
= @conference.title
|
||||||
|
|
|
||||||
4
config/cloudinary.yml.example
Normal file
4
config/cloudinary.yml.example
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
production:
|
||||||
|
cloud_name: "sample"
|
||||||
|
api_key: "874837483274837"
|
||||||
|
api_secret: "a676b67565c6767a6767d6767f676fe1"
|
||||||
5
config/initializers/carrierwave.rb
Normal file
5
config/initializers/carrierwave.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
CarrierWave.configure do |config|
|
||||||
|
config.storage = :file
|
||||||
|
config.cache_dir = "#{Rails.root}/tmp/uploads"
|
||||||
|
config.enable_processing = false if Rails.env.test?
|
||||||
|
end
|
||||||
4
config/initializers/fuckups.rb
Normal file
4
config/initializers/fuckups.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Add methods here that slipped into migrations in the dark ages...
|
||||||
|
def remove_attachment(*args)
|
||||||
|
true
|
||||||
|
end
|
||||||
13
db/migrate/20160427101444_remove_photos.rb
Normal file
13
db/migrate/20160427101444_remove_photos.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
class RemovePhotos < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
drop_table :photos do |t|
|
||||||
|
t.text :description
|
||||||
|
t.string :picture_file_name
|
||||||
|
t.string :picture_content_type
|
||||||
|
t.integer :picture_file_size
|
||||||
|
t.datetime :picture_updated_at
|
||||||
|
t.belongs_to :conference
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
8
db/migrate/20160427104236_add_pictures.rb
Normal file
8
db/migrate/20160427104236_add_pictures.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
class AddPictures < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :conferences, :picture, :string
|
||||||
|
add_column :lodgings, :picture, :string
|
||||||
|
add_column :sponsors, :picture, :string
|
||||||
|
add_column :venues, :picture, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
17
db/schema.rb
17
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160403214841) do
|
ActiveRecord::Schema.define(version: 20160427104236) do
|
||||||
|
|
||||||
create_table "ahoy_events", force: :cascade do |t|
|
create_table "ahoy_events", force: :cascade do |t|
|
||||||
t.uuid "visit_id", limit: 16
|
t.uuid "visit_id", limit: 16
|
||||||
|
|
@ -101,6 +101,7 @@ ActiveRecord::Schema.define(version: 20160403214841) do
|
||||||
t.text "events_per_week"
|
t.text "events_per_week"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "registration_limit", default: 0
|
t.integer "registration_limit", default: 0
|
||||||
|
t.string "picture"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "conferences_questions", id: false, force: :cascade do |t|
|
create_table "conferences_questions", id: false, force: :cascade do |t|
|
||||||
|
|
@ -246,6 +247,7 @@ ActiveRecord::Schema.define(version: 20160403214841) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "website_link"
|
t.string "website_link"
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
|
t.string "picture"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "openids", force: :cascade do |t|
|
create_table "openids", force: :cascade do |t|
|
||||||
|
|
@ -257,17 +259,6 @@ ActiveRecord::Schema.define(version: 20160403214841) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "photos", force: :cascade do |t|
|
|
||||||
t.text "description"
|
|
||||||
t.string "picture_file_name"
|
|
||||||
t.string "picture_content_type"
|
|
||||||
t.integer "picture_file_size"
|
|
||||||
t.datetime "picture_updated_at"
|
|
||||||
t.integer "conference_id"
|
|
||||||
t.datetime "created_at"
|
|
||||||
t.datetime "updated_at"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "programs", force: :cascade do |t|
|
create_table "programs", force: :cascade do |t|
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.integer "rating", default: 0
|
t.integer "rating", default: 0
|
||||||
|
|
@ -377,6 +368,7 @@ ActiveRecord::Schema.define(version: 20160403214841) do
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.string "picture"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "sponsorship_levels", force: :cascade do |t|
|
create_table "sponsorship_levels", force: :cascade do |t|
|
||||||
|
|
@ -509,6 +501,7 @@ ActiveRecord::Schema.define(version: 20160403214841) do
|
||||||
t.string "latitude"
|
t.string "latitude"
|
||||||
t.string "longitude"
|
t.string "longitude"
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
|
t.string "picture"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "versions", force: :cascade do |t|
|
create_table "versions", force: :cascade do |t|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,14 @@ FactoryGirl.define do
|
||||||
name 'Example sponsor'
|
name 'Example sponsor'
|
||||||
website_url 'http://www.example.com'
|
website_url 'http://www.example.com'
|
||||||
description 'Lorem Ipsum Dolor'
|
description 'Lorem Ipsum Dolor'
|
||||||
logo_file_name 'rails.jpg'
|
|
||||||
logo_file_size 2000
|
|
||||||
logo_content_type 'image/jpeg'
|
|
||||||
logo_updated_at DateTime.current
|
|
||||||
sponsorship_level
|
sponsorship_level
|
||||||
conference
|
conference
|
||||||
|
|
||||||
|
after(:create) do |sponsor|
|
||||||
|
uploader = PictureUploader.new(sponsor, :picture)
|
||||||
|
File.open('app/assets/images/rails.png') { |f| uploader.store!(f) }
|
||||||
|
sponsor.logo_file_name = 'rails.png'
|
||||||
|
sponsor.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ feature Lodging do
|
||||||
|
|
||||||
fill_in 'lodging_name', with: 'New lodging'
|
fill_in 'lodging_name', with: 'New lodging'
|
||||||
fill_in 'lodging_website_link', with: 'http:\\www.google.com'
|
fill_in 'lodging_website_link', with: 'http:\\www.google.com'
|
||||||
attach_file 'Photo', path
|
attach_file 'Picture', path
|
||||||
|
|
||||||
click_button 'Create Lodging'
|
click_button 'Create Lodging'
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ feature Lodging do
|
||||||
|
|
||||||
fill_in 'lodging_name', with: 'New lodging'
|
fill_in 'lodging_name', with: 'New lodging'
|
||||||
fill_in 'lodging_website_link', with: 'http:\\www.google.com'
|
fill_in 'lodging_website_link', with: 'http:\\www.google.com'
|
||||||
attach_file 'Photo', path
|
attach_file 'Picture', path
|
||||||
|
|
||||||
click_button 'Update Lodging'
|
click_button 'Update Lodging'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ feature Sponsor do
|
||||||
|
|
||||||
fill_in 'sponsor_name', with: 'SUSE'
|
fill_in 'sponsor_name', with: 'SUSE'
|
||||||
fill_in 'sponsor_description', with: 'The original provider of the enterprise Linux distribution'
|
fill_in 'sponsor_description', with: 'The original provider of the enterprise Linux distribution'
|
||||||
attach_file 'Logo', path
|
attach_file 'Picture', path
|
||||||
fill_in 'sponsor_website_url', with: 'http://www.suse.com'
|
fill_in 'sponsor_website_url', with: 'http://www.suse.com'
|
||||||
select('Platin', from: 'sponsor_sponsorship_level_id')
|
select('Platin', from: 'sponsor_sponsorship_level_id')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ describe SponsorsHelper, type: :helper do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns correct url' do
|
it 'returns correct url' do
|
||||||
expect(get_logo(sponsor)).to match %r{.*(\bfirst/rails.jpg\b)}
|
expect(get_logo(sponsor)).to match %r{.*(\bfirst/rails.png\b)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ describe SponsorsHelper, type: :helper do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns correct url' do
|
it 'returns correct url' do
|
||||||
expect(get_logo(sponsor)).to match %r{.*(\bsecond/rails.jpg\b)}
|
expect(get_logo(sponsor)).to match %r{.*(\bsecond/rails.png\b)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ describe SponsorsHelper, type: :helper do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns correct url' do
|
it 'returns correct url' do
|
||||||
expect(get_logo(sponsor)).to match %r{.*(\bothers/rails.jpg\b)}
|
expect(get_logo(sponsor)).to match %r{.*(\bothers/rails.png\b)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ describe ConferenceSerializer, type: :serializer do
|
||||||
description: 'Lorem ipsum dolor sit',
|
description: 'Lorem ipsum dolor sit',
|
||||||
start_date: '2014-03-04',
|
start_date: '2014-03-04',
|
||||||
end_date: '2014-03-10',
|
end_date: '2014-03-10',
|
||||||
logo: '/logos/original/missing.png',
|
picture_url: nil,
|
||||||
difficulty_levels:
|
difficulty_levels:
|
||||||
[{id: 1,
|
[{id: 1,
|
||||||
title: 'Easy',
|
title: 'Easy',
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ describe 'conference/show.html.haml' do
|
||||||
expect(rendered).to match(/example@example.com/)
|
expect(rendered).to match(/example@example.com/)
|
||||||
expect(rendered).to match(/www.example.com/)
|
expect(rendered).to match(/www.example.com/)
|
||||||
expect(rendered).to match(/Lorem Ipsum Dolor/)
|
expect(rendered).to match(/Lorem Ipsum Dolor/)
|
||||||
expect(rendered).to match(/rails.jpg/)
|
expect(rendered).to match(/rails.png/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders social media partial' do
|
it 'renders social media partial' do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue