Add commented-out scrolling code. Return false from click handlers.

This commit is contained in:
Rohan Mitchell
2014-09-12 15:33:02 +10:00
parent 42fccd1bdf
commit dbefd43f07
4 changed files with 13 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
Darkswarm.directive "hubModal", ($modal)->
Darkswarm.directive "hubModal", ($modal, $document)->
restrict: 'E'
replace: true
template: "<a>{{enterprise.name}}</a>"
@@ -6,3 +6,5 @@ Darkswarm.directive "hubModal", ($modal)->
elem.on "click", (ev)=>
ev.stopPropagation()
scope.modalInstance = $modal.open(controller: ctrl, templateUrl: 'hub_modal.html', scope: scope)
#$document.scrollTo 0, 0
false

View File

@@ -1,4 +1,4 @@
Darkswarm.directive "ofnModal", ($modal)->
Darkswarm.directive "ofnModal", ($modal, $document)->
# Generic modal! Uses transclusion so designer-types can do stuff like:
# %ofn-modal
# CONTENT
@@ -17,3 +17,5 @@ Darkswarm.directive "ofnModal", ($modal)->
elem.on "click", =>
transclude scope, (clone)->
scope.modalInstance = $modal.open(controller: ctrl, template: clone, scope: scope)
#$document.scrollTo 0, 0
false

View File

@@ -1,4 +1,4 @@
Darkswarm.directive "producerModal", ($modal)->
Darkswarm.directive "producerModal", ($modal, $document)->
restrict: 'E'
replace: true
template: "<a ng-transclude></a>"
@@ -7,4 +7,5 @@ Darkswarm.directive "producerModal", ($modal)->
elem.on "click", (ev)=>
ev.stopPropagation()
scope.modalInstance = $modal.open(controller: ctrl, templateUrl: 'producer_modal.html', scope: scope)
#$document.scrollTo 0, 0
false

View File

@@ -1,4 +1,4 @@
Darkswarm.factory "MapModal", ($modal, $rootScope)->
Darkswarm.factory "MapModal", ($modal, $rootScope, $document)->
new class MapModal
open: (enterprise)->
scope = $rootScope.$new(true) # Spawn an isolate to contain the enterprise
@@ -7,6 +7,9 @@ Darkswarm.factory "MapModal", ($modal, $rootScope)->
if enterprise.is_distributor
scope.hub = enterprise
$modal.open(templateUrl: "hub_modal.html", scope: scope)
#$document.scrollTo 0, 0
else
scope.producer = enterprise
$modal.open(templateUrl: "map_modal_producer.html", scope: scope)
#$document.scrollTo 0, 0