diff --git a/Gemfile.lock b/Gemfile.lock index b808f73..948ef79 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: git://github.com/josevalim/rails-footnotes.git + revision: 087914beabb56c2e9979f63eeb0183591065dde3 + specs: + rails-footnotes (4.0.2) + rails (>= 3.2) + GIT remote: git://github.com/svenfuchs/i18n-active_record.git revision: 2d9a22b6a4e5d809782cdbfa65b14d9e47aa27fc @@ -193,6 +200,10 @@ GEM activesupport (>= 3.0, < 5.0) pg (0.17.1-x86-mingw32) polyglot (0.3.4) + pry (0.9.12.6) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) pry (0.9.12.6-x86-mingw32) coderay (~> 1.0) method_source (~> 0.8) @@ -293,6 +304,7 @@ GEM execjs (>= 0.3.0) json (>= 1.8.0) unicode_utils (1.4.0) + wdm (0.1.0) webmock (1.18.0) addressable (>= 2.3.6) crack (>= 0.3.2) @@ -335,6 +347,7 @@ DEPENDENCIES paper_trail pg rails (= 4.0.0) + rails-footnotes! rails_12factor rspec rspec-rails @@ -344,4 +357,5 @@ DEPENDENCIES simplecov sorcery (>= 0.8.1) uglifier (>= 1.3.0) + wdm (>= 0.1.0) webmock diff --git a/app/assets/fonts/AlteHaasGroteskBold.eot b/app/assets/fonts/AlteHaasGroteskBold.eot new file mode 100644 index 0000000..647418e Binary files /dev/null and b/app/assets/fonts/AlteHaasGroteskBold.eot differ diff --git a/app/assets/fonts/AlteHaasGroteskBold.otf b/app/assets/fonts/AlteHaasGroteskBold.otf new file mode 100644 index 0000000..4e7d3bb Binary files /dev/null and b/app/assets/fonts/AlteHaasGroteskBold.otf differ diff --git a/app/assets/fonts/AlteHaasGroteskBold.svg b/app/assets/fonts/AlteHaasGroteskBold.svg new file mode 100644 index 0000000..eabb2ae --- /dev/null +++ b/app/assets/fonts/AlteHaasGroteskBold.svg @@ -0,0 +1,3544 @@ + + + + +Created by FontForge 20090914 at Sun Jul 6 04:01:46 2014 + By www-data +Copyright (c) 2007 by Yann Le Coroller. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/fonts/AlteHaasGroteskBold.ttf b/app/assets/fonts/AlteHaasGroteskBold.ttf new file mode 100644 index 0000000..764b23d Binary files /dev/null and b/app/assets/fonts/AlteHaasGroteskBold.ttf differ diff --git a/app/assets/fonts/AlteHaasGroteskBold.woff b/app/assets/fonts/AlteHaasGroteskBold.woff new file mode 100644 index 0000000..3eba2b3 Binary files /dev/null and b/app/assets/fonts/AlteHaasGroteskBold.woff differ diff --git a/app/assets/images/conference.jpg b/app/assets/images/conference.jpg new file mode 100644 index 0000000..cbe47c1 Binary files /dev/null and b/app/assets/images/conference.jpg differ diff --git a/app/assets/images/orgs.jpg b/app/assets/images/orgs.jpg new file mode 100644 index 0000000..d1d7809 Binary files /dev/null and b/app/assets/images/orgs.jpg differ diff --git a/app/assets/images/xconference.jpg b/app/assets/images/xconference.jpg new file mode 100644 index 0000000..22d05e4 Binary files /dev/null and b/app/assets/images/xconference.jpg differ diff --git a/app/assets/images/xxconference.jpg b/app/assets/images/xxconference.jpg new file mode 100644 index 0000000..9f93a7c Binary files /dev/null and b/app/assets/images/xxconference.jpg differ diff --git a/app/assets/images/xxxconference.jpg b/app/assets/images/xxxconference.jpg new file mode 100644 index 0000000..4046fad Binary files /dev/null and b/app/assets/images/xxxconference.jpg differ diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index a521475..830bcdc 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -11,14 +11,14 @@ */ @font-face { - font-family: 'alte_haas_groteskbold'; - src: url('/assets/ahg.eot'); - src: url('/assets/ahg.eot?#iefix') format('embedded-opentype'), - url('/assets/ahg.woff') format('woff'), - url('/assets/ahg.ttf') format('truetype'), - url('/assets/ahg.svg#alte_haas_groteskbold') format('svg'); - font-weight: normal; - font-style: normal; + font-family: 'AlteHaasGroteskBold'; + src: url('/assets/AlteHaasGroteskBold.eot'); + src: url('/assets/AlteHaasGroteskBold.eot?#iefix') format('embedded-opentype'), + url('/assets/AlteHaasGroteskBold.woff') format('woff'), + url('/assets/AlteHaasGroteskBold.ttf') format('truetype'), + url('/assets/AlteHaasGroteskBold.svg#alte_haas_groteskbold') format('svg'); + font-weight: bold; + font-style: bold; } // Libraries diff --git a/app/assets/stylesheets/foundation_and_overrides.scss b/app/assets/stylesheets/foundation_and_overrides.scss index db1b3c7..45a2940 100644 --- a/app/assets/stylesheets/foundation_and_overrides.scss +++ b/app/assets/stylesheets/foundation_and_overrides.scss @@ -37,7 +37,8 @@ // We use these to control header font styles //$header-font-family: 'ff-ernestine-web-pro', sans-serif;//join("Open Sans", $body-font-family); -$header-font-family: 'Alte Haas Grotesk', sans-serif;//join("Open Sans", $body-font-family); +//$header-font-family: 'alte_haas_groteskbold', 'Alte Haas Grotesk', sans-serif;//join("Open Sans", $body-font-family); +$header-font-family: 'AlteHaasGroteskBold', sans-serif;//join("Open Sans", $body-font-family); $header-font-weight: bold; // $header-font-style: normal; // $header-font-color: #222; diff --git a/app/assets/stylesheets/sass/_base.scss b/app/assets/stylesheets/sass/_base.scss index 45e242c..b9421ec 100644 --- a/app/assets/stylesheets/sass/_base.scss +++ b/app/assets/stylesheets/sass/_base.scss @@ -99,3 +99,190 @@ ul.tags, color: lighten($body-font-color, 10); } } + +.org-preview { + /*display: block; + position: relative; + margin: 3em 0 0; + background-color: $organization-color; + background-size: cover; + background-position: center; + + /*&:before { + content: ''; + display: block; + padding-top: 50%; + }*/ + + /*figcaption { + display: block; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + } + + a { + display: block; + height: 100%; + } + + h3 { + position: absolute; + bottom: 100%; + height: 2em; + width: 100%; + background-color: $organization-color; + margin: 0; + font-size: 1em; + padding: 0.25em 0.5em; + } + + img { + background-color: $white; + margin: auto; + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + }*/ +} + +.preview-list { + li { + position: relative; + margin-bottom: 1em; + + &:before { + content: ''; + display: block; + padding-top: 50%; + } + + h4, h5 { + position: absolute; + top: 0; + min-height: 2em; + margin: 0; + font-size: 1em; + padding: 0.25em 0.5em; + color: $white; + width: 100%; + z-index: 1; + } + + figure { + position: absolute; + width: 100%; + height: 100%; + margin: 0; + bottom: 0; + text-align: center; + background-size: cover; + background-position: center; + background-blend-mode: luminosity; + @include single-transition(all, 100ms, ease-in); + + &:after { + content: ''; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: $white; + opacity: 0.5; + @include single-transition(all, 100ms, ease-in); + } + + img { + margin: auto; + position: absolute; + left: 0; + right: 0; + top: 2em; + bottom: 0; + max-width: 90%; + max-height: 66.667%; + z-index: 1; + } + } + + a { + &:hover { + figure { + background-color: transparent; + + &:after { + opacity: 0.25; + } + } + } + } + + &.city figure { + background-color: rgba($primary-color, 0.75); + + &:after { + display: none; + } + } + } + + &.org-list li { + h4 { + background-color: $primary-color; + } + + h5 { + background-color: $organization-color; + } + + figure { + background-color: $organization-color; + } + } + + &.conference-list li { + h4 { + background-color: $secondary-color; + } + + h5 { + background-color: $conference-color; + } + + figure { + background-color: $conference-color; + } + } + + li.city figure { + background-color: rgba($primary-color, 0.75); + + &:after { + display: none; + } + } + + @include breakpoint(medium) { + margin-left: 3em; + } +} + +@include breakpoint(medium) { + .organizations-index, + .conferences-index { + #content { + h2 { + margin-top: 1em; + } + + h3 { + margin-left: 1em; + } + } + } +} diff --git a/app/assets/stylesheets/sass/_layout.scss b/app/assets/stylesheets/sass/_layout.scss index 78ca53a..239b32d 100644 --- a/app/assets/stylesheets/sass/_layout.scss +++ b/app/assets/stylesheets/sass/_layout.scss @@ -57,6 +57,7 @@ body { width: 25%; padding: 2.5%; font-size: 1em; + min-height: 100vh; .button, p { display: block; @@ -93,7 +94,32 @@ body { main { min-height: 100%; //overflow: auto; - background-color: $primary-color; + background-color: $white; +} + +#content { + padding: 1em; + overflow: auto; + background-color: lighten($color-5, 20); + + .organizations & { + background-color: lighten(desaturate($organization-color, 25), 50); + min-height: 100vh; + } + + .conferences & { + background-color: lighten(desaturate($conference-color, 25), 50); + min-height: 100vh; + } + + @include breakpoint(medium) { + padding: 4em; + + .organizations-show & { + min-height: 25em; + min-height: 50vh; + } + } } #banner { @@ -135,14 +161,22 @@ main { width: 100%; height: 100%; z-index: 1; - @include background-image(linear-gradient(top, rgba(0,0,0,0) 50%, darken($primary-color, 25) 100%)); + @include background-image(linear-gradient(top, rgba(0,0,0,0) 50%, darken($conference-color, 25) 100%)); mix-blend-mode: multiply; } .row { - height: 50%; + height: 100%; z-index: 2; position: relative; + + .align-bottom { + height: 50%; + } + } + + .align-bottom > div { + margin-bottom: 3em; } .button { @@ -159,11 +193,110 @@ main { border-color: transparent; } } - + + .organizations & { + background-color: rgba($organization-color, 0.33); + + &:after { + @include background-image(linear-gradient(top, rgba(0,0,0,0) 50%, darken($organization-color, 25) 100%)); + } + } + + h2 { + color: $color-4; + margin-bottom: 0.25em; + + + em { + display: block; + color: $color-5; + margin-bottom: 1em; + } + } + + .organizations-show & { + h1 { + line-height: 0.9em; + margin-bottom: 0.5em; + } + + figure { + text-align: center; + } + } + + .conferences-show & { + .columns.banner { + height: 75%; + padding-bottom: 1em; + + figure { + margin-left: 0; + } + } + } + + .organizations-index &, + .conferences-index & { + height: 13vw; + min-height: 0; + background-position: center 25%; + + h1 { + font-size: 8vw; + margin-top: 1vw; + } + } + @include breakpoint(medium) { min-height: 40em; height: 100%; height: 100vh; + + .organizations-show &, + .conferences-show & { + min-height: 30em; + height: 50%; + height: 50vh; + + .row { + height: 100%; + } + + h1 { + font-size: 3.5em; + margin-top: 0.5em; + } + + figure { + img { + max-height: 100%; + } + } + + .portrait { + h1 { + margin-top: 20%; + } + + figure img { + width: 100%; + } + } + + .landscape { + .columns { + max-height: 70%; + } + } + } + + .organizations-index &, + .conferences-index & { + h1 { + font-size: 3.75vw; + margin-top: 6vw; + } + } } } @@ -176,6 +309,10 @@ main { -ms-flex-align: flex-end; -webkit-align-items: flex-end; align-items: flex-end; + + > div { + width: 100%; + } } .centered { diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 39afadb..36c76db 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,7 @@ class ApplicationController < ActionController::Base before_filter :capture_page_info def capture_page_info + init_vars $page_info = {:path => request.env['PATH_INFO'], :controller => params['controller'], :action => params['action']} end @@ -19,6 +20,6 @@ class ApplicationController < ActionController::Base end rescue_from ActiveRecord::PremissionDenied do |exception| - render 'permission_denied', status: 404 + render 'permission_denied', status: 403 end end diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 893c3e6..8b5dc60 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -6,12 +6,16 @@ class ConferencesController < ApplicationController # GET /conferences def index + #Conference.all.each {|m| m.poster.recreate_versions!} + puts " ------------- CONFERENCE INDEX -------------- " + puts params @conferences = Conference.all end # GET /conferences/1 def show - #puts params[:slug] + puts " --------------------------- " + puts params[:slug] end # GET /conferences/new diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index b5beeeb..f42f643 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -8,7 +8,30 @@ class OrganizationsController < ApplicationController # GET /organizations def index - @organizations = Organization.all + #Organization.all.each {|m| m.avatar.recreate_versions!} + #Conferences.all.each {|m| m.poster.recreate_versions!} + organizations = Organization.all + @organizations = Hash.new + countries = Hash.new + organizations.each { |organization| + location = organization.locations.first + if !countries.has_key?(location.country) + countries[location.country] = Carmen::Country.coded(location.country) + end + country = countries[location.country] + if !@organizations.has_key?(country.name) + @organizations[country.name] = Hash.new + end + territory = country.subregions.coded(location.territory) + territory_name = territory ? territory.name : 0 + if !@organizations[country.name].has_key?(territory_name) + @organizations[country.name][territory_name] = Hash.new + end + if !@organizations[country.name][territory_name].has_key?(location.city) + @organizations[country.name][territory_name][location.city] = Array.new + end + @organizations[country.name][territory_name][location.city] << organization + } end # GET /organizations/1 @@ -101,7 +124,7 @@ class OrganizationsController < ApplicationController countries[location.country.downcase][:territories][location.territory.downcase] = country.subregions.coded(location.territory) end territory = countries[location.country.downcase][:territories][location.territory.downcase] - city = URI.encode(location.city.downcase.gsub(/\s/, '-')) + city = URI.encode(location.city.downcase.gsub(/\s/, '-')) if !orgs[location.country.downcase][location.territory.downcase].has_key?(city) orgs[location.country.downcase][location.territory.downcase][city] = Hash.new orgs[location.country.downcase][location.territory.downcase][city][:latitude] = location.latitude @@ -137,9 +160,9 @@ class OrganizationsController < ApplicationController private # Use callbacks to share common setup or constraints between actions. def set_organization - if params[:slug] != 'json' - @organization = Organization.find_by!(slug: params[:slug] || params[:organization_slug]) - end + if params[:slug] != 'json' + @organization = Organization.find_by!(slug: params[:slug] || params[:organization_slug]) + end end # Only allow a trusted parameter "white list" through. diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8887a46..683d301 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,7 +5,29 @@ module ApplicationHelper @@allTranslations = nil @@no_banner = true @@banner_attribution_details = nil - @@banner_image = nil + @@banner_image = nil + @@has_content = true + @@front_page = false + + def init_vars + @@keyQueue = nil + @@translationsOnThisPage = nil + @@lastTranslation = nil + @@allTranslations = nil + @@no_banner = true + @@banner_attribution_details = nil + @@banner_image = nil + @@has_content = true + @@front_page = false + end + + def this_is_the_front_page + @@front_page = true + end + + def is_this_the_front_page? + return @@front_page + end def ThereAreTranslationsOnThisPage? @@translationsOnThisPage @@ -29,7 +51,7 @@ module ApplicationHelper def banner_attrs(banner_image) if banner_image.length > 0 - @@banner_image = banner_image + @@banner_image = banner_image return {style: 'background-image: url(' + banner_image + ');', class: 'has-image' } end {class: 'no-image'} @@ -38,7 +60,15 @@ module ApplicationHelper def has_banner? !@@no_banner end + + def has_content? + @@has_content + end + def has_no_content + @@has_content = false + end + def banner_title(banner_title) @@no_banner = false content_for(:banner) { ('

' + banner_title.to_s + '

').html_safe } @@ -59,9 +89,9 @@ module ApplicationHelper end end - def dom_ready(&block) - content_for(:dom_ready, &block) - end + def dom_ready(&block) + content_for(:dom_ready, &block) + end def page_style(style) classes = ['page-style-' + style.to_s] diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index 18a8488..a2ad53f 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -15,7 +15,7 @@ class AvatarUploader < CarrierWave::Uploader::Base storage :file process :optimize - @@sizes = {:thumb => [120, 120], :icon => [48, 48]} + @@sizes = {:thumb => [120, 120], :icon => [48, 48], :preview => [360, 120]} # storage :fog # Override the directory where uploaded files will be stored. @@ -48,6 +48,10 @@ class AvatarUploader < CarrierWave::Uploader::Base process :resize_to_fill => @@sizes[:icon] end + version :preview do + process :resize_to_fit => @@sizes[:preview] + 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 @@ -60,4 +64,37 @@ class AvatarUploader < CarrierWave::Uploader::Base # "something.jpg" if original_filename # end + def image + @image ||= MiniMagick::Image.open(file.path) + end + + def is_landscape? + image['width'] > (image['height'] * 1.25) + end + + #def recreate_versions!(*versions) + # if !current_path.nil? + # current_path = "'" + (current_path || '') + "'" + # end + # super(*versions) + #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 diff --git a/app/uploaders/cover_uploader.rb b/app/uploaders/cover_uploader.rb index 3efac9a..1729166 100644 --- a/app/uploaders/cover_uploader.rb +++ b/app/uploaders/cover_uploader.rb @@ -13,4 +13,20 @@ class CoverUploader < CarrierWave::Uploader::Base "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end + version :preview do + process :resize_to_fit => [480, 240] + end + + version :full do + process :resize_to_fit => [1200, 800] + end + + def image + @image ||= MiniMagick::Image.open(file.path) + end + + def is_landscape? + image['width'] > image['height'] + end + end diff --git a/app/uploaders/poster_uploader.rb b/app/uploaders/poster_uploader.rb index 58b861e..518e00d 100644 --- a/app/uploaders/poster_uploader.rb +++ b/app/uploaders/poster_uploader.rb @@ -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 - - # Choose what kind of storage to use for this uploader: - storage :file - # storage :fog - - # 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 + include CarrierWave::ImageOptimizer + include CarrierWave::MiniMagick + + storage :file + process :optimize + + @@sizes = {:thumb => [120, 120], :icon => [48, 48], :preview => [360, 120], :full => [1024, 1024]} + + def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + 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 diff --git a/app/views/conferences/_header.html.haml b/app/views/conferences/_header.html.haml index 7e1f455..ba26c1c 100644 --- a/app/views/conferences/_header.html.haml +++ b/app/views/conferences/_header.html.haml @@ -3,23 +3,25 @@ - content_for :banner do .row - .columns.small-12 + .columns.small-12.banner %figure %img{src: @conference.poster_url} - .row.align-bottom - .columns.medium-6 - %h1='Bike!Bike! '+@conference.start_date.year.to_s - %h2 - - location = @conference.organizations.first.locations.first - = location.city + ', ' + (location.territory || location.country) - %em - = (l @conference.start_date, format: :date) + ' - ' + (l @conference.end_date, format: :date) - %p - = @conference.info - .columns.medium-6.centered - - if @conference.registration_open - %a.button{href: @conference.url(:register)} - =_'conference.Register_Now' - - if params['controller'] != 'conferences' - %a.button.more{href: @conference.url} - =_'conference.More_Info' \ No newline at end of file + .columns.medium-6.align-bottom + %div + %h1='Bike!Bike! '+@conference.start_date.year.to_s + %h2 + - location = @conference.organizations.first.locations.first + = location.city + ', ' + (location.territory || location.country) + %em + = (l @conference.start_date, format: :date) + ' - ' + (l @conference.end_date, format: :date) + - if params['controller'] != 'conferences' + %p= ActionView::Base.full_sanitizer.sanitize(@conference.info).gsub(/^(.{300,350}\.)(.*)$/m, '\1...') + .columns.medium-6.centered.align-bottom + %div + - if @conference.registration_open + %a.button{href: @conference.url(:register)} + =_'conference.Register_Now' + - if params['controller'] != 'conferences' + %a.button.more{href: @conference.url} + =_'conference.More_Info' + = banner_attribution \ No newline at end of file diff --git a/app/views/conferences/_preview.html.haml b/app/views/conferences/_preview.html.haml new file mode 100644 index 0000000..6c0309c --- /dev/null +++ b/app/views/conferences/_preview.html.haml @@ -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 \ No newline at end of file diff --git a/app/views/conferences/index.html.haml b/app/views/conferences/index.html.haml index 969fc7d..9d6fc74 100644 --- a/app/views/conferences/index.html.haml +++ b/app/views/conferences/index.html.haml @@ -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 - - - @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 +- 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| + %li=render 'preview', :conference => conference diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index ba6731b..d8441c6 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -3,56 +3,5 @@ = tabs! -%section - .row - .columns.medium-6 - %h1=@conference.title - %p=@conference.info.gsub(/\s*\n+\s*/, '

').html_safe - .columns.medium-6 - -.row - %p#notice= notice - - %p - %b Conference type: - = @conference.conference_type.title - %p - %b Title: - = @conference.title - %p - %b Slug: - = @conference.slug - %p - %b Start date: - = @conference.start_date - %p - %b End date: - = @conference.end_date - %p - %b Info: - = @conference.info - %p - %b Poster: - = @conference.poster - %p - %b Banner: - = @conference.cover - %p - %b Workshop schedule published: - = @conference.workshop_schedule_published - %p - %b Registration open: - = @conference.registration_open - %p - %b Meals provided: - = @conference.meals_provided - %p - %b Meal info: - = @conference.meal_info - %p - %b Travel info: - = @conference.travel_info - - = link_to 'Edit', @conference.path(:edit) #edit_conference_path(@conference.conference_type.slug, @conference) - \| - = link_to 'Back', 'conferences' +%h2=('About '+@conference.title) +%p=@conference.info \ No newline at end of file diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 4bce85c..ec98671 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -32,16 +32,18 @@ %body{ class: (yield_or_default :page_style) } :javascript var b=document.getElementsByTagName('HTML')[0];b.className+=' '+(window.getComputedStyle(document.body).backgroundBlendMode?'':'no-')+'blend-modes'; - = render 'shared/translation_control' - = render 'shared/navbar' + -#= render 'shared/translation_control' %main + = render 'shared/navbar' - flash.each do |key, msg| = content_tag :div, msg, :id => key - if has_banner? %header#banner{banner_attrs(yield_or_default :banner_image)} = yield :banner - = banner_attribution - = yield + - if has_content? + #content=yield + - else + = yield #footer .container= render 'shared/footer' diff --git a/app/views/organizations/_preview.html.haml b/app/views/organizations/_preview.html.haml new file mode 100644 index 0000000..fe5f3c4 --- /dev/null +++ b/app/views/organizations/_preview.html.haml @@ -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 \ No newline at end of file diff --git a/app/views/organizations/index.html.haml b/app/views/organizations/index.html.haml index e1d3d3a..d8efe2f 100644 --- a/app/views/organizations/index.html.haml +++ b/app/views/organizations/index.html.haml @@ -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 diff --git a/app/views/organizations/show.html.haml b/app/views/organizations/show.html.haml index ce05071..ba6da2e 100644 --- a/app/views/organizations/show.html.haml +++ b/app/views/organizations/show.html.haml @@ -1,13 +1,13 @@ - page_style 'organization' - banner_image @organization.cover_url - content_for :banner do - .row - .columns.medium-6.info + .row{:class => (@organization.avatar.is_landscape? ? 'landscape' : 'portrait')} + .columns{:class => (@organization.avatar.is_landscape? ? nil : ['medium-6', 'medium-push-6'])} + %figure + = image_tag(@organization.avatar.url) + .columns.info{:class => (@organization.avatar.is_landscape? ? nil : ['medium-6', 'medium-pull-6'])} %h1=@organization.name %h2=@organization.locations[0].city + (@organization.locations[0].territory ? ' ' + @organization.locations[0].territory : '') + ', ' + Carmen::Country.coded(@organization.locations[0].country).name - .columns.medium-6 - %figure - = image_tag(@organization.avatar_url) %p#notice= notice @@ -15,4 +15,5 @@ .row .columns + %h2=('About '+@organization.name) =p @organization, :info diff --git a/app/views/pages/home.html.haml b/app/views/pages/home.html.haml index 4b0adeb..baf1fae 100644 --- a/app/views/pages/home.html.haml +++ b/app/views/pages/home.html.haml @@ -1,6 +1,8 @@ - title 'Bike!Bike!' +- has_no_content +- this_is_the_front_page - if @conference - -#= render 'conferences/header' + = render 'conferences/header' -#%section -# .row diff --git a/app/views/pages/translations.html.haml b/app/views/pages/translations.html.haml index 9e50a81..4dd49f2 100644 --- a/app/views/pages/translations.html.haml +++ b/app/views/pages/translations.html.haml @@ -1,3 +1,5 @@ +- page_style :form + .row %h1 = _ 'language_translations', vars: {:language => (_ ('languages.' + @lang))} diff --git a/app/views/shared/_navbar.html.haml b/app/views/shared/_navbar.html.haml index 12695f9..5ba2dbc 100644 --- a/app/views/shared/_navbar.html.haml +++ b/app/views/shared/_navbar.html.haml @@ -1,12 +1,14 @@ %nav#main-nav - = link_to '/resources', :class => ['button', 'logo'] do + = link_to '/', :class => ['button', 'logo'] do = image_tag('logo.png', class: 'logo') = image_tag('logo-text.png', class: 'logo-text') - = link_to (_'Conferences'), {:controller => :conferences}, {:class => ['button', 'conference']} + = link_to (_'Conferences'), :conferences, {:class => ['button', 'conference']} = link_to (_'Organizations'), {:controller => :organizations}, {:class => ['button', 'organization']} = link_to (_'Zine'), 'http://zinezine.bikebike.org', :class => ['button', 'article'] - %p - Bike!Bike! is an international annual gathering organized by and for community bicycle projects. The conference is a space for participants from shops and related advocacy groups to converge in a different city each year over a 4 day period to have workshops and strengthen our social network. + - if is_this_the_front_page? + %p + Bike!Bike! is an international annual gathering organized by and for community bicycle projects. The conference is a space for participants from shops and related advocacy groups to converge in a different city each year over a 4 day period to have workshops and strengthen our social network. + -#%iframe{:src => "//player.vimeo.com/video/76149097", :width => "500", :height => "281", :frameborder => "0", :webkitallowfullscreen => true, :mozallowfullscreen => true, :allowfullscreen => true} -#- if current_user -# %li.has-form.sign-out.hide-for-small -# = link_to (_"Sign_Out"), :logout, method: :post, :class => 'button' diff --git a/config/environments/development.rb b/config/environments/development.rb index 15a75cd..d5ecc8d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -51,6 +51,6 @@ BikeBike::Application.configure do #puts "CARMEN\t" + Carmen.i18n_backend.locale_paths #PerfTools::CpuProfiler.start('/tmp/dev_prof') - #config.serve_static_assets = true + config.serve_static_assets = true #config.assets.precompile = false end diff --git a/config/routes.rb b/config/routes.rb index 6415692..8ff699a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ BikeBike::Application.routes.draw do #resources :workshop_facilitators #resources :registration_form_fields - resources :conference_types, :param => :slug , :path => '/conferences', :as => :conference, :except => :index do + resources :conference_types, :param => :type, :path => '/conferences', :as => :conference, :except => :index do resources :conferences, :param => :slug, :path => '/' do get :hosts get :registration diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake index 89080cd..e16a885 100644 --- a/lib/tasks/migrate.rake +++ b/lib/tasks/migrate.rake @@ -309,9 +309,9 @@ namespace :migrate do if params new_object = model.class.create(params) post_save = (type.singularize + '_post_save') - self.send(post_save, object, new_object) - #begin - #rescue; end + begin + self.send(post_save, object, new_object) + rescue; end end } else