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) {
margin-left: 3em;
aside & {
margin-left: 0;
}
}
}

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

@ -168,12 +168,11 @@ body {
display: block;
position: static;
height: auto;
min-height: 100%;
min-height: 0;
float: left;
width: 25%;
padding: 2.5%;
font-size: 1em;
min-height: 100vh;
.has-banner-image & {
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 {
min-height: 100%;
//overflow: auto;
background-color: $white;
@include breakpoint(medium) {
//background-color: $black;
@include breakpoint(large) {
overflow: auto;
}
}
@ -239,6 +276,7 @@ main {
@include breakpoint(medium) {
padding: 4em;
clear: right;
.organizations-show & {
min-height: 25em;
@ -253,7 +291,7 @@ main {
background-position: center 66.6667%;
//padding-top: 4em;
color: $white;
overflow: hidden;
overflow: visible;
background-color: $black;
h1, h2 {
@ -265,9 +303,9 @@ main {
z-index: 2;
position: relative;
.align-bottom {
height: 50%;
}
//.align-bottom {
// height: 50%;
//}
}
.align-bottom > div {
@ -360,7 +398,7 @@ main {
.conferences-show & {
.columns.banner {
height: 75%;
//height: 75%;
padding-bottom: 1em;
figure {
@ -392,8 +430,6 @@ main {
.page-style-article & {
min-height: 30em;
height: 50%;
height: 50vh;
.row {
height: 100%;
@ -442,6 +478,8 @@ main {
@include breakpoint(large) {
border-bottom-left-radius: 2.5em;
padding-top: 2em;
width: 75%;
float: right;
.has-banner-image & {
padding-top: 0;
@ -464,6 +502,21 @@ main {
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 {
position: absolute;
top: 100%;
right: 0.25em;
margin: 0.25em 0.25em 0 0;
font-size: 0.8em;
text-align: right;
margin: 0.25em 0.25em 0 0;
text-shadow: none;
@include opacity(0.5);
clear: right;
z-index: 2;
> span {
display: none;
color: $black;
}
&:hover {
@ -530,8 +587,19 @@ main {
}
.no-content & {
a, a:visited {
color: $white;
top: auto;
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"
require 'open-uri'
open(file, 'wb') do |f|
f << open(url).read
f << open(url).read
end
end

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

@ -7,3 +7,9 @@
.columns.large-10
%h2=('About '+@conference.title)
%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?
%header#banner{banner_attrs(yield_or_default :banner_image)}
= yield :banner
= banner_attribution
= banner_attribution
- if content_for?(:side_bar)
%aside#side-bar
= yield :side_bar
- if has_content?
#content=yield
- 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'
- content_for :banner do
.row{:class => (@organization.avatar.is_landscape? ? 'landscape' : 'portrait')}

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

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

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

@ -8,21 +8,3 @@
= 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']
- 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:
enabled: true
host: cdn.bikebike.org
protocol: https
fallback_protocol: http
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.
# config.assets.precompile += %w( search.js )
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.
# 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
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
migrate! User.new
migrate! Location.new
@ -258,29 +270,31 @@ namespace :migrate do
$panoramios[location] ||= 0
$panoramios[location] += 1
result = Geocoder.search(location).first
begin
if result
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]}
if response.code == 200
i = 0
JSON.parse(response.to_str)['photos'].each { |img|
if img['width'].to_i > 980
i += 1
if i >= $panoramios[location]
params["remote_#{column.to_s}_url".to_sym] = img['photo_file_url']
params[column.to_sym] = img['photo_file_url'].gsub(/^.*\/(.*)$/, '\1')
params[:cover_attribution_id] = img['photo_id']
params[:cover_attribution_user_id] = img['owner_id']
params[:cover_attribution_name] = img['owner_name']
params[:cover_attribution_src] = 'panoramio'
return params
end
end
}
#begin
if result
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)
#if response.code == 200
i = 0
response['photos'].each { |img|
if img['width'].to_i > 980
i += 1
if i >= $panoramios[location]
params["remote_#{column.to_s}_url".to_sym] = img['photo_file_url']
params[column.to_sym] = img['photo_file_url'].gsub(/^.*\/(.*)$/, '\1')
params[:cover_attribution_id] = img['photo_id']
params[:cover_attribution_user_id] = img['owner_id']
params[:cover_attribution_name] = img['owner_name']
params[:cover_attribution_src] = 'panoramio'
return params
end
end
end
rescue; end
}
#end
end
#rescue; end
return params
end

Loading…
Cancel
Save