Starting on on the map

This commit is contained in:
Will Marshall
2014-06-05 12:18:26 +10:00
parent 634af96a66
commit 82ab14a33e
16 changed files with 5049 additions and 2 deletions

View File

@@ -7,6 +7,8 @@
#= require angular-cookies
#= require angular-sanitize
#= require angular-resource
#= require lodash.underscore.js
#= require angular-google-maps.min.js
#= require ../shared/mm-foundation-tpls-0.2.0-SNAPSHOT
#= require ../shared/bindonce.min.js
#= require ../shared/ng-infinite-scroll.min.js

View File

@@ -0,0 +1,7 @@
Darkswarm.controller "MapCtrl", ($scope, MapConfiguration)->
$scope.map =
center:
latitude: 45
longitude: -73
zoom: 8
styles: MapConfiguration.options

View File

@@ -6,6 +6,7 @@ window.Darkswarm = angular.module("Darkswarm", ["ngResource",
'angular-flash.service',
'templates',
'ngSanitize',
'google-maps',
'backstretch']).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers.put['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')

View File

@@ -0,0 +1,5 @@
Darkswarm.factory "MapConfiguration", ->
new class MapConfiguration
# From http://snazzymaps.com/style/15/subtle-grayscale
options: [{"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]},{"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]},{"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]},{"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]},{"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"administrative.province","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]}]

View File

@@ -0,0 +1,5 @@
// Place all the styles related to the map controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.angular-google-map-container
height: 600px

View File

@@ -0,0 +1,6 @@
class MapController < BaseController
layout 'darkswarm'
def index
@enterprises = Enterprise.visible
end
end

View File

@@ -0,0 +1,2 @@
module MapHelper
end

View File

@@ -8,9 +8,11 @@
= favicon_link_tag "favicon.png"
%link{href: "http://fonts.googleapis.com/css?family=Open+Sans:400,700", rel: "stylesheet", type: "text/css"}/
= yield :scripts
= stylesheet_link_tag "darkswarm/all"
= javascript_include_tag "darkswarm/all"
= render "layouts/bugherd_script"
= csrf_meta_tags
@@ -30,4 +32,3 @@
= yield
#footer
= yield :scripts

View File

@@ -0,0 +1,5 @@
- content_for :scripts do
%script{src: "//maps.googleapis.com/maps/api/js?sensor=false"}
%map{"ng-controller" => "MapCtrl"}
%google-map{center: "map.center", zoom: "map.zoom", styles: "map.styles"}

View File

@@ -13,7 +13,7 @@
%span.nav-primary Hubs
%li.divider
%li
%a{href: ""}
%a{href: map_path}
%span.nav-primary Map
%li.divider
%li

View File

@@ -36,6 +36,7 @@ ComfortableMexicanSofa.configure do |config|
# filesystem see: http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/Filesystem
config.upload_file_options = {
:storage => 's3',
:s3_protocol => :https,
:s3_credentials => {
:bucket => Spree::Config[:s3_bucket],
:access_key_id => Spree::Config[:s3_access_key],

View File

@@ -3,6 +3,8 @@ Openfoodnetwork::Application.routes.draw do
get "/#/login", to: "home#index", as: :spree_login
get "/map", to: "map#index", as: :map
resource :shop, controller: "shop" do
get :products
post :order_cycle

View File

@@ -0,0 +1,8 @@
require 'spec_helper'
describe MapController do
it "loads all visible enterprises" do
Enterprise.should_receive(:visible)
get :index
end
end

View File

@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the MapHelper. For example:
#
# describe MapHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe MapHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff