Skip to content

Commit

Permalink
Merge pull request #15 from CharlonTank/RT_sponsors
Browse files Browse the repository at this point in the history
Add sponsor logo uploader
  • Loading branch information
tibastral committed Jul 1, 2013
2 parents dbb8497 + e60b94d commit 303dd23
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 42 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Expand Up @@ -27,6 +27,9 @@ gem 'haml'
gem 'simple_form'
gem 'squeel'

gem 'cloudinary'
gem 'carrierwave'

gem 'activeadmin'

gem 'rails-i18n'
Expand Down
68 changes: 40 additions & 28 deletions Gemfile.lock
@@ -1,12 +1,12 @@
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
actionmailer (3.2.12)
actionpack (= 3.2.12)
mail (~> 2.4.4)
actionpack (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
Expand All @@ -26,25 +26,26 @@ GEM
meta_search (>= 0.9.2)
rails (>= 3.0.0)
sass (>= 3.1.0)
activemodel (3.2.13)
activesupport (= 3.2.13)
activemodel (3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activerecord (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
activeresource (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.4)
ansi (1.4.3)
arbre (1.0.1)
activesupport (>= 3.0.0)
arel (3.0.2)
aws_cf_signer (0.1.1)
bcrypt-ruby (3.0.1)
bourbon (3.1.8)
sass (>= 3.2.0)
Expand All @@ -56,7 +57,13 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
carrierwave (0.8.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
chunky_png (1.2.8)
cloudinary (1.0.59)
aws_cf_signer
rest-client
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
Expand Down Expand Up @@ -106,7 +113,7 @@ GEM
hashie (2.0.5)
hike (1.2.3)
httpauth (0.2.0)
i18n (0.6.1)
i18n (0.6.4)
inherited_resources (1.4.0)
has_scope (~> 0.5.0)
responders (~> 0.9)
Expand All @@ -122,7 +129,8 @@ GEM
activesupport (>= 3.0.0)
launchy (2.3.0)
addressable (~> 2.3)
mail (2.5.4)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_search (1.1.3)
Expand Down Expand Up @@ -164,19 +172,19 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
rails (3.2.12)
actionmailer (= 3.2.12)
actionpack (= 3.2.12)
activerecord (= 3.2.12)
activeresource (= 3.2.12)
activesupport (= 3.2.12)
bundler (~> 1.0)
railties (= 3.2.13)
railties (= 3.2.12)
rails-i18n (0.7.3)
i18n (~> 0.5)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
Expand All @@ -187,6 +195,8 @@ GEM
json (~> 1.4)
responders (0.9.3)
railties (~> 3.1)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
Expand Down Expand Up @@ -241,6 +251,8 @@ PLATFORMS
DEPENDENCIES
activeadmin
capybara
carrierwave
cloudinary
coffee-rails
compass-rails (~> 1.0.3)
cucumber-rails
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/presentations_controller.rb
@@ -1,5 +1,5 @@
class PresentationsController < ApplicationController
helper_method :presentations, :old_presentations, :presentation
helper_method :presentations, :old_presentations, :presentation, :sponsors

def new
end
Expand Down Expand Up @@ -31,6 +31,11 @@ def presentations
.order{ created_at.desc }
end

def sponsors
@sponsors ||= Sponsor
.order{ created_at.desc }
end

def presentation
@presentation ||= Presentation.new(current_user ? {name: current_user.name, email: current_user.email} : {})
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/sponsor.rb
@@ -1,3 +1,4 @@
class Sponsor < ActiveRecord::Base
attr_accessible :from, :name, :until
attr_accessible :from, :name, :until, :logo
mount_uploader :logo, PictureUploader
end
7 changes: 7 additions & 0 deletions app/uploaders/picture_uploader.rb
@@ -0,0 +1,7 @@
class PictureUploader < CarrierWave::Uploader::Base
include Cloudinary::CarrierWave

version :thumbnail do
resize_to_fit(50, 50)
end
end
8 changes: 7 additions & 1 deletion app/views/presentations/new.html.haml
Expand Up @@ -34,7 +34,7 @@

.presentations
%h2 Talks proposés pour le prochain meetup:
= render presentations.select{|e| e.created_at > 2.month.ago}
= render presentations.select{|presentation| presentation.created_at > 2.month.ago}
.faq
%details
%summary Talks proposés il y a longtemps n'ayant jamais été présentés
Expand All @@ -47,3 +47,9 @@
#{presentation.video_url.present? ? link_to(presentation.title, presentation.video_url) : presentation.title} (le #{presentation.occured_at})
#{presentation.slides_url.present? ? link_to("(slides)", presentation.slides_url) : ""}
#{presentation.notes.present? ? link_to("(notes)", presentation) : ""}
.sponsors
%h2 Sponsors
- sponsors.each do |sponsor|
.sponsor
- if sponsor.logo.present?
= image_tag(sponsor.logo.thumbnail.url, :alt => sponsor.name)
19 changes: 19 additions & 0 deletions config/cloudinary.yml
@@ -0,0 +1,19 @@
---
development:
cloud_name: hmdgjw97p
api_key: '426858336164834'
api_secret: zxgYSZUnq2N84gHKkhYxfHc5btc
enhance_image_tag: true
static_image_support: false
production:
cloud_name: hmdgjw97p
api_key: '426858336164834'
api_secret: zxgYSZUnq2N84gHKkhYxfHc5btc
enhance_image_tag: true
static_image_support: true
test:
cloud_name: hmdgjw97p
api_key: '426858336164834'
api_secret: zxgYSZUnq2N84gHKkhYxfHc5btc
enhance_image_tag: true
static_image_support: false
5 changes: 5 additions & 0 deletions db/migrate/20130701124333_add_logo_to_sponsor.rb
@@ -0,0 +1,5 @@
class AddLogoToSponsor < ActiveRecord::Migration
def change
add_column :sponsors, :logo, :string
end
end
23 changes: 12 additions & 11 deletions db/schema.rb
Expand Up @@ -11,16 +11,16 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20130307175541) do
ActiveRecord::Schema.define(:version => 20130701124333) do

create_table "active_admin_comments", :force => true do |t|
t.integer "resource_id", :null => false
t.string "resource_id", :null => false
t.string "resource_type", :null => false
t.integer "author_id"
t.string "author_type"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "namespace"
end

Expand All @@ -29,18 +29,18 @@
add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"

create_table "admin_users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
Expand All @@ -58,8 +58,8 @@
t.string "name"
t.string "title"
t.string "email"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.date "occured_at"
t.integer "length"
t.integer "difficulty"
Expand All @@ -76,6 +76,7 @@
t.date "until"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "logo"
end

create_table "users", :force => true do |t|
Expand Down

0 comments on commit 303dd23

Please sign in to comment.