forked from tenderlove/rubycommitters.org
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added portraits importing and resizing so that portraits are served l…
…ocally with optimal performance.
- Loading branch information
Showing
49 changed files
with
125 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.bundle | ||
db/rubycommitters_development.db | ||
db/rubycommitters_test.db | ||
log/*.log | ||
tmp/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
class Portrait < ActiveRecord::Base | ||
mount_uploader :file, PortraitUploader | ||
belongs_to :hero | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
li== image_tag portrait.url | ||
li== image_tag portrait.file.url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
class PortraitUploader < CarrierWave::Uploader::Base | ||
|
||
## | ||
# Image manipulator library: | ||
# | ||
# include CarrierWave::RMagick | ||
# include CarrierWave::ImageScience | ||
include CarrierWave::MiniMagick | ||
|
||
## | ||
# Storage type | ||
# | ||
storage :file | ||
# | ||
# configure do |config| | ||
# config.s3_access_key_id = 'xxxx' | ||
# config.s3_secret_access_key = 'xxxx' | ||
# config.s3_bucket = 'assets-web' | ||
# end | ||
# | ||
# storage :right_s3 | ||
|
||
|
||
## Manually set root | ||
def root; File.join(Padrino.root,"public/"); end | ||
|
||
## | ||
# Directory where uploaded files will be stored (default is /public/uploads) | ||
# | ||
def store_dir | ||
'images/portraits/' | ||
end | ||
|
||
## | ||
# Directory where uploaded temp files will be stored (default is [root]/tmp) | ||
# | ||
def cache_dir | ||
Padrino.root("tmp") | ||
end | ||
|
||
## | ||
# Default URL as a default if there hasn't been a file uploaded | ||
# | ||
def default_url | ||
'http://placehold.it/100x100' | ||
end | ||
|
||
## | ||
# Process files as they are uploaded. | ||
# | ||
process :resize_to_fit => [100, 100] | ||
# version :thumb do | ||
# process :resize_to_fill => [100, 100] | ||
# end | ||
# | ||
# def scale(width, height) | ||
# # do something | ||
# end | ||
|
||
## | ||
# Create different versions of your uploaded files | ||
# | ||
# version :header do | ||
# process :resize_to_fill => [940, 250] | ||
# version :thumb do | ||
# process :resize_to_fill => [230, 85] | ||
# end | ||
# end | ||
## | ||
# White list of extensions which are allowed to be uploaded: | ||
# | ||
# def extension_white_list | ||
# %w(jpg jpeg gif png) | ||
# end | ||
|
||
## | ||
# Override the filename of the uploaded files | ||
# | ||
def filename | ||
if original_filename | ||
original_extname = File.extname(original_filename) | ||
"#{model.hero.username}_#{model.id}#{original_extname.blank? ? '.jpg' : original_extname}" | ||
end | ||
end | ||
# | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
desc "import the list of ruby committers" | ||
task :import => ['ar:drop', 'ar:migrate'] do | ||
require 'open-uri' | ||
require 'fileutils' | ||
FileUtils.rm_rf File.join(Padrino.root, 'public', 'images', 'portraits') | ||
Hero.import open('http://svn.coderepos.org/share/lang/ruby/ruby-committers/ruby-committers.yml') | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
th { | ||
text-align: right; | ||
vertical-align: top; | ||
} | ||
|
||
img { | ||
height: 100px; | ||
} |
2d4983f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Excited to see this Padrino version of rubycommiters. Thanks for doing this!