mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Starting on on the map
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Darkswarm.controller "MapCtrl", ($scope, MapConfiguration)->
|
||||
$scope.map =
|
||||
center:
|
||||
latitude: 45
|
||||
longitude: -73
|
||||
zoom: 8
|
||||
styles: MapConfiguration.options
|
||||
@@ -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')
|
||||
|
||||
@@ -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}]}]
|
||||
|
||||
5
app/assets/stylesheets/darkswarm/map.css.sass
Normal file
5
app/assets/stylesheets/darkswarm/map.css.sass
Normal 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
|
||||
6
app/controllers/map_controller.rb
Normal file
6
app/controllers/map_controller.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class MapController < BaseController
|
||||
layout 'darkswarm'
|
||||
def index
|
||||
@enterprises = Enterprise.visible
|
||||
end
|
||||
end
|
||||
2
app/helpers/map_helper.rb
Normal file
2
app/helpers/map_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module MapHelper
|
||||
end
|
||||
@@ -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
|
||||
|
||||
5
app/views/map/index.html.haml
Normal file
5
app/views/map/index.html.haml
Normal 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"}
|
||||
@@ -13,7 +13,7 @@
|
||||
%span.nav-primary Hubs
|
||||
%li.divider
|
||||
%li
|
||||
%a{href: ""}
|
||||
%a{href: map_path}
|
||||
%span.nav-primary Map
|
||||
%li.divider
|
||||
%li
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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
|
||||
|
||||
8
spec/controllers/map_controller_spec.rb
Normal file
8
spec/controllers/map_controller_spec.rb
Normal 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
|
||||
15
spec/helpers/map_helper_spec.rb
Normal file
15
spec/helpers/map_helper_spec.rb
Normal 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
|
||||
8
vendor/assets/javascripts/angular-google-maps.min.js
vendored
Normal file
8
vendor/assets/javascripts/angular-google-maps.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4979
vendor/assets/javascripts/lodash.underscore.js
vendored
Normal file
4979
vendor/assets/javascripts/lodash.underscore.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user