diff --git a/Gemfile b/Gemfile index dc72462..78cf550 100644 --- a/Gemfile +++ b/Gemfile @@ -29,6 +29,7 @@ gem 'paper_trail' gem 'font-awesome-rails' gem 'wysiwyg-rails' gem 'rails-assets-cdn' +gem 'sitemap_generator' group :development, :test do gem 'rspec' diff --git a/Gemfile.lock b/Gemfile.lock index 0cb5984..5daa25c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -279,6 +279,8 @@ GEM multi_json simplecov-html (~> 0.8.0) simplecov-html (0.8.0) + sitemap_generator (5.0.4) + builder slop (3.5.0) sorcery (0.8.6) bcrypt (~> 3.1) @@ -366,6 +368,7 @@ DEPENDENCIES sass-rails (~> 4.0.0) selenium-webdriver simplecov + sitemap_generator sorcery (>= 0.8.1) uglifier (>= 1.3.0) wdm (>= 0.1.0) diff --git a/app/assets/stylesheets/sass/_layout.scss b/app/assets/stylesheets/sass/_layout.scss index c9061b6..50182b7 100644 --- a/app/assets/stylesheets/sass/_layout.scss +++ b/app/assets/stylesheets/sass/_layout.scss @@ -5,11 +5,12 @@ */ html { - background-color: $white + background-color: $primary-color; } body { height: auto; + background-color: $white } #main-nav { diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 1e2a6eb..a690b24 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -187,9 +187,6 @@ class ConferencesController < ApplicationController if current_user @host_privledge = :admin end - #if !@conference - # raise ActionController::RoutingError.new('Not Found') - #end end def set_conference_registration diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 5ceb237..83a6c9e 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,13 +1,16 @@ include ApplicationHelper class PagesController < ApplicationController - #skip_before_filter :verify_authenticity_token, only: [:translate] + #skip_before_filter :verify_authenticity_token, only: [:translate] def home - @conferences = Conference.all + @conferences = Conference.all @conference = Conference.find(:first, :order => "start_date DESC") end + def resources + end + def translate key = params[:translationkey] value = params[:translationvalue] @@ -51,12 +54,18 @@ class PagesController < ApplicationController end def translations + if !current_user + raise ActiveRecord::PremissionDenied + end @lang = params[:lang] @translations = I18n.backend.get_translation_info I18n.config.enforce_available_locales = false end def translation_list + if !current_user + raise ActiveRecord::PremissionDenied + end total = 0 complete = 0 @completeness = Hash.new @@ -78,6 +87,11 @@ class PagesController < ApplicationController } end + def robots + robot = is_production? && !is_test_server? ? 'live' : 'dev' + render :text => File.read("config/robots-#{robot}.txt"), :content_type => 'text/plain' + end + private def store_translations(locale, data, options = {}) escape = options.fetch(:escape, true) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 08fd0f8..e0beb14 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,6 +41,10 @@ module ApplicationHelper content_for(:title) { page_title.to_s } end + def description(page_description) + content_for(:description) { page_description.to_s } + end + def banner_image(banner_image, name: nil, id: nil, user_id: nil, src: nil) @@no_banner = false @@banner_image = banner_image @@ -459,6 +463,18 @@ module ApplicationHelper (Rails.application.config.action_controller.asset_host || '') + file end + def is_production? + Rails.env == 'production' + end + + def subdomain + request.env['SERVER_NAME'].gsub(/^(\w+)\..*$/, '\1') + end + + def is_test_server? + subdomain == 'test' + end + private def _form_field(type, name, value, options) if type == 'check_box' diff --git a/app/views/conferences/index.html.haml b/app/views/conferences/index.html.haml index 1f71861..589f737 100644 --- a/app/views/conferences/index.html.haml +++ b/app/views/conferences/index.html.haml @@ -1,4 +1,5 @@ -- title _'page.Conferences' +- page_name = 'All '+(@conference_type ? @conference_type.title+' ' : '')+' Conferences' +- title page_name - banner_image '/assets/conference.jpg' - page_style :list - content_for :banner do @@ -6,7 +7,7 @@ .columns %h1=_'page.Conferences' -%h2='All '+(@conference_type ? @conference_type.title+' ' : '')+' Conferences' +%h2=page_name %ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3.conference-list.preview-list - @conferences.each do |conference| diff --git a/app/views/conferences/permission_denied.html.haml b/app/views/conferences/permission_denied.html.haml index b4838c9..540a329 100644 --- a/app/views/conferences/permission_denied.html.haml +++ b/app/views/conferences/permission_denied.html.haml @@ -1,8 +1,13 @@ -- title 'Bike!Bike!' +- title @conference.title = render 'header' -.row - %h1 - =_'error.title.Permission_Denied' - %p - =_'error.desc.permission_denied', :p \ No newline at end of file +%article.row + .columns.large-10 + %h1=_'error.title.Permission_Denied' + %p=_'error.desc.permission_denied', :p + +- 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 \ No newline at end of file diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 16799aa..84df7ac 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -1,4 +1,8 @@ -- title 'Bike!Bike!' +- location = @conference.organizations.first.locations.first +- location_name = location.city + ', ' + (location.territory ? Carmen::Country.coded(location.country).subregions.coded(location.territory).name : location.country) + +- title @conference.title +- description "#{@conference.title} conference in #{location_name} for DIY bicycle collectives, co-ops, and advocacy groups" = render 'header' = tabs! diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index d3463fd..716bbd5 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -3,17 +3,15 @@ %head %meta{ charset: 'utf-8' } %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0' } - %title= yield_or_default :title, controller.action_name.titlecase - %meta{ name: 'description', content: (yield_or_default :description, 'Bike!Bike! is an international annual gathering organized by and for community bicycle projects') } + %title= (yield :title) + (content_for?(:title) ? ' | ' : '') + 'Bike!Bike!' + %meta{ name: 'description', content: (yield_or_default :description, 'Bike!Bike! conferences for DIY bicycle collectives, co-ops, and advocacy groups') } = csrf_meta_tags = yield :head - / Le HTML5 shim, for IE6-8 support of HTML elements /[if lt IE 9] = stylesheet_link_tag '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic', 'application', media: 'all' - / Touch icons %link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' } %link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/x-icon' } %link{ href: asset_path('apple-touch-icon.png'), rel: 'apple-touch-icon' } @@ -21,10 +19,6 @@ %link{ href: asset_path('apple-touch-icon-114x114.png'), rel: 'apple-touch-icon', sizes: '114x114' } %link{ href: asset_path('apple-touch-icon-144x144.png'), rel: 'apple-touch-icon', sizes: '144x144' } - / - Le javascript - \================================================== - / Placed at the top of the document 'cause of turbolinks =# javascript_include_tag '//use.typekit.net/iqv7hcg.js' =# javascript_include_tag 'application' =# javascript_include_tag 'nested_form' diff --git a/app/views/organizations/index.html.haml b/app/views/organizations/index.html.haml index 65f81c9..8032b8b 100644 --- a/app/views/organizations/index.html.haml +++ b/app/views/organizations/index.html.haml @@ -1,4 +1,5 @@ - title _'page.Organizations' +- description 'Bike!Bike! list of DIY bicycle collectives, co-ops, coops, community bike projects, advocacy by country, state, provice, and city' - banner_image '/assets/orgs.jpg' - page_style :list - content_for :banner do diff --git a/app/views/organizations/show.html.haml b/app/views/organizations/show.html.haml index e58e738..da0f4fc 100644 --- a/app/views/organizations/show.html.haml +++ b/app/views/organizations/show.html.haml @@ -1,3 +1,8 @@ +- territory = Carmen::Country.coded(@organization.locations[0].country).subregions.coded(@organization.locations[0].territory) +- location_name = @organization.locations[0].city + (territory ? ' ' + territory.name : '') + ', ' + Carmen::Country.coded(@organization.locations[0].country).name + +- title @organization.name + ' (' + location_name + ')' +- description "#{@organization.name} is a bicycle collective, co-op, community bike project, or advocacy group in #{location_name}" - 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 @@ -8,7 +13,7 @@ .columns.info{:class => (@organization.avatar.is_landscape? ? nil : ['medium-6', 'medium-pull-6'])} %h1=@organization.name - territory = Carmen::Country.coded(@organization.locations[0].country).subregions.coded(@organization.locations[0].territory) - %h2=@organization.locations[0].city + (territory ? ' ' + territory.name : '') + ', ' + Carmen::Country.coded(@organization.locations[0].country).name + %h2=location_name %p#notice= notice diff --git a/app/views/pages/home.html.haml b/app/views/pages/home.html.haml index a394d0a..03b95a7 100644 --- a/app/views/pages/home.html.haml +++ b/app/views/pages/home.html.haml @@ -1,4 +1,3 @@ -- title 'Bike!Bike!' - has_no_content - this_is_the_front_page - if @conference diff --git a/app/views/pages/permission_denied.html.haml b/app/views/pages/permission_denied.html.haml new file mode 100644 index 0000000..ad367c9 --- /dev/null +++ b/app/views/pages/permission_denied.html.haml @@ -0,0 +1,9 @@ +- page_title = _'error.title.Permission_Denied' +- title page_title +- banner_title page_title + +.row + %h1 + ='This page is inaccessible to you' + %p + =_'error.desc.permission_denied', :p \ No newline at end of file diff --git a/app/views/pages/resources.html.haml b/app/views/pages/resources.html.haml new file mode 100644 index 0000000..c75c300 --- /dev/null +++ b/app/views/pages/resources.html.haml @@ -0,0 +1,25 @@ +- page_title = 'Bike!Bike! Reources' +- title page_title +- banner_title page_title +- description 'Bike!Bike! list of resources - Bike Collective Wiki, ThinkTank, Bike!Bike! photos and documents' + +.row + .columns + %p + Here is a list of online resources available to commmunity bike projects. The bike collective wiki in particlular has great start up kits and many helpful articles about how community bike shops operate.  The think tank is a list serve with over 600 contributors. When you join the list, you can talk to community bike shops from all over the world about how to better organize and operate a shop. + %ul + %li + %a{href: 'http://www.bikecollectives.org/wiki/index.php?title=Main_Page', target: '_blank'} + Bike Collective Wiki + %li + %a{href: 'http://lists.bikecollectives.org/listinfo.cgi/thethinktank-bikecollectives.org', target: '_blank'} + Think tank sign up + %li + %a{href: 'http://www.flickr.com/photos/93412361@N07/with/8494632542/', target: '_blank'} + flickr bikebike! + %li + %a{href: 'https://www.dropbox.com/sh/4phyl9lft18whzi/SXQ6XUklKB', target: '_blank'} + Drop box for bikebike2012 (shared public box) + + %p + If you have more resources you think should be listed here, please post them to the issue tracker for the bikebike! website. \ No newline at end of file diff --git a/app/views/pages/translation_list.html.haml b/app/views/pages/translation_list.html.haml index cc879a6..7383245 100644 --- a/app/views/pages/translation_list.html.haml +++ b/app/views/pages/translation_list.html.haml @@ -1,4 +1,6 @@ -- banner_title 'Translations' +- page_title = 'Translations' +- title page_title +- banner_title page_title .row %h1 diff --git a/app/views/pages/translations.html.haml b/app/views/pages/translations.html.haml index 87e8e63..3d2eed0 100644 --- a/app/views/pages/translations.html.haml +++ b/app/views/pages/translations.html.haml @@ -1,4 +1,6 @@ -- banner_title (_ 'language_translations', vars: {:language => (_ ('languages.' + @lang))}) +- page_title = (_ 'language_translations', vars: {:language => (_ ('languages.' + @lang))}) +- title page_title +- banner_title page_title - page_style :form .row diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index 15cc8e6..f4b00eb 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -4,7 +4,7 @@ %i %a{href: '/conferences/'}='Organizations' %i - %a{href: '/conferences/'}='Zine' + %a{href: '/resources/'}='Resources' .columns.medium-3.large-3.text-right ©2014 Bike!Bike! diff --git a/app/views/shared/_navbar.html.haml b/app/views/shared/_navbar.html.haml index 32e1c30..dc634f4 100644 --- a/app/views/shared/_navbar.html.haml +++ b/app/views/shared/_navbar.html.haml @@ -7,4 +7,4 @@ .buttons = 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'] + = link_to (_'Resources'), '/resources/', :class => ['button', 'article'] diff --git a/config/Xsitemap.rb b/config/Xsitemap.rb new file mode 100644 index 0000000..4dcd08a --- /dev/null +++ b/config/Xsitemap.rb @@ -0,0 +1,21 @@ +SitemapGenerator::Sitemap.default_host = "http://hackingoff.com" + +SitemapGenerator::Sitemap.create do + routes = Rails.application.routes.routes.map do |route| + {alias: route.name, path: route.path.spec.to_s, controller: route.defaults[:controller], action: route.defaults[:action]} + end + + # Set a list of controllers you don't want to generate routes for. + # /rails/info in particular maps to something inaccessible. + # redirects have a nil controller. This prevents duplicate content penalties. + banned_controllers = ["rails/info", nil] + routes.reject! {|route| banned_controllers.include?(route[:controller])} + + # sitemap_generator includes root by default; prevent duplication + routes.reject! {|route| route[:path] == '/'} + + routes.each {|route| add route[:path][0..-11]} # Strips off '(.:format) + + # Notice the below if you're hosting Jekyll/Octopress in a subdirectory + # or otherwise want to index content outside of Rails' routes. + # add_to_index '/path/sitemap.xml' \ No newline at end of file diff --git a/config/robots-dev.txt b/config/robots-dev.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/config/robots-dev.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/config/robots-live.txt b/config/robots-live.txt new file mode 100644 index 0000000..e71a311 --- /dev/null +++ b/config/robots-live.txt @@ -0,0 +1,3 @@ +User-agent: * +Disallow: /translations/ +Disallow: /login/ diff --git a/config/routes.rb b/config/routes.rb index 8ff699a..8381a68 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -60,6 +60,9 @@ BikeBike::Application.routes.draw do get "oauth/callback" => "oauths#callback" get "oauth/:provider" => "oauths#oauth", :as => :auth_at_provider + get 'robots.txt' => 'pages#robots' + get 'resources' => 'pages#resources' + root 'pages#home' end diff --git a/config/sitemap.rb b/config/sitemap.rb new file mode 100644 index 0000000..fb2beb1 --- /dev/null +++ b/config/sitemap.rb @@ -0,0 +1,27 @@ +# Set the host name for URL creation +SitemapGenerator::Sitemap.default_host = "http://bikebike.org" + +SitemapGenerator::Sitemap.create do + # Put links creation logic here. + # + # The root path '/' and sitemap index file are added automatically for you. + # Links are added to the Sitemap in the order they are specified. + # + # Usage: add(path, options={}) + # (default options are used if you don't specify) + # + # Defaults: :priority => 0.5, :changefreq => 'weekly', + # :lastmod => Time.now, :host => default_host + # + # Examples: + # + # Add '/articles' + # + # add articles_path, :priority => 0.7, :changefreq => 'daily' + # + # Add all articles: + # + # Article.find_each do |article| + # add article_path(article), :lastmod => article.updated_at + # end +end diff --git a/public/robots.txt b/public/Xrobots.txt similarity index 100% rename from public/robots.txt rename to public/Xrobots.txt diff --git a/public/maps/Thumbs.db b/public/maps/Thumbs.db new file mode 100644 index 0000000..f45eec3 Binary files /dev/null and b/public/maps/Thumbs.db differ diff --git a/public/sitemap.xml.gz b/public/sitemap.xml.gz new file mode 100644 index 0000000..23da411 Binary files /dev/null and b/public/sitemap.xml.gz differ