Created a CDN

This commit is contained in:
Godwin
2014-07-12 15:29:19 -06:00
parent 867dbec2bb
commit 466e7fccc5
89 changed files with 55 additions and 121 deletions
+17
View File
@@ -439,6 +439,23 @@ module ApplicationHelper
('<svg' + hash_to_html_attributes(attributes) + '><use xlink:href="/assets/icons.svg#bb-icon-' + id + '"></use></svg>').html_safe
end
def static_map(location, zoom, width, height)
require 'fileutils'
local_file_name = "#{location}-#{width}x#{height}z#{zoom}.png"
file = File.join("public", "maps/#{local_file_name}")
FileUtils.mkdir_p("public/maps") unless File.directory?("public/maps")
if !File.exist?(file)
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
end
#FileUtils.cp url, file
end
"maps/#{local_file_name}"
end
private
def _form_field(type, name, value, options)
if type == 'check_box'
-1
View File
@@ -26,7 +26,6 @@
\==================================================
/ Placed at the top of the document 'cause of turbolinks
=# javascript_include_tag '//use.typekit.net/iqv7hcg.js'
= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'
=# javascript_include_tag 'application'
=# javascript_include_tag 'nested_form'
+1 -2
View File
@@ -13,9 +13,8 @@
%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=AIzaSyAH7U8xUUb8IwDPy1wWuYGprzxf4E1Jj4o');"}
%figure{:style => "background-image: url('" + static_map(CGI::escape(city+' '+country), 4, 600, 300) + "');"}
%h4=city
- organizations.each do |organization|
%li=render 'preview', :organization => organization
+1
View File
@@ -7,6 +7,7 @@
%a{href: '/conferences/'}='Zine'
.columns.medium-3.large-3.text-right
&copy;2014 Bike!Bike!
= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'
:javascript
#{yield :scripts}
$(function(){