diff --git a/Gemfile b/Gemfile index 78cf550..2fca809 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'oauth2', '~> 0.8.0' gem 'carrierwave' gem 'carrierwave-imageoptimizer' gem 'mini_magick' -#gem 'carmen', :path => '../carmen/' if File.directory?('../carmen/') && RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i +gem 'carmen', :path => '../carmen/' if File.directory?('../carmen/') && RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i gem 'carmen-rails' gem 'nested_form' gem 'acts_as_list' diff --git a/Gemfile.lock b/Gemfile.lock index 5daa25c..6a1b04f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,6 +12,11 @@ GIT i18n-active_record (0.0.2) i18n (>= 0.5.0) +PATH + remote: ../carmen/ + specs: + carmen (1.0.1) + GEM remote: http://rubygems.org/ specs: @@ -64,8 +69,6 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - carmen (1.0.1) - unicode_utils (~> 1.4.0) carmen-rails (1.0.1) carmen (~> 1.0.0) rails @@ -310,13 +313,11 @@ GEM uglifier (2.5.1) execjs (>= 0.3.0) json (>= 1.8.0) - unicode_utils (1.4.0) wdm (0.1.0) webmock (1.18.0) addressable (>= 2.3.6) crack (>= 0.3.2) websocket (1.0.7) - win32console (1.3.2) win32console (1.3.2-x86-mingw32) wysiwyg-rails (1.1.5) font-awesome-rails (= 4.1.0.0) @@ -334,6 +335,7 @@ DEPENDENCIES binding_of_caller capistrano capybara + carmen! carmen-rails carrierwave carrierwave-imageoptimizer diff --git a/app/assets/images/Thumbs.db b/app/assets/images/Thumbs.db index a26d43f..4e622e9 100644 Binary files a/app/assets/images/Thumbs.db and b/app/assets/images/Thumbs.db differ diff --git a/app/assets/stylesheets/sass/_layout.scss b/app/assets/stylesheets/sass/_layout.scss index d12de70..6e843aa 100644 --- a/app/assets/stylesheets/sass/_layout.scss +++ b/app/assets/stylesheets/sass/_layout.scss @@ -255,6 +255,11 @@ body { + #content { padding-top: 4em; } + + .conferences.page-style-article & { + min-height: 40em; + min-height: 50vh; + } } } @@ -293,7 +298,7 @@ main { padding: 4em; clear: right; - .organizations-show & { + .organizations.page-style-article & { min-height: 25em; min-height: 50vh; } @@ -311,6 +316,10 @@ main { h1, h2 { color: inherit; + + a { + color: inherit; + } } .row { @@ -400,7 +409,7 @@ main { } } - .organizations-show & { + .organizations.page-style-article & { h1 { line-height: 0.9em; margin-bottom: 0.5em; @@ -411,13 +420,17 @@ main { } } - .conferences-show & { + .conferences.page-style-article & { .columns.banner { //height: 75%; padding-bottom: 1em; figure { - margin-left: 0; + margin: 2em 0 0; + + img { + box-shadow: 0 0 2em $black; + } } } } @@ -440,7 +453,7 @@ main { .has-banner-image & { min-height: 40em; height: 100%; - height: 100vh; + min-height: 100vh; } .page-style-article & { @@ -524,14 +537,26 @@ main { height: 50vh; } - .conferences-show & { + .row .align-bottom { + height: 50%; + } + + .conferences.page-style-article & { + height: auto; + padding-bottom: 2em; + + .align-bottom > div { + margin-bottom: 0; + } + .columns.banner { - height: 75%; + //height: 75%; + padding-bottom: 0; } - } - .row .align-bottom { - height: 50%; + .row .align-bottom { + height: auto; + } } } } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2abdb32..1b508e4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -19,11 +19,19 @@ class ApplicationController < ActionController::Base $page_info = {:path => request.env['PATH_INFO'], :controller => params['controller'], :action => params['action']} end - rescue_from ActiveRecord::RecordNotFound do |exception| + def do_404 render 'pages/404', status: 404 end - rescue_from ActiveRecord::PremissionDenied do |exception| + def do_403 render 'permission_denied', status: 403 end + + rescue_from ActiveRecord::RecordNotFound do |exception| + do_404 + end + + rescue_from ActiveRecord::PremissionDenied do |exception| + do_403 + end end diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index a690b24..85f8e40 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -112,9 +112,28 @@ class ConferencesController < ApplicationController def register set_conference - @user = User.new - @sub_action = 'registration_register' - render :registration + #@user = User.new + #@sub_action = 'registration_register' + #render :registration + if params['step'] + begin + template = "register_#{params['step']}" + if request.xhr? + render :partial => template + else + render template + end + rescue + do_404 + end + else + if request.xhr? + render :partial => 'register' + else + @register_step = true + render 'show' + end + end end def register_step diff --git a/app/uploaders/poster_uploader.rb b/app/uploaders/poster_uploader.rb index 8d309ef..1f33f94 100644 --- a/app/uploaders/poster_uploader.rb +++ b/app/uploaders/poster_uploader.rb @@ -39,22 +39,22 @@ class PosterUploader < CarrierWave::Uploader::Base image['width'] > image['height'] end -# def manipulate! -# cache_stored_file! if !cached? -# image = ::MiniMagick::Image.open(current_path) -# -# begin -# image.format(@format.to_s.downcase) if @format -# image = yield(image) -# image.write(current_path) -# image.run_command("identify", '"' + current_path + '"') -# ensure -# image.destroy! -# end -# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e -# default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en) -# message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default) -# raise CarrierWave::ProcessingError, message -# end + def manipulate! + cache_stored_file! if !cached? + image = ::MiniMagick::Image.open(current_path) + + begin + image.format(@format.to_s.downcase) if @format + image = yield(image) + image.write(current_path) + image.run_command("identify", Gem.win_platform? ? '"' + current_path + '"' : current_path) + ensure + image.destroy! + end + rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e + default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en) + message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default) + raise CarrierWave::ProcessingError, message + end end diff --git a/app/views/conferences/_header.html.haml b/app/views/conferences/_header.html.haml index 3557669..f80fe0b 100644 --- a/app/views/conferences/_header.html.haml +++ b/app/views/conferences/_header.html.haml @@ -5,10 +5,16 @@ .row .columns.small-12.banner %figure - %img{src: @conference.poster_url} + %img{src: @conference.poster.full.url} .columns.medium-8.align-bottom + - title = @conference.conference_type.slug == 'bikebike' ? 'Bike!Bike! '+@conference.start_date.year.to_s : @conference.title %div - %h1='Bike!Bike! '+@conference.start_date.year.to_s + %h1 + - if params['controller'] == 'conferences' && params['action'] == 'show' + = title + - else + %a{href: @conference.url} + = title %h2 - location = @conference.organizations.first.locations.first = location.city + ', ' + (location.territory ? Carmen::Country.coded(location.country).subregions.coded(location.territory).name : location.country) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 84df7ac..56039f4 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -9,8 +9,11 @@ %article.row .columns.large-10 - %h2=('About '+@conference.title) - %p=@conference.info.html_safe + - if @register_step + %h2='Register!' + - else + %h2=('About '+@conference.title) + =p @conference, :info - content_for :side_bar do %h5= @conference.title+' is hosted by:' diff --git a/config/routes.rb b/config/routes.rb index 8381a68..3ab5427 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,22 +8,25 @@ BikeBike::Application.routes.draw do resources :conference_types, :param => :type, :path => '/conferences', :as => :conference, :except => :index do resources :conferences, :param => :slug, :path => '/' do - get :hosts - get :registration - resources :workshops, :param => 'slug' - get :registration - get :register - patch 'register/step/:step' => 'conferences#register_step' + #get :hosts + #get :registration + #get :registration + #resources :workshops, :param => 'slug' + #get :register, :param => 'step' + ##get 'register(/:step)' => 'conferences#register' + #patch 'register/step/:step' => 'conferences#register_step' #resources :registrations, :path => 'registration' do # get :form, on: :collection #end - get 'registration/form' => 'conferences#registration', :sub_action => "form", as: 'registration_form' - get 'registration/form/register' => 'conferences#registration', :sub_action => "register", as: 'registration_register' - get 'registration/form/stats' => 'conferences#registration', :sub_action => "stats", as: 'registration_stats' - post :nonhosts - post 'registration/form/add-field' => 'conferences#add_field', as: 'registration_add_field' - post 'registration/form/remove-field' => 'conferences#remove_field', as: 'registration_remove_field' - post 'registration/form/reorder' => 'conferences#reorder', as: 'registration_reorder' + #get 'registration/form' => 'conferences#registration', :sub_action => "form", as: 'registration_form' + #get 'registration/form/register' => 'conferences#registration', :sub_action => "register", as: 'registration_register' + #get 'registration/form/stats' => 'conferences#registration', :sub_action => "stats", as: 'registration_stats' + #post :nonhosts + #post 'registration/form/add-field' => 'conferences#add_field', as: 'registration_add_field' + #post 'registration/form/remove-field' => 'conferences#remove_field', as: 'registration_remove_field' + #post 'registration/form/reorder' => 'conferences#reorder', as: 'registration_reorder' + + #post 'registration/form/reorder' => 'conferences#reorder', as: 'registration_reorder' end end diff --git a/db/migrate/20140713213158_add_is_confirmed_to_conference_registraions.rb b/db/migrate/20140713213158_add_is_confirmed_to_conference_registraions.rb new file mode 100644 index 0000000..36e842b --- /dev/null +++ b/db/migrate/20140713213158_add_is_confirmed_to_conference_registraions.rb @@ -0,0 +1,5 @@ +class AddIsConfirmedToConferenceRegistraions < ActiveRecord::Migration + def change + add_column :conference_registrations, :is_confirmed, :boolean + end +end diff --git a/db/migrate/20140713213502_add_is_participant_to_conference_registraions.rb b/db/migrate/20140713213502_add_is_participant_to_conference_registraions.rb new file mode 100644 index 0000000..7f584f8 --- /dev/null +++ b/db/migrate/20140713213502_add_is_participant_to_conference_registraions.rb @@ -0,0 +1,5 @@ +class AddIsParticipantToConferenceRegistraions < ActiveRecord::Migration + def change + add_column :conference_registrations, :is_participant, :boolean + end +end diff --git a/db/migrate/20140713213534_add_is_volunteer_to_conference_registraions.rb b/db/migrate/20140713213534_add_is_volunteer_to_conference_registraions.rb new file mode 100644 index 0000000..081b3dc --- /dev/null +++ b/db/migrate/20140713213534_add_is_volunteer_to_conference_registraions.rb @@ -0,0 +1,5 @@ +class AddIsVolunteerToConferenceRegistraions < ActiveRecord::Migration + def change + add_column :conference_registrations, :is_volunteer, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index edb94f6..554b7e4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140712190815) do +ActiveRecord::Schema.define(version: 20140713213534) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -61,6 +61,9 @@ ActiveRecord::Schema.define(version: 20140712190815) do t.string "is_attending" t.datetime "created_at" t.datetime "updated_at" + t.boolean "is_confirmed" + t.boolean "is_participant" + t.boolean "is_volunteer" end create_table "conference_types", force: true do |t| diff --git a/lib/tasks/regenerate.rake b/lib/tasks/regenerate.rake index f351a30..cc99f7f 100644 --- a/lib/tasks/regenerate.rake +++ b/lib/tasks/regenerate.rake @@ -2,7 +2,11 @@ namespace :regenerate do desc "Regenerates images" task conference_posters: :environment do - Conference.all.each {|m| m.poster.recreate_versions!} + Conference.all.each { |m| + #puts m.title + #puts m.poster + m.poster.recreate_versions! + } #puts Conference.all.to_json.to_s end