Godwin
11 years ago
36 changed files with 4165 additions and 244 deletions
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 726 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 175 KiB |
After Width: | Height: | Size: 213 KiB |
After Width: | Height: | Size: 153 KiB |
After Width: | Height: | Size: 769 KiB |
After Width: | Height: | Size: 759 KiB |
@ -1,51 +1,60 @@ |
|||||
# encoding: utf-8 |
# encoding: utf-8 |
||||
|
require 'carrierwave/processing/mini_magick' |
||||
|
|
||||
class PosterUploader < CarrierWave::Uploader::Base |
class PosterUploader < CarrierWave::Uploader::Base |
||||
|
|
||||
# Include RMagick or MiniMagick support: |
include CarrierWave::ImageOptimizer |
||||
# include CarrierWave::RMagick |
include CarrierWave::MiniMagick |
||||
# include CarrierWave::MiniMagick |
|
||||
|
storage :file |
||||
# Choose what kind of storage to use for this uploader: |
process :optimize |
||||
storage :file |
|
||||
# storage :fog |
@@sizes = {:thumb => [120, 120], :icon => [48, 48], :preview => [360, 120], :full => [1024, 1024]} |
||||
|
|
||||
# Override the directory where uploaded files will be stored. |
def store_dir |
||||
# This is a sensible default for uploaders that are meant to be mounted: |
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" |
||||
def store_dir |
end |
||||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" |
|
||||
end |
version :thumb do |
||||
|
process :resize_to_fill => @@sizes[:thumb] |
||||
# Provide a default URL as a default if there hasn't been a file uploaded: |
end |
||||
# def default_url |
|
||||
# # For Rails 3.1+ asset pipeline compatibility: |
version :icon do |
||||
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) |
process :resize_to_fill => @@sizes[:icon] |
||||
# |
end |
||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_') |
|
||||
# end |
version :preview do |
||||
|
process :resize_to_fit => @@sizes[:preview] |
||||
# Process files as they are uploaded: |
end |
||||
# process :scale => [200, 300] |
|
||||
# |
version :full do |
||||
# def scale(width, height) |
process :resize_to_fit => @@sizes[:full] |
||||
# # do something |
end |
||||
# end |
|
||||
|
def image |
||||
# Create different versions of your uploaded files: |
@image ||= MiniMagick::Image.open(file.path) |
||||
# version :thumb do |
end |
||||
# process :scale => [50, 50] |
|
||||
# end |
def is_landscape? |
||||
|
image['width'] > image['height'] |
||||
# Add a white list of extensions which are allowed to be uploaded. |
end |
||||
# For images you might use something like this: |
|
||||
# def extension_white_list |
def manipulate! |
||||
# %w(jpg jpeg gif png) |
cache_stored_file! if !cached? |
||||
# end |
image = ::MiniMagick::Image.open(current_path) |
||||
|
|
||||
# Override the filename of the uploaded files: |
begin |
||||
# Avoid using model.id or version_name here, see uploader/store.rb for details. |
image.format(@format.to_s.downcase) if @format |
||||
# def filename |
image = yield(image) |
||||
# "something.jpg" if original_filename |
image.write(current_path) |
||||
# end |
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 |
||||
|
|
||||
end |
end |
||||
|
@ -0,0 +1,5 @@ |
|||||
|
= link_to ('/conferences/' + conference.conference_type.slug + '/' + conference.slug) do |
||||
|
%h5 |
||||
|
= conference.title |
||||
|
%figure.conference-preview.preview-tile{:style => (conference.cover? ? ('background-image: url(' + conference.cover.preview.url + ')') : nil)} |
||||
|
= image_tag conference.poster.preview.url |
@ -1,43 +1,11 @@ |
|||||
%h1 Listing conferences |
- page_style :list |
||||
|
- title _'page.Conferences' |
||||
%table |
- banner_image '/assets/conference.jpg' |
||||
%tr |
- content_for :banner do |
||||
%th Title |
.row |
||||
%th Slug |
.columns |
||||
%th Start date |
%h1=_'page.Conferences' |
||||
%th End date |
|
||||
%th Info |
%ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3.conference-list.preview-list |
||||
%th Poster |
- @conferences.each do |conference| |
||||
%th Cover |
%li=render 'preview', :conference => conference |
||||
%th Workshop schedule published |
|
||||
%th Registration open |
|
||||
%th Meals provided |
|
||||
%th Meal info |
|
||||
%th Travel info |
|
||||
%th Conference type |
|
||||
%th |
|
||||
%th |
|
||||
%th |
|
||||
|
|
||||
- @conferences.each do |conference| |
|
||||
%tr |
|
||||
%td= conference.title |
|
||||
%td= conference.slug |
|
||||
%td= conference.start_date |
|
||||
%td= conference.end_date |
|
||||
%td= conference.info |
|
||||
%td= conference.poster |
|
||||
%td= conference.cover |
|
||||
%td= conference.workshop_schedule_published |
|
||||
%td= conference.registration_open |
|
||||
%td= conference.meals_provided |
|
||||
%td= conference.meal_info |
|
||||
%td= conference.travel_info |
|
||||
%td= conference.conference_type |
|
||||
%td= link_to 'Show', conference |
|
||||
%td= link_to 'Edit', edit_conference_path(conference) |
|
||||
%td= link_to 'Destroy', conference, :method => :delete, :data => { :confirm => 'Are you sure?' } |
|
||||
|
|
||||
%br |
|
||||
|
|
||||
= link_to 'New Conference', new_conference_path |
|
||||
|
@ -0,0 +1,5 @@ |
|||||
|
= link_to organization do |
||||
|
%h5 |
||||
|
= organization.name |
||||
|
%figure.org-preview.preview-tile{:style => (organization.cover? ? ('background-image: url(' + organization.cover.preview.url + ')') : nil)} |
||||
|
= image_tag organization.avatar.preview.url |
@ -1,41 +1,21 @@ |
|||||
%h1 Listing organizations |
- page_style :list |
||||
|
- title _'page.Organizations' |
||||
|
- banner_image '/assets/orgs.jpg' |
||||
|
- content_for :banner do |
||||
|
.row |
||||
|
.columns |
||||
|
%h1=_'page.Organizations' |
||||
|
|
||||
%table |
- @organizations.sort_by{|k,v|k}.each do |country,territories| |
||||
%tr |
%h2=country |
||||
%th Name |
- territories.sort_by{|k,v|k}.each do |territory,cities| |
||||
%th Slug |
- if territory != 0 |
||||
%th Email address |
%h3=territory |
||||
%th Url |
- cities.sort_by{|k,v|k}.each do |city,organizations| |
||||
%th Year founded |
%ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3.org-list.preview-list |
||||
%th Info |
- uri = CGI::escape(city+' '+country) |
||||
%th Logo |
%li.city |
||||
%th Avatar |
%figure{:style => "background-image: url('http://maps.googleapis.com/maps/api/staticmap?center=#{uri}&zoom=4&size=600x300&maptype=roadmap&markers=size:small%7C#{uri}&key=AIzaSyDhfT68lGTwJHoUfC02fmA1SYNexO19J3M');"} |
||||
%th Requires approval |
%h4=city |
||||
%th Secret question |
- organizations.each do |organization| |
||||
%th Secret answer |
%li=render 'preview', :organization => organization |
||||
%th User organization replationship |
|
||||
%th |
|
||||
%th |
|
||||
%th |
|
||||
|
|
||||
- @organizations.each do |organization| |
|
||||
%tr |
|
||||
%td= organization.name |
|
||||
%td= organization.slug |
|
||||
%td= organization.email_address |
|
||||
%td= organization.url |
|
||||
%td= organization.year_founded |
|
||||
%td= organization.info |
|
||||
%td= organization.logo |
|
||||
%td= organization.avatar |
|
||||
%td= organization.requires_approval |
|
||||
%td= organization.secret_question |
|
||||
%td= organization.secret_answer |
|
||||
%td= organization.user_organization_replationship_id |
|
||||
%td= link_to 'Show', organization |
|
||||
%td= link_to 'Edit', edit_organization_path(organization) |
|
||||
%td= link_to 'Destroy', organization, :method => :delete, :data => { :confirm => 'Are you sure?' } |
|
||||
|
|
||||
%br |
|
||||
|
|
||||
= link_to 'New Organization', new_organization_path |
|
||||
|
Loading…
Reference in new issue