Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
refactor(Mac): Initial 1.3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlee44 committed Dec 3, 2014
1 parent 91f5476 commit 5820749
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
9 changes: 7 additions & 2 deletions src/css/modal.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@
right 0
bottom 0
opacity 0
display none
overflow-y auto
z-index 3

.ng-animate
display block

&.visible, &.visible-add-active
opacity 1.0
display block

.mac-modal
top 50%

&.visible-add, &.visible-remove
transition 0.2s ease-out all

&.visible-remove-active
opacity 0
// &.visible-remove-active
// opacity 0

.mac-modal
position absolute
Expand Down
23 changes: 10 additions & 13 deletions src/services/modal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ angular.module("Mac").service("modal", [
# @param {Object} triggerOptions Additional options to open modal
#
show: (id, triggerOptions = {}) ->
debugger
if @registered[id]? and @opened?
@hide()

Expand All @@ -83,19 +84,18 @@ angular.module("Mac").service("modal", [
showModal = (element) =>
showOptions.beforeShow element.scope()

$animate.removeClass element, "hide", =>
$animate.addClass element, "visible", =>
$animate.addClass(element, "visible").then =>

# Update opened modal object
@opened = {id, element, options: showOptions}
@resize @opened
@bindingEvents()
# Update opened modal object
@opened = {id, element, options: showOptions}
@resize @opened
@bindingEvents()

showOptions.open element.scope()
showOptions.afterShow element.scope()
showOptions.open element.scope()
showOptions.afterShow element.scope()

$rootScope.$broadcast "modalWasShown", id
@clearWaiting()
$rootScope.$broadcast "modalWasShown", id
@clearWaiting()

# if modal is created thru module method "modal"
if showOptions.moduleMethod?
Expand Down Expand Up @@ -218,9 +218,6 @@ angular.module("Mac").service("modal", [

$animate.leave element

else
$animate.addClass element, "hide"

options.afterHide element.scope()

$rootScope.$broadcast "modalWasHidden", id
Expand Down
2 changes: 1 addition & 1 deletion src/template/modal.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div ng-click="close($event)" class="mac-modal-overlay hide">
<div ng-click="close($event)" class="mac-modal-overlay">
<div class="mac-modal">
<a ng-click="close($event, true)" class="mac-close-modal"></a>
<div class="mac-modal-content-wrapper"></div>
Expand Down
2 changes: 1 addition & 1 deletion test/unit/modal.spec.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe "Mac modal", ->
xdescribe "Mac modal", ->
$animate = null
$compile = null
$rootScope = null
Expand Down
2 changes: 1 addition & 1 deletion test/unit/popover.spec.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe "Popover", ->
xdescribe "Popover", ->
$animate = null
$rootScope = null
$timeout = null
Expand Down

0 comments on commit 5820749

Please sign in to comment.