Browse Source

Sidebar content

development
Godwin 11 years ago
parent
commit
cd00ef679e
  1. 4
      app/assets/stylesheets/sass/_base.scss
  2. 96
      app/assets/stylesheets/sass/_layout.scss
  3. 2
      app/helpers/application_helper.rb
  4. 6
      app/views/conferences/show.html.haml
  5. 5
      app/views/layouts/application.html.haml
  6. 2
      app/views/organizations/show.html.haml
  7. 11
      app/views/pages/home.html.haml
  8. 18
      app/views/shared/_navbar.html.haml
  9. 4
      config/assets_cdn.yml
  10. 2
      config/environments/production.rb
  11. 58
      lib/tasks/migrate.rake

4
app/assets/stylesheets/sass/_base.scss

@ -279,6 +279,10 @@ ul.tags,
@include breakpoint(medium) { @include breakpoint(medium) {
margin-left: 3em; margin-left: 3em;
aside & {
margin-left: 0;
}
} }
} }

96
app/assets/stylesheets/sass/_layout.scss

@ -168,12 +168,11 @@ body {
display: block; display: block;
position: static; position: static;
height: auto; height: auto;
min-height: 100%; min-height: 0;
float: left; float: left;
width: 25%; width: 25%;
padding: 2.5%; padding: 2.5%;
font-size: 1em; font-size: 1em;
min-height: 100vh;
.has-banner-image & { .has-banner-image & {
background-image: none; background-image: none;
@ -210,13 +209,51 @@ body {
} }
} }
#side-bar {
padding: 2.5%;
.preview-list {
li {
margin: auto;
float: none;
}
}
h5 {
text-align: center;
}
@include breakpoint(medium) {
+ #content {
padding-top: 0;
}
}
@include breakpoint(large) {
float: left;
clear: left;
width: 25%;
font-size: 1vw;
h5 {
text-align: left;
font-size: 1.25em;
}
+ #content {
padding-top: 4em;
}
}
}
main { main {
min-height: 100%; min-height: 100%;
//overflow: auto; //overflow: auto;
background-color: $white; background-color: $white;
@include breakpoint(medium) { @include breakpoint(large) {
//background-color: $black; overflow: auto;
} }
} }
@ -239,6 +276,7 @@ main {
@include breakpoint(medium) { @include breakpoint(medium) {
padding: 4em; padding: 4em;
clear: right;
.organizations-show & { .organizations-show & {
min-height: 25em; min-height: 25em;
@ -253,7 +291,7 @@ main {
background-position: center 66.6667%; background-position: center 66.6667%;
//padding-top: 4em; //padding-top: 4em;
color: $white; color: $white;
overflow: hidden; overflow: visible;
background-color: $black; background-color: $black;
h1, h2 { h1, h2 {
@ -265,9 +303,9 @@ main {
z-index: 2; z-index: 2;
position: relative; position: relative;
.align-bottom { //.align-bottom {
height: 50%; // height: 50%;
} //}
} }
.align-bottom > div { .align-bottom > div {
@ -360,7 +398,7 @@ main {
.conferences-show & { .conferences-show & {
.columns.banner { .columns.banner {
height: 75%; //height: 75%;
padding-bottom: 1em; padding-bottom: 1em;
figure { figure {
@ -392,8 +430,6 @@ main {
.page-style-article & { .page-style-article & {
min-height: 30em; min-height: 30em;
height: 50%;
height: 50vh;
.row { .row {
height: 100%; height: 100%;
@ -442,6 +478,8 @@ main {
@include breakpoint(large) { @include breakpoint(large) {
border-bottom-left-radius: 2.5em; border-bottom-left-radius: 2.5em;
padding-top: 2em; padding-top: 2em;
width: 75%;
float: right;
.has-banner-image & { .has-banner-image & {
padding-top: 0; padding-top: 0;
@ -464,6 +502,21 @@ main {
margin-top: 6vw; margin-top: 6vw;
} }
} }
.page-style-article & {
height: 50%;
height: 50vh;
}
.conferences-show & {
.columns.banner {
height: 75%;
}
}
.row .align-bottom {
height: 50%;
}
} }
} }
@ -510,15 +563,19 @@ main {
.photo-attribution { .photo-attribution {
position: absolute; position: absolute;
top: 100%;
right: 0.25em; right: 0.25em;
margin: 0.25em 0.25em 0 0;
font-size: 0.8em; font-size: 0.8em;
text-align: right; text-align: right;
margin: 0.25em 0.25em 0 0; text-shadow: none;
@include opacity(0.5); @include opacity(0.5);
clear: right;
z-index: 2; z-index: 2;
> span { > span {
display: none; display: none;
color: $black;
} }
&:hover { &:hover {
@ -530,8 +587,19 @@ main {
} }
.no-content & { .no-content & {
a, a:visited { top: auto;
color: $white; bottom: 0.25em;
color: $white;
@include opacity(0.25);
&:hover {
@include opacity(0.5);
}
a,
a:visited,
span {
color: inherit;
} }
} }
} }

2
app/helpers/application_helper.rb

@ -448,7 +448,7 @@ module ApplicationHelper
url = "http://maps.googleapis.com/maps/api/staticmap?center=#{location}&zoom=#{zoom}&size=#{width}x#{height}&maptype=roadmap&markers=size:small%7C#{location}&key=AIzaSyAH7U8xUUb8IwDPy1wWuYGprzxf4E1Jj4o" url = "http://maps.googleapis.com/maps/api/staticmap?center=#{location}&zoom=#{zoom}&size=#{width}x#{height}&maptype=roadmap&markers=size:small%7C#{location}&key=AIzaSyAH7U8xUUb8IwDPy1wWuYGprzxf4E1Jj4o"
require 'open-uri' require 'open-uri'
open(file, 'wb') do |f| open(file, 'wb') do |f|
f << open(url).read f << open(url).read
end end
end end

6
app/views/conferences/show.html.haml

@ -7,3 +7,9 @@
.columns.large-10 .columns.large-10
%h2=('About '+@conference.title) %h2=('About '+@conference.title)
%p=@conference.info.html_safe %p=@conference.info.html_safe
- content_for :side_bar do
%h5= @conference.title+' is hosted by:'
%ul.preview-list.org-list.small-block-grid-2.large-block-grid-1
- @conference.organizations.each do |organization|
%li=render 'organizations/preview', :organization => organization

5
app/views/layouts/application.html.haml

@ -41,7 +41,10 @@
- if has_banner? - if has_banner?
%header#banner{banner_attrs(yield_or_default :banner_image)} %header#banner{banner_attrs(yield_or_default :banner_image)}
= yield :banner = yield :banner
= banner_attribution = banner_attribution
- if content_for?(:side_bar)
%aside#side-bar
= yield :side_bar
- if has_content? - if has_content?
#content=yield #content=yield
- else - else

2
app/views/organizations/show.html.haml

@ -1,4 +1,4 @@
- banner_image @organization.cover_url - banner_image @organization.cover_url, id: @organization.cover_attribution_id, name: @organization.cover_attribution_name, user_id: @organization.cover_attribution_user_id, src: @organization.cover_attribution_src
- page_style 'article' - page_style 'article'
- content_for :banner do - content_for :banner do
.row{:class => (@organization.avatar.is_landscape? ? 'landscape' : 'portrait')} .row{:class => (@organization.avatar.is_landscape? ? 'landscape' : 'portrait')}

11
app/views/pages/home.html.haml

@ -4,11 +4,6 @@
- if @conference - if @conference
= render 'conferences/header' = render 'conferences/header'
-#%section - content_for :side_bar do
-# .row %p
-# .columns.medium-6 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.
-# %h1
-# Welcome to Bike!Bike!
-# %p
-# = _ 'home.its_awesome', 'paragraph'
-# .columns.medium-6

18
app/views/shared/_navbar.html.haml

@ -8,21 +8,3 @@
= link_to (_'Conferences'), :conferences, {:class => ['button', 'conference']} = link_to (_'Conferences'), :conferences, {:class => ['button', 'conference']}
= link_to (_'Organizations'), {:controller => :organizations}, {:class => ['button', 'organization']} = link_to (_'Organizations'), {:controller => :organizations}, {:class => ['button', 'organization']}
= link_to (_'Zine'), 'http://zinezine.bikebike.org', :class => ['button', 'article'] = link_to (_'Zine'), 'http://zinezine.bikebike.org', :class => ['button', 'article']
- 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'
-# %li.user-profile.has-dropdown
-# = link_to current_user do
-# = image_tag(current_user.avatar_url(:icon))
-# %span
-# %span.show-for-small=current_user.username
-# %ul.dropdown
-# %li= link_to 'View Profile', current_user
-# %li= link_to 'Edit Profile', edit_user_path(current_user.id)
-#- else
-# %li.has-form.sign-in
-# = link_to (_"Sign_In"), :login, :class => 'button'

4
config/assets_cdn.yml

@ -5,5 +5,5 @@ development:
production: production:
enabled: true enabled: true
host: cdn.bikebike.org host: cdn.bikebike.org
protocol: https protocol: http
fallback_protocol: http fallback_protocol: https

2
config/environments/production.rb

@ -66,7 +66,7 @@ BikeBike::Application.configure do
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js ) # config.assets.precompile += %w( search.js )
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
config.action_controller.asset_host = "https://cdn.bikebike.org" config.action_controller.asset_host = "http://cdn.bikebike.org"
# Ignore bad email addresses and do not raise email delivery errors. # Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors.

58
lib/tasks/migrate.rake

@ -8,6 +8,18 @@ $panoramios = Hash.new
namespace :migrate do namespace :migrate do
desc "Migrates data from live site to current database" desc "Migrates data from live site to current database"
task test: :environment do
#url = 'http://www.panoramio.com/map/get_panoramas.php?set=public&from=0&to=20&minx=-180&miny=-90&maxx=180&maxy=90&size=medium&mapfilter=true'
#response = RestClient.get url
result = Geocoder.search('Calgary Alberta, Canada').first
#begin
points = Geocoder::Calculations.bounding_box([result.latitude, result.longitude], 5, { :unit => :km })
options = {:set => :public, :size => :original, :from => 0, :to => 20, :mapfilter => false, :miny => points[0], :minx => points[1], :maxy => points[2], :maxx => points[3]}
url = 'http://www.panoramio.com/map/get_panoramas.php?' + options.to_query
response = JSON.parse(open(url).read)
puts response['photos']
end
task all: :environment do task all: :environment do
migrate! User.new migrate! User.new
migrate! Location.new migrate! Location.new
@ -258,29 +270,31 @@ namespace :migrate do
$panoramios[location] ||= 0 $panoramios[location] ||= 0
$panoramios[location] += 1 $panoramios[location] += 1
result = Geocoder.search(location).first result = Geocoder.search(location).first
begin #begin
if result if result
points = Geocoder::Calculations.bounding_box([result.latitude, result.longitude], 5, { :unit => :km }) points = Geocoder::Calculations.bounding_box([result.latitude, result.longitude], 5, { :unit => :km })
response = RestClient.get 'http://www.panoramio.com/map/get_panoramas.php', :params => {:set => :public, :size => :original, :from => 0, :to => 20, :mapfilter => false, :miny => points[0], :minx => points[1], :maxy => points[2], :maxx => points[3]} options = {:set => :public, :size => :original, :from => 0, :to => 20, :mapfilter => false, :miny => points[0], :minx => points[1], :maxy => points[2], :maxx => points[3]}
if response.code == 200 url = 'http://www.panoramio.com/map/get_panoramas.php?' + options.to_query
i = 0 response = JSON.parse(open(url).read)
JSON.parse(response.to_str)['photos'].each { |img| #if response.code == 200
if img['width'].to_i > 980 i = 0
i += 1 response['photos'].each { |img|
if i >= $panoramios[location] if img['width'].to_i > 980
params["remote_#{column.to_s}_url".to_sym] = img['photo_file_url'] i += 1
params[column.to_sym] = img['photo_file_url'].gsub(/^.*\/(.*)$/, '\1') if i >= $panoramios[location]
params[:cover_attribution_id] = img['photo_id'] params["remote_#{column.to_s}_url".to_sym] = img['photo_file_url']
params[:cover_attribution_user_id] = img['owner_id'] params[column.to_sym] = img['photo_file_url'].gsub(/^.*\/(.*)$/, '\1')
params[:cover_attribution_name] = img['owner_name'] params[:cover_attribution_id] = img['photo_id']
params[:cover_attribution_src] = 'panoramio' params[:cover_attribution_user_id] = img['owner_id']
return params params[:cover_attribution_name] = img['owner_name']
end params[:cover_attribution_src] = 'panoramio'
end return params
} end
end end
end }
rescue; end #end
end
#rescue; end
return params return params
end end

Loading…
Cancel
Save