Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.

Commit bb3a1ec

Browse files
committed
[M] Update to the new angular-ui/angular-ui-docs#8
1 parent cdedcff commit bb3a1ec

File tree

4 files changed

+89
-108
lines changed

4 files changed

+89
-108
lines changed

demo/demo.html

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
1-
<script>
2-
requirejs(['core/demo.js']);
3-
</script>
4-
5-
<!-- Le loading
6-
================================================== -->
7-
8-
<div id="map-l" class="loadingAnimation" >
9-
<div class="bowl_ringG">
10-
<div class="ball_holderG">
11-
<div class="ballG">
12-
</div>
13-
</div>
14-
</div>
15-
</div>
161

172
<!-- Le directive
183
================================================== -->
194

20-
<section id="map" ng-non-bindable ng-controller="MapCtrl" ng-cloak>
5+
<section id="map" ng-controller="MapCtrl" ng-cloak>
216
<div class="page-header">
227
<h1>Google Maps</h1>
238
</div>
@@ -50,6 +35,7 @@ <h1>Marker</h1>
5035
<!--Giving the div an id="map_canvas" fix problems with twitter bootstrap affecting
5136
google maps-->
5237
<div id="map_canvas" ui-map="myMap" class="span8 map"
38+
ui-map-promise="onGoogleReady.promise"
5339
ui-event="{'map-click': 'addMarker($event)', 'map-zoom_changed': 'setZoomMessage(myMap.getZoom())' }"
5440
ui-options="mapOptions">
5541
</div>

demo/demo.js

+40-66
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,40 @@
1-
2-
$("#map").hide();
3-
requireCss('assets/css/demos.css');
4-
5-
function initCall(){ console.log("Google maps api initialized.");}
6-
7-
requirejs(
8-
{
9-
paths: {
10-
'ui.map': "build/ui-map"
11-
},
12-
shim: {
13-
'ui.map': { deps: [
14-
'https://rawgithub.com/angular-ui/ui-utils/master/modules/event/event.js',
15-
'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=initCall'
16-
] }
17-
}
18-
},
19-
['ui.map'],
20-
function () {
21-
22-
angular.module('doc.ui-map', ['ui.map', 'prettifyDirective'])
23-
.controller('MapCtrl', ['$scope', function ($scope) {
24-
25-
$scope.myMarkers = [];
26-
27-
$scope.mapOptions = {
28-
center: new google.maps.LatLng(35.784, -78.670),
29-
zoom: 15,
30-
mapTypeId: google.maps.MapTypeId.ROADMAP
31-
};
32-
33-
$scope.addMarker = function($event) {
34-
$scope.myMarkers.push(new google.maps.Marker({
35-
map: $scope.myMap,
36-
position: $event.latLng
37-
}));
38-
};
39-
40-
$scope.setZoomMessage = function(zoom) {
41-
$scope.zoomMessage = 'You just zoomed to '+zoom+'!';
42-
console.log(zoom,'zoomed');
43-
};
44-
45-
$scope.openMarkerInfo = function(marker) {
46-
$scope.currentMarker = marker;
47-
$scope.currentMarkerLat = marker.getPosition().lat();
48-
$scope.currentMarkerLng = marker.getPosition().lng();
49-
$scope.myInfoWindow.open($scope.myMap, marker);
50-
};
51-
52-
$scope.setMarkerPosition = function(marker, lat, lng) {
53-
marker.setPosition(new google.maps.LatLng(lat, lng));
54-
};
55-
}])
56-
;
57-
e$ = $("#map");
58-
e$.removeAttr("ng-non-bindable");
59-
60-
angular.bootstrap(e$[0], ['doc.ui-map']);
61-
e$.show();
62-
$("#map-l").slideUp();
63-
64-
65-
}
66-
);
1+
function initCall() {
2+
console.log("Google maps api initialized.");
3+
angular.bootstrap(document.getElementById("map"), ['doc.ui-map']);
4+
}
5+
6+
angular.module('doc.ui-map', ['ui.map', 'prettifyDirective'])
7+
.controller('MapCtrl', ['$scope', function ($scope) {
8+
9+
$scope.myMarkers = [];
10+
11+
$scope.mapOptions = {
12+
center: new google.maps.LatLng(35.784, -78.670),
13+
zoom: 15,
14+
mapTypeId: google.maps.MapTypeId.ROADMAP
15+
};
16+
17+
$scope.addMarker = function ($event) {
18+
$scope.myMarkers.push(new google.maps.Marker({
19+
map: $scope.myMap,
20+
position: $event.latLng
21+
}));
22+
};
23+
24+
$scope.setZoomMessage = function (zoom) {
25+
$scope.zoomMessage = 'You just zoomed to ' + zoom + '!';
26+
console.log(zoom, 'zoomed');
27+
};
28+
29+
$scope.openMarkerInfo = function (marker) {
30+
$scope.currentMarker = marker;
31+
$scope.currentMarkerLat = marker.getPosition().lat();
32+
$scope.currentMarkerLng = marker.getPosition().lng();
33+
$scope.myInfoWindow.open($scope.myMap, marker);
34+
};
35+
36+
$scope.setMarkerPosition = function (marker, lat, lng) {
37+
marker.setPosition(new google.maps.LatLng(lat, lng));
38+
};
39+
}])
40+
;

gruntFile.js

+45-25
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ module.exports = function (grunt) {
44
grunt.loadNpmTasks('grunt-contrib-jshint');
55
grunt.loadNpmTasks('grunt-contrib-uglify');
66
grunt.loadNpmTasks('grunt-contrib-copy');
7+
grunt.loadNpmTasks('grunt-contrib-watch');
78

89
// Default task.
9-
grunt.registerTask('default', ['jshint', 'karma']);
10+
grunt.registerTask('default', ['jshint', 'karma:unit']);
1011
grunt.registerTask('build-doc', ['uglify', 'copy']);
12+
grunt.registerTask('server', ['karma:start']);
1113

12-
var testConfig = function(configFile, customOptions) {
14+
var testConfig = function (configFile, customOptions) {
1315
var options = { configFile: configFile, singleRun: true };
14-
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox'], reporters: ['dots'] };
16+
var travisOptions = process.env.TRAVIS && { browsers: [ 'Firefox', 'PhantomJS'], reporters: ['dots'] };
1517
return grunt.util._.extend(options, customOptions, travisOptions);
1618
};
1719

20+
1821
// Project configuration.
1922
grunt.initConfig({
20-
dist : 'components/angular-ui-docs',
23+
bower: 'bower_components',
24+
dist: '<%= bower %>/angular-ui-docs',
2125
pkg: grunt.file.readJSON('package.json'),
2226
meta: {
2327
banner: ['/**',
@@ -27,27 +31,44 @@ module.exports = function (grunt) {
2731
' * @license <%= pkg.license %>',
2832
' */',
2933
''].join('\n'),
30-
view : {
31-
humaName : "UI Map",
32-
repoName : "ui-map"
34+
view: {
35+
humaName: "UI.Map",
36+
repoName: "ui-map",
37+
demoHTML: grunt.file.read("demo/demo.html"),
38+
demoJS: grunt.file.read("demo/demo.js"),
39+
css: [
40+
'assets/css/demos.css'
41+
],
42+
js: [
43+
'https://rawgithub.com/angular-ui/ui-utils/master/modules/event/event.js',
44+
'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=initCall',
45+
'build/ui-map.js'
46+
]
47+
}
48+
},
49+
watch: {
50+
karma: {
51+
files: ['ui-map.js', 'test/*.js'],
52+
tasks: ['karma:unit:run'] //NOTE the :run flag
3353
}
3454
},
3555
karma: {
36-
unit: testConfig('test/karma.conf.js')
56+
unit: testConfig('test/karma.conf.js'),
57+
start: {configFile: 'test/karma.conf.js'}
3758
},
38-
jshint:{
39-
files:['<%= meta.view.repoName %>.js', 'gruntFile.js', 'test/**/*Spec.js', 'demo/**/*.js'],
40-
options:{
41-
curly:true,
42-
eqeqeq:true,
43-
immed:true,
44-
latedef:true,
45-
newcap:true,
46-
noarg:true,
47-
sub:true,
48-
boss:true,
49-
eqnull:true,
50-
globals:{}
59+
jshint: {
60+
files: ['<%= meta.view.repoName %>.js', 'gruntFile.js', 'test/**/*Spec.js', 'demo/**/*.js'],
61+
options: {
62+
curly: true,
63+
eqeqeq: true,
64+
immed: true,
65+
latedef: true,
66+
newcap: true,
67+
noarg: true,
68+
sub: true,
69+
boss: true,
70+
eqnull: true,
71+
globals: {}
5172
}
5273
},
5374
uglify: {
@@ -63,12 +84,11 @@ module.exports = function (grunt) {
6384
files: [
6485
{src: ['<%= meta.view.repoName %>.js'], dest: '<%= dist %>/build/<%= meta.view.repoName %>.js', filter: 'isFile'},
6586
{src: ['demo/demo.html'], dest: '<%= dist %>/demos.html', filter: 'isFile'},
66-
{src: ['demo/demo.css'], dest: '<%= dist %>/assets/css/demos.css', filter: 'isFile'},
67-
{src: ['demo/demo.js'], dest: '<%= dist %>/core/demo.js', filter: 'isFile'}
87+
{src: ['demo/demo.css'], dest: '<%= dist %>/assets/css/demos.css', filter: 'isFile'}
6888
]
6989
},
70-
template : {
71-
options : {processContent : function(content){
90+
template: {
91+
options: {processContent: function (content) {
7292
return grunt.template.process(content);
7393
}},
7494
files: [

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"grunt-karma": "~0.4.x",
1313
"grunt-contrib-jshint": "~0.5.3",
1414
"grunt-contrib-uglify": "~0.2.0",
15-
"grunt-contrib-copy": "~0.4.1"
15+
"grunt-contrib-copy": "~0.4.1",
16+
"grunt-contrib-watch": "~0.5.1"
1617
},
1718
"scripts": {},
1819
"repository": {

0 commit comments

Comments
 (0)