Merge remote-tracking branch 'origin/7.0.0' into 7.0.0

This commit is contained in:
Shannon
2013-06-11 13:16:03 +02:00
5 changed files with 83 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
angular.module("umbraco")
.controller("Umbraco.Editors.GoogleMapsController",
function ($rootScope, $scope, notificationsService, $timeout) {
function ($rootScope, $scope, notificationsService, dialogService, $log, $timeout) {
require(
[
'async!http://maps.google.com/maps/api/js?sensor=false'
@@ -16,27 +16,55 @@ angular.module("umbraco")
center: latLng,
mapTypeId: google.maps.MapTypeId[$scope.model.config.mapType]
};
var geocoder = new google.maps.Geocoder();
var map = new google.maps.Map(mapDiv, mapOptions);
var marker = new google.maps.Marker({
map: map,
position: latLng,
draggable: true
});
google.maps.event.addListener(marker, "dragend", function(e){
var newLat = marker.getPosition().lat();
var newLng = marker.getPosition().lng();
//here we will set the value
$scope.model.value = newLat + "," + newLng;
google.maps.event.addListener(map, 'click', function(event) {
//call the notication engine
$rootScope.$apply(function () {
notificationsService.warning("Your dragged a marker to", $scope.model.value);
});
dialogService.mediaPicker({scope: $scope, callback: function(data){
var image = data.selection[0].src;
var latLng = event.latLng;
var marker = new google.maps.Marker({
map: map,
icon: image,
position: latLng,
draggable: true
});
google.maps.event.addListener(marker, "dragend", function(e){
var newLat = marker.getPosition().lat();
var newLng = marker.getPosition().lng();
codeLatLng(marker.getPosition());
//set the model value
$scope.model.value = newLat + "," + newLng;
});
}});
});
function codeLatLng(latLng) {
geocoder.geocode({'latLng': latLng},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var location = results[0].formatted_address;
$rootScope.$apply(function () {
notificationsService.success("Peter just went to: ", location);
});
}
});
}
//hack to hook into tab switching for map resizing
$('a[data-toggle="tab"]').on('shown', function (e) {
google.maps.event.trigger(map, 'resize');

View File

@@ -109,7 +109,7 @@ module.exports = function (grunt) {
{ dest: '<%= distdir %>/js', src : 'routes.js', expand: true, cwd: 'src/' }]
},
media: {
files: [{ dest: 'build/media', src : '*.*', expand: true, cwd: 'legacy_/media/' }]
files: [{ dest: 'build/media', src : '*.*', expand: true, cwd: 'media/' }]
},
sampleFiles: {
files: [{ dest: '<%= distdir %>/js', src : '*.js', expand: true, cwd: 'src/sample files/' }]

View File

@@ -1,3 +1,3 @@
<div ng-controller="Umbraco.Editors.GoogleMapsController" class="span7">
<div class="" style="height: 200px;" id="{{model.alias}}_map"></div>
<div class="" style="height: 400px;" id="{{model.alias}}_map"></div>
</div>

View File

@@ -1,6 +1,6 @@
angular.module("umbraco")
.controller("Umbraco.Editors.GoogleMapsController",
function ($rootScope, $scope, notificationsService, $timeout) {
function ($rootScope, $scope, notificationsService, dialogService, $log, $timeout) {
require(
[
'async!http://maps.google.com/maps/api/js?sensor=false'
@@ -16,27 +16,55 @@ angular.module("umbraco")
center: latLng,
mapTypeId: google.maps.MapTypeId[$scope.model.config.mapType]
};
var geocoder = new google.maps.Geocoder();
var map = new google.maps.Map(mapDiv, mapOptions);
var marker = new google.maps.Marker({
map: map,
position: latLng,
draggable: true
});
google.maps.event.addListener(marker, "dragend", function(e){
var newLat = marker.getPosition().lat();
var newLng = marker.getPosition().lng();
//here we will set the value
$scope.model.value = newLat + "," + newLng;
google.maps.event.addListener(map, 'click', function(event) {
//call the notication engine
$rootScope.$apply(function () {
notificationsService.warning("Your dragged a marker to", $scope.model.value);
});
dialogService.mediaPicker({scope: $scope, callback: function(data){
var image = data.selection[0].src;
var latLng = event.latLng;
var marker = new google.maps.Marker({
map: map,
icon: image,
position: latLng,
draggable: true
});
google.maps.event.addListener(marker, "dragend", function(e){
var newLat = marker.getPosition().lat();
var newLng = marker.getPosition().lng();
codeLatLng(marker.getPosition());
//set the model value
$scope.model.value = newLat + "," + newLng;
});
}});
});
function codeLatLng(latLng) {
geocoder.geocode({'latLng': latLng},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var location = results[0].formatted_address;
$rootScope.$apply(function () {
notificationsService.success("Peter just went to: ", location);
});
}
});
}
//hack to hook into tab switching for map resizing
$('a[data-toggle="tab"]').on('shown', function (e) {
google.maps.event.trigger(map, 'resize');

View File

@@ -10,7 +10,7 @@ NOTES:
* Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config
* A new version will invalidate both client and server cache and create new persisted files
-->
<clientDependency version="11" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.UI.CdfLogger, umbraco">
<clientDependency version="12" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.UI.CdfLogger, umbraco">
<fileRegistration defaultProvider="LoaderControlProvider">
<providers>