Browse Source

Minor adjustments

development
Godwin 10 years ago
parent
commit
62b0bea131
  1. 2
      Gemfile
  2. 10
      Gemfile.lock
  3. BIN
      app/assets/images/Thumbs.db
  4. 45
      app/assets/stylesheets/sass/_layout.scss
  5. 12
      app/controllers/application_controller.rb
  6. 25
      app/controllers/conferences_controller.rb
  7. 34
      app/uploaders/poster_uploader.rb
  8. 10
      app/views/conferences/_header.html.haml
  9. 7
      app/views/conferences/show.html.haml
  10. 29
      config/routes.rb
  11. 5
      db/migrate/20140713213158_add_is_confirmed_to_conference_registraions.rb
  12. 5
      db/migrate/20140713213502_add_is_participant_to_conference_registraions.rb
  13. 5
      db/migrate/20140713213534_add_is_volunteer_to_conference_registraions.rb
  14. 5
      db/schema.rb
  15. 6
      lib/tasks/regenerate.rake

2
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'

10
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

BIN
app/assets/images/Thumbs.db

Binary file not shown.

45
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;
}
}
}
}

12
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

25
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

34
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

10
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)

7
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:'

29
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

5
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

5
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

5
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

5
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|

6
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

Loading…
Cancel
Save