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 |
|||
require 'carrierwave/processing/mini_magick' |
|||
|
|||
class PosterUploader < CarrierWave::Uploader::Base |
|||
|
|||
# Include RMagick or MiniMagick support: |
|||
# include CarrierWave::RMagick |
|||
# include CarrierWave::MiniMagick |
|||
include CarrierWave::ImageOptimizer |
|||
include CarrierWave::MiniMagick |
|||
|
|||
# Choose what kind of storage to use for this uploader: |
|||
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 |
|||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" |
|||
end |
|||
|
|||
# Provide a default URL as a default if there hasn't been a file uploaded: |
|||
# def default_url |
|||
# # For Rails 3.1+ asset pipeline compatibility: |
|||
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) |
|||
# |
|||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_') |
|||
# end |
|||
|
|||
# Process files as they are uploaded: |
|||
# process :scale => [200, 300] |
|||
# |
|||
# def scale(width, height) |
|||
# # do something |
|||
# end |
|||
|
|||
# Create different versions of your uploaded files: |
|||
# version :thumb do |
|||
# process :scale => [50, 50] |
|||
# end |
|||
|
|||
# Add a white list of extensions which are allowed to be uploaded. |
|||
# For images you might use something like this: |
|||
# def extension_white_list |
|||
# %w(jpg jpeg gif png) |
|||
# end |
|||
|
|||
# Override the filename of the uploaded files: |
|||
# Avoid using model.id or version_name here, see uploader/store.rb for details. |
|||
# def filename |
|||
# "something.jpg" if original_filename |
|||
# end |
|||
version :thumb do |
|||
process :resize_to_fill => @@sizes[:thumb] |
|||
end |
|||
|
|||
version :icon do |
|||
process :resize_to_fill => @@sizes[:icon] |
|||
end |
|||
|
|||
version :preview do |
|||
process :resize_to_fit => @@sizes[:preview] |
|||
end |
|||
|
|||
version :full do |
|||
process :resize_to_fit => @@sizes[:full] |
|||
end |
|||
|
|||
def image |
|||
@image ||= MiniMagick::Image.open(file.path) |
|||
end |
|||
|
|||
def is_landscape? |
|||
image['width'] > image['height'] |
|||
end |
|||
|
|||
def manipulate! |
|||
cache_stored_file! if !cached? |
|||
image = ::MiniMagick::Image.open(current_path) |
|||
|
|||
begin |
|||
image.format(@format.to_s.downcase) if @format |
|||
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 |
|||
|
@ -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 |
|||
|
|||
%table |
|||
%tr |
|||
%th Title |
|||
%th Slug |
|||
%th Start date |
|||
%th End date |
|||
%th Info |
|||
%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 |
|||
|
|||
- page_style :list |
|||
- title _'page.Conferences' |
|||
- banner_image '/assets/conference.jpg' |
|||
- content_for :banner do |
|||
.row |
|||
.columns |
|||
%h1=_'page.Conferences' |
|||
|
|||
%ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3.conference-list.preview-list |
|||
- @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 |
|||
%li=render 'preview', :conference => conference |
|||
|
@ -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 |
|||
%tr |
|||
%th Name |
|||
%th Slug |
|||
%th Email address |
|||
%th Url |
|||
%th Year founded |
|||
%th Info |
|||
%th Logo |
|||
%th Avatar |
|||
%th Requires approval |
|||
%th Secret question |
|||
%th Secret answer |
|||
%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 |
|||
- @organizations.sort_by{|k,v|k}.each do |country,territories| |
|||
%h2=country |
|||
- territories.sort_by{|k,v|k}.each do |territory,cities| |
|||
- if territory != 0 |
|||
%h3=territory |
|||
- cities.sort_by{|k,v|k}.each do |city,organizations| |
|||
%ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3.org-list.preview-list |
|||
- uri = CGI::escape(city+' '+country) |
|||
%li.city |
|||
%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');"} |
|||
%h4=city |
|||
- organizations.each do |organization| |
|||
%li=render 'preview', :organization => organization |
|||
|
Loading…
Reference in new issue