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 |
|
||||
|
|
||||
# Choose what kind of storage to use for this uploader: |
|
||||
storage :file |
storage :file |
||||
# storage :fog |
process :optimize |
||||
|
|
||||
|
@@sizes = {:thumb => [120, 120], :icon => [48, 48], :preview => [360, 120], :full => [1024, 1024]} |
||||
|
|
||||
# Override the directory where uploaded files will be stored. |
|
||||
# This is a sensible default for uploaders that are meant to be mounted: |
|
||||
def store_dir |
def store_dir |
||||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" |
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" |
||||
end |
end |
||||
|
|
||||
# Provide a default URL as a default if there hasn't been a file uploaded: |
version :thumb do |
||||
# def default_url |
process :resize_to_fill => @@sizes[:thumb] |
||||
# # For Rails 3.1+ asset pipeline compatibility: |
end |
||||
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) |
|
||||
# |
version :icon do |
||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_') |
process :resize_to_fill => @@sizes[:icon] |
||||
# end |
end |
||||
|
|
||||
# Process files as they are uploaded: |
version :preview do |
||||
# process :scale => [200, 300] |
process :resize_to_fit => @@sizes[:preview] |
||||
# |
end |
||||
# def scale(width, height) |
|
||||
# # do something |
version :full do |
||||
# end |
process :resize_to_fit => @@sizes[:full] |
||||
|
end |
||||
# Create different versions of your uploaded files: |
|
||||
# version :thumb do |
def image |
||||
# process :scale => [50, 50] |
@image ||= MiniMagick::Image.open(file.path) |
||||
# end |
end |
||||
|
|
||||
# Add a white list of extensions which are allowed to be uploaded. |
def is_landscape? |
||||
# For images you might use something like this: |
image['width'] > image['height'] |
||||
# def extension_white_list |
end |
||||
# %w(jpg jpeg gif png) |
|
||||
# end |
def manipulate! |
||||
|
cache_stored_file! if !cached? |
||||
# Override the filename of the uploaded files: |
image = ::MiniMagick::Image.open(current_path) |
||||
# Avoid using model.id or version_name here, see uploader/store.rb for details. |
|
||||
# def filename |
begin |
||||
# "something.jpg" if original_filename |
image.format(@format.to_s.downcase) if @format |
||||
# end |
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 |
||||
|
|
||||
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 |
|
||||
%th Cover |
|
||||
%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| |
- @conferences.each do |conference| |
||||
%tr |
%li=render 'preview', :conference => conference |
||||
%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