Skip to content

Commit

Permalink
Merge pull request #3 from angular-adaptive/canary
Browse files Browse the repository at this point in the history
v0.1.0
  • Loading branch information
janantala committed Aug 22, 2013
2 parents fe87b86 + 2ff6d0d commit 09aa8ae
Show file tree
Hide file tree
Showing 20 changed files with 15,878 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "components"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/components/
node_modules/
*.log
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: node_js
node_js:
- "0.8"

before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install -g bower grunt-cli
- npm install
- bower install

script: "grunt"
38 changes: 38 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-jshint');

// Default task.
grunt.registerTask('default', ['karma', 'jshint']);

var karmaConfig = function(configFile, customOptions) {
var options = { configFile: configFile, keepalive: true };
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox'], reporters: 'dots' };
return grunt.util._.extend(options, customOptions, travisOptions);
};

// Project configuration.
grunt.initConfig({
karma: {
unit: {
options: karmaConfig('test/test.conf.js')
}
},
jshint:{
files:['src/**/*.js', 'test/**/*.js'],
options: {
curly:true,
eqeqeq:true,
immed:true,
latedef:true,
newcap:true,
noarg:true,
sub:true,
boss:true,
eqnull:true,
devel:true,
globals:{}
}
}
});
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2013 Jan Antala, https://github.com/janantala

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
111 changes: 109 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,109 @@
adaptive-googlemaps
===================
# adaptive-googlemaps v0.1.0 [![Build Status](https://travis-ci.org/angular-adaptive/adaptive-googlemaps.png?branch=master)](https://travis-ci.org/angular-adaptive/adaptive-googlemaps)

This module allows you to adapt googlemaps component for different occasions.
- static google map
- open map in a new tab / a native mobile application
- load dynamic google map


### Demo

Check out http://angular-adaptive.github.io/adaptive-googlemaps/demo/

# Requirements

- AngularJS v 1.0+
- Googlemaps script

# Usage

We use [bower](http://twitter.github.com/bower/) for dependency management. Add

dependencies: {
"angular-adaptive-googlemaps": "latest"
}

To your `bower.json` file. Then run

bower install

This will copy the angular-isbn files into your `bower_components` folder, along with its dependencies. Load the script files in your application:

<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="components/angular/angular.js"></script>
<script type="text/javascript" src="components/angular-adaptive/adaptive-googlemaps/src/adaptive-googlemaps.js"></script>

Add the **adaptive.googlemaps** module as a dependency to your application module:

var myAppModule = angular.module('MyApp', ['adaptive.googlemaps']);

Add **googlemaps** element into your template

<googlemaps class="google-maps" sensor="false" size="500x300" zoom="9" center="San Francisco International Airport" markers="['San Francisco', 'San Jose']" maptype="terrain" mapevents="{redirect: false, loadmap: true}"></googlemaps>

### Directive attributes

#### Required:

- sensor="false" // true, false
- size="500x300" // width x height
- zoom="6"
- center="California"

#### Optional:

- markers="['San Francisco', 'San Jose']"
- maptype="roadmap" // roadmap, satellite, terrain, hybrid
- mapevents="{redirect: true, loadmap: false}"

#### mapevents: { "redirect": false, "loadmap": true }
Loads dynamic google map.

<p align="center">
<img src="http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=500x300&maptype=terrain&center=San%20Francisco%20International%20Airport&zoom=9&markers=San%20Francisco&markers=San%20Jose" alt="Map"/>
</p>

#### { "redirect": true, "loadmap": false }
Opens google map in a new tab / a native mobile application.

<p align="center">
<img src="http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=500x300&maptype=roadmap&center=Pennsylvania&zoom=6&markers=New%20York&markers=Philadalphia&markers=Washington%20DC" alt="Map"/>
</p>

#### mapevents: no mapevents
Nothing happens.

<p align="center">
<img src="http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=500x300&maptype=hybrid&center=New%20York&zoom=12" alt="Map"/>
</p>


# Contributing

Contributions are welcome. Please make a pull request against canary branch and do not bump versions. Also include tests.

### Todo
- Let the device/browser decide what kinds of map events will be used. *Example: mobile device will open native maps application, browser with fast internet connection will auto load dynamic map...*

# Testing

More tests will be added...

We use karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use grunt:

npm install -g grunt-cli
npm install
bower install
grunt

The karma task will try to open Chrome as a browser in which to run the tests. Make sure this is available or change the configuration in `test/test.config.js`

# References

If you are looking just for static google maps you can use [angular-google-staticmaps](https://github.com/passy/angular-google-staticmaps) repository.

# License

The MIT License

Copyright (c) 2013 Jan Antala, https://github.com/janantala
24 changes: 24 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "angular-adaptive-googlemaps",
"version": "0.1.0",
"description": "This module allows you to adapat googlemaps component for different occasions.",
"author": "https://github.com/angular-adaptive/adaptive-googlemaps/graphs/contributors",
"license": "MIT",
"homepage": "http://angular-adaptive.github.io",
"main": "./src/adaptive-googlemaps.js",
"ignore": [
"**/.*",
"node_modules",
"components",
"test*",
"demo*",
"Gruntfile.js",
"package.json"
],
"dependencies": {
"angular": "~1.x"
},
"devDependencies": {
"angular-mocks": "~1.x"
}
}
7 changes: 7 additions & 0 deletions demo/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "googlemaps",
"version": "0.0.0",
"dependencies": {
"angular": "~1.0.7"
}
}
Loading

0 comments on commit 09aa8ae

Please sign in to comment.