├── .bowerrc ├── .ember-cli ├── .gitignore ├── .jshintrc ├── .travis.yml ├── Brocfile.js ├── README.md ├── addon ├── components │ ├── .gitkeep │ ├── google-map-autocomplete.js │ ├── google-map.js │ └── yandex-map.js ├── mixins │ └── abstract-map.js └── templates │ ├── .gitkeep │ └── components │ ├── .gitkeep │ ├── google-map-autocomplete.hbs │ ├── google-map.hbs │ └── yandex-map.hbs ├── app └── components │ ├── .gitkeep │ ├── google-map-autocomplete.js │ ├── google-map.js │ └── yandex-map.js ├── bower.json ├── config ├── ember-try.js └── environment.js ├── index.js ├── package.json ├── public ├── .gitkeep ├── crossdomain.xml └── robots.txt ├── testem.json ├── tests ├── .jshintrc ├── acceptance │ └── dummy-test.js ├── dummy │ ├── .jshintrc │ ├── app │ │ ├── app.js │ │ ├── index.html │ │ ├── router.js │ │ ├── routes │ │ │ └── application.js │ │ ├── styles │ │ │ └── app.scss │ │ └── templates │ │ │ └── application.hbs │ ├── config │ │ └── environment.js │ └── public │ │ ├── crossdomain.xml │ │ └── robots.txt ├── helpers │ ├── resolver.js │ └── start-app.js ├── index.html ├── test-helper.js └── unit │ └── .gitkeep └── vendor ├── .gitkeep └── map.css /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "analytics": false 4 | } 5 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components/* 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log 17 | testem.log 18 | 19 | /.idea 20 | /.editorconfig 21 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": { 3 | "document": true, 4 | "window": true, 5 | "-Promise": true 6 | }, 7 | "browser" : true, 8 | "boss" : true, 9 | "curly": true, 10 | "debug": false, 11 | "devel": true, 12 | "eqeqeq": true, 13 | "evil": true, 14 | "forin": false, 15 | "immed": false, 16 | "laxbreak": false, 17 | "newcap": true, 18 | "noarg": true, 19 | "noempty": false, 20 | "nonew": false, 21 | "nomen": false, 22 | "onevar": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": false, 29 | "eqnull": true, 30 | "esnext": true, 31 | "unused": true 32 | } 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | 4 | sudo: false 5 | 6 | install: 7 | - npm install -g bower 8 | - npm install 9 | - bower install 10 | 11 | script: 12 | - npm test 13 | -------------------------------------------------------------------------------- /Brocfile.js: -------------------------------------------------------------------------------- 1 | /* global require, module */ 2 | 3 | var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 4 | 5 | var app = new EmberAddon(); 6 | 7 | module.exports = app.toTree(); 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ember Map 2 | ========= 3 | 4 | [![Build Status](https://travis-ci.org/ember-admin/ember-cli-map.svg?branch=master)](https://travis-ci.org/ember-admin/ember-cli-map) 5 | [![npm version](https://badge.fury.io/js/ember-cli-map.svg)](http://badge.fury.io/js/ember-cli-map) 6 | 7 | Ember Map provides you with google-map and yandex-map components. 8 | 9 | Add Maps Libraries 10 | -------------- 11 | To use google apiKey you need to set it in `config/environment.js`. 12 | ```javascript 13 | ENV['ember-cli-map'] = { 14 | googleApiKey: 'MYsecretKEY' 15 | }; 16 | ``` 17 | 18 | Model Setup 19 | -------------- 20 | Declare fields to use with map component: 21 | 22 | ```javascript 23 | asGoogleMap: ['lat', 'long', 'zoom'] // or 24 | asYandexMap: ['lat', 'long', 'zoom'] 25 | ``` 26 | 27 | ###Example: 28 | 29 | ```javascript 30 | export default DS.Model.extend({ 31 | lat: DS.attr('number'), 32 | long: DS.attr('number'), 33 | zoom: DS.attr('number'), 34 | asGoogleMap: ['lat', 'long', 'zoom'] 35 | }); 36 | ``` 37 | 38 | #In your template 39 | 40 | ```handlebars 41 | {{google-map model=model action='updateModel'}} 42 | ``` 43 | 44 | ```handlebars 45 | {{yandex-map model=model action='updateModel'}} 46 | ``` 47 | 48 | #In your route/controller 49 | 50 | ```javascript 51 | actions: { 52 | updateModel(newCoordinates) { 53 | this.get('currentModel').setProperties(newCoordinates); 54 | } 55 | } 56 | ``` 57 | 58 | License 59 | ---- 60 | 61 | [Licensed under MIT license] [1] 62 | 63 | [1]:http://opensource.org/licenses/mit-license.php 64 | -------------------------------------------------------------------------------- /addon/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-admin/ember-cli-map/248cdeb57c2b9feaaf18f9579eea670e879bfede/addon/components/.gitkeep -------------------------------------------------------------------------------- /addon/components/google-map-autocomplete.js: -------------------------------------------------------------------------------- 1 | /*global google */ 2 | import Ember from 'ember'; 3 | import layout from '../templates/components/google-map-autocomplete'; 4 | 5 | export default Ember.Component.extend({ 6 | layout: layout, 7 | 8 | address: Ember.computed.alias('model.address').readOnly(), 9 | lat: Ember.computed.alias('model.lat').readOnly(), 10 | long: Ember.computed.alias('model.long').readOnly(), 11 | 12 | initialize: Ember.on('didInsertElement', function() { 13 | let inputElement = this.$('input')[0]; 14 | let autocompleteField = new google.maps.places.Autocomplete(inputElement, {types: ['geocode']}); 15 | autocompleteField.addListener('place_changed', ()=>{ 16 | //HACK: context 17 | this.updateModel(); 18 | }); 19 | this.set('autocomplete', autocompleteField); 20 | if(this.get('class')){ 21 | this.$('input').addClass(this.get('class')); 22 | } 23 | }), 24 | 25 | updateModel: function () { 26 | let place = this.get('autocomplete').getPlace(); 27 | let geometry = place.geometry; 28 | if(geometry){ 29 | this.sendAction('action',{ 30 | address: place.formatted_address, 31 | lat: geometry.location.lat(), 32 | long: geometry.location.lng() 33 | }); 34 | } 35 | } 36 | }); 37 | -------------------------------------------------------------------------------- /addon/components/google-map.js: -------------------------------------------------------------------------------- 1 | /*global google */ 2 | import Ember from 'ember'; 3 | import AbstractMapMixin from 'ember-cli-map/mixins/abstract-map'; 4 | import layout from '../templates/components/google-map'; 5 | 6 | const { Component, on, computed } = Ember; 7 | 8 | export default Component.extend(AbstractMapMixin, { 9 | layout: layout, 10 | 11 | mapType: 'asGoogleMap', 12 | iconPath: null, 13 | zoom: Ember.computed('model.zoom', function() { 14 | let modelZoom = this.get('model.zoom') ; 15 | return modelZoom ? modelZoom : 1; 16 | }), 17 | 18 | initialize: on('didInsertElement', function() { 19 | var map, marker, options; 20 | var self = this; 21 | 22 | options = { 23 | zoom: this.get('zoom'), 24 | center: this.get('center'), 25 | mapTypeId: this.get('mapTypeId') 26 | }; 27 | map = new google.maps.Map(this.$().find(".map")[0], options); 28 | marker = this.initMarker(map); 29 | self.set('mapCenter', this.get('center')); 30 | map.addListener('click', function(event) { 31 | self.addMarker(event.latLng, map); 32 | }); 33 | map.addListener('center_changed', function() { 34 | self.set('mapCenter',map.getCenter()); 35 | }); 36 | if (!this.get('disableAutocomplete')) { 37 | this.initAutocomplete(map, marker); 38 | } 39 | return google.maps.event.addListener(map, 'zoom_changed', () => { 40 | return this.setZoom(map.getZoom()); 41 | }); 42 | }), 43 | center: computed(function() { 44 | var coord; 45 | coord = this.centerCoords(); 46 | return new google.maps.LatLng(coord[0], coord[1]); 47 | }), 48 | mapTypeId: computed(function() { 49 | return google.maps.MapTypeId.ROADMAP; 50 | }), 51 | addMarker: function(location, map) { 52 | var defaultIcon = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|FE7569'; 53 | var markers = []; 54 | var marker = new google.maps.Marker({ 55 | position: location, 56 | map: map, 57 | draggable: true, 58 | icon: this.get('iconPath') || defaultIcon 59 | }); 60 | 61 | markers.push(marker); 62 | }, 63 | initMarker: function(map) { 64 | var marker, options; 65 | var defaultIcon = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|FE7569'; 66 | options = { 67 | position: this.get('center'), 68 | map: map, 69 | draggable: true, 70 | icon: this.get('iconPath') || defaultIcon 71 | }; 72 | marker = new google.maps.Marker(options); 73 | google.maps.event.addListener(marker, 'dragend', (event) => { 74 | var pos; 75 | map.setCenter(event.latLng); 76 | pos = marker.getPosition(); 77 | return this.setAttrs(pos.lat(), pos.lng()); 78 | }); 79 | return marker; 80 | }, 81 | 82 | initAutocomplete: function(map, marker) { 83 | var autocomplete, autocompleteView, input; 84 | autocompleteView = this.$('.google-map-autocomplete'); 85 | input = autocompleteView[0]; 86 | autocomplete = new google.maps.places.Autocomplete(input, { 87 | types: ['geocode'] 88 | }); 89 | return google.maps.event.addListener(autocomplete, 'place_changed', () => { 90 | var place, pos, address; 91 | place = autocomplete.getPlace(); 92 | address = autocomplete.getPlace().formatted_address; 93 | this.set('model.address', address); 94 | if (!place.geometry) { 95 | return; 96 | } 97 | pos = place.geometry.location; 98 | if (place.geometry.viewport) { 99 | map.fitBounds(place.geometry.viewport); 100 | } else { 101 | map.setCenter(pos); 102 | map.setZoom(17); 103 | } 104 | marker.setPosition(pos); 105 | return this.setAttrs(pos.lat(), pos.lng()); 106 | }); 107 | }, 108 | 109 | }); 110 | -------------------------------------------------------------------------------- /addon/components/yandex-map.js: -------------------------------------------------------------------------------- 1 | /*global ymaps */ 2 | import Ember from 'ember'; 3 | import AbstractMapMixin from 'ember-cli-map/mixins/abstract-map'; 4 | import layout from '../templates/components/yandex-map'; 5 | 6 | const { Component, computed } = Ember; 7 | 8 | var genId = function() { 9 | var arr = new Uint8Array(8); 10 | window.crypto.getRandomValues(arr); 11 | return [].map.call(arr, function(n) { return n.toString(16); }).join(""); 12 | }; 13 | 14 | export default Component.extend(AbstractMapMixin, { 15 | layout: layout, 16 | 17 | mapType: 'asYandexMap', 18 | 19 | childId: Ember.computed({ 20 | get(){ 21 | return genId(); 22 | } 23 | }), 24 | 25 | didInsertElement: function() { 26 | return ymaps.ready(() => { 27 | return this.initMap.call(this); 28 | }); 29 | }, 30 | 31 | initMap: function() { 32 | var map; 33 | var self = this; 34 | self.set('mapCenter', this.get('center')); 35 | map = new ymaps.Map(this.get('childId'), { 36 | center: this.get('center'), 37 | zoom: this.get('zoom') 38 | }); 39 | this.initMarker(map); 40 | map.events.add('click', function (click) { 41 | self.addMarker(map, click.get('coords')); 42 | }); 43 | map.events.add('boundschange', function (e) { 44 | self.set('mapCenter', e.get('newCenter')); 45 | }); 46 | map.controls.add('zoomControl', { 47 | left: 5, 48 | top: 5 49 | }).add('typeSelector').add('mapTools', { 50 | left: 35, 51 | top: 5 52 | }); 53 | return this.initAutocomplete(); 54 | }, 55 | center: computed(function() { 56 | return this.centerCoords(); 57 | }), 58 | addMarker: function(map, coord) { 59 | var mark; 60 | var i = 1; 61 | map.geoObjects.each(function () { 62 | i+=1; 63 | }); 64 | mark = new ymaps.Placemark(coord, { 65 | iconContent: `${i}`, 66 | balloonContent: '', 67 | hintContent: '' 68 | }, { 69 | preset: 'twirl#violetIcon', 70 | draggable: true 71 | }); 72 | map.geoObjects.add(mark); 73 | return mark.events.add("dragend", () => { 74 | return this.setAttrs(mark.geometry.getCoordinates()); 75 | }); 76 | }, 77 | initMarker: function(map) { 78 | var mark; 79 | mark = new ymaps.Placemark(this.get('center'), { 80 | iconContent: '1', 81 | balloonContent: '', 82 | hintContent: '' 83 | }, { 84 | preset: 'twirl#violetIcon', 85 | draggable: true 86 | }); 87 | map.geoObjects.add(mark); 88 | return mark.events.add("dragend", () => { 89 | return this.setAttrs(mark.geometry.getCoordinates()); 90 | }); 91 | }, 92 | initAutocomplete: function() { 93 | var autocompleteView, input; 94 | autocompleteView = this.$('.yandex-maps-autocomplete'); 95 | return input = autocompleteView.hide(); 96 | } 97 | }); 98 | -------------------------------------------------------------------------------- /addon/mixins/abstract-map.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | const { Mixin, computed } = Ember; 3 | 4 | export default Mixin.create({ 5 | defaultLat: "50.44067063154785", 6 | defaultLong: "30.52654266357422", 7 | 8 | mapAttrs: computed(function() { 9 | return this.get(`model.${this.get('mapType')}`); 10 | }), 11 | lat: computed({ 12 | get() { 13 | if (!this._lat) { 14 | this._lat = this.get(this.keyFor(0)); 15 | } 16 | return this._lat; 17 | }, 18 | set(_, value) { 19 | this._lat = value; 20 | return value; 21 | } 22 | }), 23 | long: computed({ 24 | get() { 25 | if (!this._long) { 26 | this._long = this.get(this.keyFor(1)); 27 | } 28 | return this._long; 29 | }, 30 | set(_, value) { 31 | this._long = value; 32 | return value; 33 | } 34 | }), 35 | zoom: computed({ 36 | get() { 37 | if (!this._zoom) { 38 | this._zoom = this.get(this.keyFor(2)); 39 | } 40 | return this._zoom; 41 | }, 42 | set(_, value) { 43 | this._zoom = value; 44 | return value; 45 | } 46 | }), 47 | 48 | keyFor(index) { 49 | let key = this.get('mapAttrs')[index]; 50 | return `model.${key}`; 51 | }, 52 | setAttrs(lat, long, zoom) { 53 | if (this.get('disableMapping')) { 54 | return; 55 | } 56 | if (lat) { 57 | this.set('lat', lat); 58 | } 59 | if (long) { 60 | this.set('long', long); 61 | } 62 | if (zoom) { 63 | this.set('zoom', zoom); 64 | } 65 | 66 | return this.sendAction('action', { 67 | lat: this.get('lat'), 68 | long: this.get('long'), 69 | zoom: this.get('zoom') 70 | }); 71 | }, 72 | setZoom(zoom) { 73 | return this.setAttrs(null, null, zoom); 74 | }, 75 | centerCoords() { 76 | if (this.get('lat') && this.get('long')) { 77 | return [this.get('lat'), this.get('long')]; 78 | } else { 79 | return [this.get('defaultLat'), this.get('defaultLong')]; 80 | } 81 | } 82 | }); 83 | -------------------------------------------------------------------------------- /addon/templates/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-admin/ember-cli-map/248cdeb57c2b9feaaf18f9579eea670e879bfede/addon/templates/.gitkeep -------------------------------------------------------------------------------- /addon/templates/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-admin/ember-cli-map/248cdeb57c2b9feaaf18f9579eea670e879bfede/addon/templates/components/.gitkeep -------------------------------------------------------------------------------- /addon/templates/components/google-map-autocomplete.hbs: -------------------------------------------------------------------------------- 1 | {{input type="text" placeholder=placeholder autocomplete="off"}} 2 | -------------------------------------------------------------------------------- /addon/templates/components/google-map.hbs: -------------------------------------------------------------------------------- 1 |
2 | {{#unless disableAutocomplete}} 3 |
4 |
Map center
{{mapCenter}}
5 | 6 | {{input type="text" value=model.address class="google-map-autocomplete"}} 7 |
8 | {{/unless}} 9 | {{yield}} -------------------------------------------------------------------------------- /addon/templates/components/yandex-map.hbs: -------------------------------------------------------------------------------- 1 |
2 | {{input class='yandex-maps-autocomplete'}} 3 |
4 |
5 |
Map center
({{mapCenter}})
6 | -------------------------------------------------------------------------------- /app/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-admin/ember-cli-map/248cdeb57c2b9feaaf18f9579eea670e879bfede/app/components/.gitkeep -------------------------------------------------------------------------------- /app/components/google-map-autocomplete.js: -------------------------------------------------------------------------------- 1 | export { default } from 'ember-cli-map/components/google-map-autocomplete'; 2 | -------------------------------------------------------------------------------- /app/components/google-map.js: -------------------------------------------------------------------------------- 1 | export { default } from 'ember-cli-map/components/google-map'; 2 | -------------------------------------------------------------------------------- /app/components/yandex-map.js: -------------------------------------------------------------------------------- 1 | export { default } from 'ember-cli-map/components/yandex-map'; 2 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-cli-map", 3 | "dependencies": { 4 | "ember": "1.13.0", 5 | "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", 6 | "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", 7 | "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4", 8 | "ember-qunit": "0.3.3", 9 | "ember-qunit-notifications": "0.0.7", 10 | "ember-resolver": "~0.1.15", 11 | "jquery": "^1.11.1", 12 | "loader.js": "ember-cli/loader.js#3.2.0", 13 | "qunit": "~1.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /config/ember-try.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | scenarios: [ 3 | { 4 | name: 'default', 5 | dependencies: { } 6 | }, 7 | { 8 | name: 'ember-release', 9 | dependencies: { 10 | 'ember': 'components/ember#release', 11 | }, 12 | resolutions: { 13 | 'ember': 'release', 14 | } 15 | }, 16 | { 17 | name: 'ember-beta', 18 | dependencies: { 19 | 'ember': 'components/ember#beta', 20 | }, 21 | resolutions: { 22 | 'ember': 'beta', 23 | } 24 | }, 25 | { 26 | name: 'ember-canary', 27 | dependencies: { 28 | 'ember': 'components/ember#canary', 29 | }, 30 | resolutions: { 31 | 'ember': 'canary', 32 | } 33 | } 34 | ] 35 | }; 36 | -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(/* environment, appConfig */) { 4 | return { }; 5 | }; 6 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'ember-cli-map', 3 | 4 | included: function(app) { 5 | this.app = app; 6 | app.import('vendor/map.css'); 7 | }, 8 | contentFor: function(type, config) { 9 | if (type === 'body-footer' && config.environment !== 'test') { 10 | var libs = ''; 11 | if (config['ember-cli-map'] && config['ember-cli-map'].googleApiKey) { 12 | var key = config['ember-cli-map'].googleApiKey; 13 | libs = libs + ''; 14 | } else { 15 | libs = libs + ''; 16 | } 17 | 18 | return libs; 19 | } 20 | 21 | if (type === 'test-body-footer' && config.environment === 'test') { 22 | var libs = ''; 23 | 24 | libs = libs + ''; 25 | 26 | return libs; 27 | } 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-cli-map", 3 | "version": "0.4.2", 4 | "description": "Ember Map provides you with google-map and yandex-map components.", 5 | "directories": { 6 | "doc": "doc", 7 | "test": "tests" 8 | }, 9 | "scripts": { 10 | "start": "ember server", 11 | "build": "ember build", 12 | "test": "ember try:testall" 13 | }, 14 | "repository": "https://github.com/ember-admin/ember-cli-map", 15 | "engines": { 16 | "node": ">= 0.10.0" 17 | }, 18 | "author": "Valeria Leshchenko ", 19 | "license": "MIT", 20 | "devDependencies": { 21 | "broccoli-asset-rev": "^2.0.2", 22 | "ember-cli": "0.2.7", 23 | "ember-cli-app-version": "0.3.3", 24 | "ember-cli-content-security-policy": "0.4.0", 25 | "ember-cli-dependency-checker": "^1.0.0", 26 | "ember-cli-ic-ajax": "0.1.1", 27 | "ember-cli-qunit": "0.3.13", 28 | "ember-cli-uglify": "^1.0.1", 29 | "ember-disable-prototype-extensions": "^1.0.0", 30 | "ember-disable-proxy-controllers": "^1.0.0", 31 | "ember-export-application-global": "^1.0.2", 32 | "ember-try": "0.0.7" 33 | }, 34 | "dependencies": { 35 | "ember-cli-babel": "^5.0.0", 36 | "ember-cli-htmlbars": "0.7.9" 37 | }, 38 | "keywords": [ 39 | "ember-addon" 40 | ], 41 | "ember-addon": { 42 | "configPath": "tests/dummy/config" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /public/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-admin/ember-cli-map/248cdeb57c2b9feaaf18f9579eea670e879bfede/public/.gitkeep -------------------------------------------------------------------------------- /public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # robotstxt.org/ 2 | 3 | User-agent: * 4 | -------------------------------------------------------------------------------- /testem.json: -------------------------------------------------------------------------------- 1 | { 2 | "framework": "qunit", 3 | "test_page": "tests/index.html?hidepassed", 4 | "disable_watching": true, 5 | "phantomjs_args" : [ 6 | "--ignore-ssl-errors=true", 7 | "--web-security=false" 8 | ], 9 | "launch_in_ci": [ 10 | "PhantomJS" 11 | ], 12 | "launch_in_dev": [ 13 | "PhantomJS", 14 | "Chrome" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /tests/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "location", 6 | "setTimeout", 7 | "$", 8 | "-Promise", 9 | "QUnit", 10 | "define", 11 | "console", 12 | "equal", 13 | "notEqual", 14 | "notStrictEqual", 15 | "test", 16 | "asyncTest", 17 | "testBoth", 18 | "testWithDefault", 19 | "raises", 20 | "throws", 21 | "deepEqual", 22 | "start", 23 | "stop", 24 | "ok", 25 | "strictEqual", 26 | "module", 27 | "moduleFor", 28 | "moduleForComponent", 29 | "moduleForModel", 30 | "process", 31 | "expect", 32 | "visit", 33 | "exists", 34 | "fillIn", 35 | "click", 36 | "keyEvent", 37 | "triggerEvent", 38 | "find", 39 | "findWithAssert", 40 | "wait", 41 | "DS", 42 | "isolatedContainer", 43 | "startApp", 44 | "andThen", 45 | "currentURL", 46 | "currentPath", 47 | "currentRouteName" 48 | ], 49 | "node": false, 50 | "browser": false, 51 | "boss": true, 52 | "curly": false, 53 | "debug": false, 54 | "devel": false, 55 | "eqeqeq": true, 56 | "evil": true, 57 | "forin": false, 58 | "immed": false, 59 | "laxbreak": false, 60 | "newcap": true, 61 | "noarg": true, 62 | "noempty": false, 63 | "nonew": false, 64 | "nomen": false, 65 | "onevar": false, 66 | "plusplus": false, 67 | "regexp": false, 68 | "undef": true, 69 | "sub": true, 70 | "strict": false, 71 | "white": false, 72 | "eqnull": true, 73 | "esnext": true 74 | } 75 | -------------------------------------------------------------------------------- /tests/acceptance/dummy-test.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import {module, test} from 'qunit'; 3 | import startApp from '../helpers/start-app'; 4 | 5 | var App, server; 6 | 7 | module('Acceptance: Admin', { 8 | beforeEach: function() { 9 | App = startApp(); 10 | }, 11 | afterEach: function() { 12 | Ember.run(App, 'destroy'); 13 | } 14 | }); 15 | 16 | test('google maps are displayed', function(assert) { 17 | assert.expect(1); 18 | visit('/'); 19 | stop(); 20 | Ember.run.later(this, function() { 21 | start(); 22 | assert.equal(find('.gm-style').length, 2); 23 | }, 1000); 24 | }); 25 | 26 | test('yandex maps are displayed', function(assert) { 27 | assert.expect(1); 28 | visit('/'); 29 | stop(); 30 | Ember.run.later(this, function() { 31 | start(); 32 | assert.equal(find('.ymaps-map').length, 1); 33 | }, 1000); 34 | }); 35 | -------------------------------------------------------------------------------- /tests/dummy/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": { 3 | "document": true, 4 | "window": true, 5 | "-Promise": true 6 | }, 7 | "browser" : true, 8 | "boss" : true, 9 | "curly": true, 10 | "debug": false, 11 | "devel": true, 12 | "eqeqeq": true, 13 | "evil": true, 14 | "forin": false, 15 | "immed": false, 16 | "laxbreak": false, 17 | "newcap": true, 18 | "noarg": true, 19 | "noempty": false, 20 | "nonew": false, 21 | "nomen": false, 22 | "onevar": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": false, 29 | "eqnull": true, 30 | "esnext": true, 31 | "unused": true 32 | } 33 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Resolver from 'ember/resolver'; 3 | import loadInitializers from 'ember/load-initializers'; 4 | import config from './config/environment'; 5 | 6 | Ember.MODEL_FACTORY_INJECTIONS = true; 7 | 8 | var App = Ember.Application.extend({ 9 | modulePrefix: config.modulePrefix, 10 | podModulePrefix: config.podModulePrefix, 11 | Resolver: Resolver 12 | }); 13 | 14 | loadInitializers(App, config.modulePrefix); 15 | 16 | export default App; 17 | -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy 7 | 8 | 9 | 10 | {{content-for 'head'}} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/dummy/app/router.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import config from './config/environment'; 3 | 4 | var Router = Ember.Router.extend({ 5 | location: config.locationType 6 | }); 7 | 8 | Router.map(function() { 9 | }); 10 | 11 | export default Router; 12 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/application.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Route.extend({ 4 | model() { 5 | return Ember.Object.create({ 6 | lat: 40, 7 | long: 50, 8 | zoom: 1, 9 | asGoogleMap: ['lat', 'long', 'zoom'], 10 | asYandexMap: ['lat', 'long', 'zoom'] 11 | }); 12 | }, 13 | actions: { 14 | updateModel(newCoordinates) { 15 | this.get('currentModel').setProperties(newCoordinates); 16 | } 17 | } 18 | }); 19 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-admin/ember-cli-map/248cdeb57c2b9feaaf18f9579eea670e879bfede/tests/dummy/app/styles/app.scss -------------------------------------------------------------------------------- /tests/dummy/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 |

Welcome to Ember.js

2 | 3 |
4 | 9 |
10 | 11 | 12 | {{google-map-autocomplete model=model action='updateModel' class="test"}} 13 | 14 | {{google-map model=model action='updateModel'}} 15 | {{yandex-map model=model action='updateModel'}} 16 | {{google-map model=model action='updateModel'}} 17 | 18 | 19 | 20 | {{outlet}} 21 | -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 3 | module.exports = function(environment) { 4 | var ENV = { 5 | modulePrefix: 'dummy', 6 | environment: environment, 7 | baseURL: '/', 8 | locationType: 'auto', 9 | EmberENV: { 10 | FEATURES: { 11 | // Here you can enable experimental features on an ember canary build 12 | // e.g. 'with-controller': true 13 | } 14 | }, 15 | 16 | contentSecurityPolicy: { 17 | 'script-src': "'self' 'unsafe-inline' 'unsafe-eval' use.typekit.net connect.facebook.net *.googleapis.com " + 18 | "*.gstatic.com *.yandex.ru", 19 | 'style-src': "'self' 'unsafe-inline' use.typekit.net *.googleapis.com", 20 | 'img-src': "*", 21 | 'font-src': '*.gstatic.com' 22 | }, 23 | 24 | APP: { 25 | // Here you can pass flags/options to your application instance 26 | // when it is created 27 | } 28 | }; 29 | 30 | ENV['ember-cli-map'] = { 31 | googleApiKey: 'AIzaSyCqyf1CwoH9VU6XNYBmIXZSRsMQ0BJUOrw' 32 | }; 33 | 34 | if (environment === 'development') { 35 | // ENV.APP.LOG_RESOLVER = true; 36 | ENV.APP.LOG_ACTIVE_GENERATION = true; 37 | // ENV.APP.LOG_TRANSITIONS = true; 38 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 39 | ENV.APP.LOG_VIEW_LOOKUPS = true; 40 | } 41 | 42 | if (environment === 'test') { 43 | // Testem prefers this... 44 | ENV.baseURL = '/'; 45 | ENV.locationType = 'auto'; 46 | 47 | // keep test console output quieter 48 | ENV.APP.LOG_ACTIVE_GENERATION = false; 49 | ENV.APP.LOG_VIEW_LOOKUPS = false; 50 | 51 | ENV.APP.rootElement = '#ember-testing'; 52 | } 53 | 54 | if (environment === 'production') { 55 | 56 | } 57 | 58 | return ENV; 59 | }; 60 | -------------------------------------------------------------------------------- /tests/dummy/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /tests/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # robotstxt.org/ 2 | 3 | User-agent: * 4 | -------------------------------------------------------------------------------- /tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember/resolver'; 2 | import config from '../../config/environment'; 3 | 4 | var resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Application from '../../app'; 3 | import Router from '../../router'; 4 | import config from '../../config/environment'; 5 | 6 | export default function startApp(attrs) { 7 | var application; 8 | 9 | var attributes = Ember.merge({}, config.APP); 10 | attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; 11 | 12 | Ember.run(function() { 13 | application = Application.create(attributes); 14 | application.setupForTesting(); 15 | application.injectTestHelpers(); 16 | }); 17 | 18 | return application; 19 | } 20 | -------------------------------------------------------------------------------- /tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy Tests 7 | 8 | 9 | 10 | {{content-for 'head'}} 11 | {{content-for 'test-head'}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for 'head-footer'}} 18 | {{content-for 'test-head-footer'}} 19 | 20 | 21 | 22 | {{content-for 'body'}} 23 | {{content-for 'test-body'}} 24 | 25 | 26 | 27 | 28 | 29 | 30 | {{content-for 'body-footer'}} 31 | {{content-for 'test-body-footer'}} 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { 3 | setResolver 4 | } from 'ember-qunit'; 5 | 6 | setResolver(resolver); 7 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-admin/ember-cli-map/248cdeb57c2b9feaaf18f9579eea670e879bfede/tests/unit/.gitkeep -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ember-admin/ember-cli-map/248cdeb57c2b9feaaf18f9579eea670e879bfede/vendor/.gitkeep -------------------------------------------------------------------------------- /vendor/map.css: -------------------------------------------------------------------------------- 1 | .map { 2 | height: 400px; 3 | margin-left: 10%; 4 | width: 81%; 5 | margin-top: 0.6em; 6 | } 7 | .map img { 8 | max-width: none; 9 | } 10 | 11 | .geo_input { 12 | margin-bottom: 30px; 13 | } 14 | .geo_input label { 15 | display: inline-block; 16 | width: 10%; 17 | } 18 | .geo_input input { 19 | margin-left: 10%; 20 | width: 80% !important; 21 | } 22 | --------------------------------------------------------------------------------