Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
updating clipping image and hompage_feature to use filesystem backend…
Browse files Browse the repository at this point in the history
… as default
  • Loading branch information
Bruno Bornsztein committed Mar 31, 2008
1 parent 1353701 commit f099328
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 25 deletions.
9 changes: 2 additions & 7 deletions app/models/clipping_image.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
class ClippingImage < Asset
has_attachment :content_type => :image,
:storage => :s3,
:max_size => 3.megabytes,
:resize_to => "465>",
:path_prefix => "assets",
:thumbnails => { :thumb => "100x100!", :medium_square => '200x200!', :medium => "200>" }

has_attachment prepare_options_for_attachment_fu(AppConfig.clipping['attachment_fu_options'])

validates_as_attachment
end
6 changes: 1 addition & 5 deletions app/models/homepage_feature.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
class HomepageFeature < ActiveRecord::Base
has_attachment :storage => :s3,
:min_size => 1,
:max_size => 1.megabytes,
:content_type => ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png'],
:thumbnails => AppConfig.feature['thumbs']
has_attachment prepare_options_for_attachment_fu(AppConfig.feature['attachment_fu_options'])

validates_presence_of
validates_presence_of :content_type
Expand Down
5 changes: 1 addition & 4 deletions app/models/photo.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
class Photo < ActiveRecord::Base
acts_as_commentable

attachment_fu_options = AppConfig.photo['attachment_fu_options']
attachment_fu_options = attachment_fu_options.symbolize_keys.merge({:storage => attachment_fu_options['storage'].to_sym, :max_size => attachment_fu_options['max_size'].to_i.megabytes })

has_attachment attachment_fu_options
has_attachment prepare_options_for_attachment_fu(AppConfig.photo['attachment_fu_options'])

acts_as_taggable

Expand Down
8 changes: 5 additions & 3 deletions assets/javascripts/glider.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ Object.extend(Object.extend(Glider.prototype, Abstract.prototype), {
var nextIndex = (this.sections.length - 1 == currentIndex) ? 0 : currentIndex + 1;
} else var nextIndex = 1;

this.moveTo(this.sections[nextIndex], this.scroller, {
duration: this.options.duration
});
if(this.sections.length > 1){
this.moveTo(this.sections[nextIndex], this.scroller, {
duration: this.options.duration
});
}
},

previous: function(){
Expand Down
24 changes: 19 additions & 5 deletions engine_config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ community_description: "The Best Place for People Who Love Communities"
support_email: "support@community.com"
meta_description: 'A description of your community for use in META tags.'
meta_keywords: 'keywords for use in META tags'
sections_enabled: ['photos', 'posts', 'clippings', 'contests', 'categories', 'events']
show_advertising: false
closed_beta_mode: false

# The label you use for 'staff' writers (featured writer, staff, pro, etc.)
featured_writer_label: 'Featured Writer'
Expand All @@ -22,10 +25,21 @@ photo:
content_type: ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png']

feature:
thumbs: {thumb: [45,45], large: [635,150]}
use_thumbs: false
dimensions: [150, 635]
sections_enabled: ['photos', 'posts', 'clippings', 'contests', 'categories', 'events']
show_advertising: false
closed_beta_mode: false

attachment_fu_options:
resize_to: "465>"
min_size: 1
max_size: 1
thumbnails: {thumb: '45x45!', large: '635x150!'}
storage: 'file_system'
content_type: ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png']

clipping:
attachment_fu_options:
resize_to: "465>"
min_size: 1
max_size: 3
thumbnails: {thumb: "100x100!", medium_square: "200x200!", medium: "200>"}
storage: 'file_system'
content_type: ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png']
1 change: 1 addition & 0 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'community_engine'
require 's3_cache_control'

Module.class_eval do
Expand Down
14 changes: 13 additions & 1 deletion lib/community_engine.rb
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# CommunityEngine
# CommunityEngine
module CommunityEngine
module ActiveRecordExtensions

def prepare_options_for_attachment_fu(options)
attachment_fu_options = options.symbolize_keys.merge({:storage => options['storage'].to_sym,
:max_size => options['max_size'].to_i.megabytes})
end

end
end

ActiveRecord::Base.send(:extend, CommunityEngine::ActiveRecordExtensions)

0 comments on commit f099328

Please sign in to comment.