diff --git a/public/templates/account/album.html b/public/templates/account/album.html index 1b41c092..aa6292b3 100644 --- a/public/templates/account/album.html +++ b/public/templates/account/album.html @@ -25,7 +25,7 @@
- Add Tracks + Add Tracks
    diff --git a/public/templates/account/track.html b/public/templates/account/track.html index 66a263df..dc4328d0 100644 --- a/public/templates/account/track.html +++ b/public/templates/account/track.html @@ -50,7 +50,7 @@
- Show Songs: {{selectedSongsTitle}} + Show Songs: {{selectedSongsTitle}}
  • diff --git a/public/templates/directives/image-upload.html b/public/templates/directives/image-upload.html index 00e5f2e5..ececa03a 100644 --- a/public/templates/directives/image-upload.html +++ b/public/templates/directives/image-upload.html @@ -5,7 +5,7 @@

    diff --git a/public/templates/directives/search.html b/public/templates/directives/search.html index 5455cb96..f2ebdcae 100644 --- a/public/templates/directives/search.html +++ b/public/templates/directives/search.html @@ -5,7 +5,6 @@ placeholder="Search…" ng-model="searchQuery" pfm-popup="search-results" - pfm-popup-close-on-click />
    diff --git a/resources/assets/scripts/app/directives/popup.coffee b/resources/assets/scripts/app/directives/popup.coffee index 25ca462d..d1f4311e 100644 --- a/resources/assets/scripts/app/directives/popup.coffee +++ b/resources/assets/scripts/app/directives/popup.coffee @@ -27,7 +27,7 @@ angular.module('ponyfm').directive 'pfmPopup', () -> $element = $ element $positionParent = null open = false - dontCloseOnClick = attrs.pfmPopupCloseOnClick? + closeOnClick = attrs.pfmPopupCloseOnClick? close = () -> @@ -36,18 +36,20 @@ angular.module('ponyfm').directive 'pfmPopup', () -> documentClickHandler = (event) -> - console.log(event) - debugger - return if !open + if !open + return - if (dontCloseOnClick and - (event.target.id == elementId or - $(event.target).parents("##{elementId}").size()) - ) + if (closeOnClick) + close() return true - close() - return true + # Based on: https://stackoverflow.com/a/4660738/3225811 + else if event.target.id == elementId or $(event.target).parents("##{elementId}").size() + return true + + else + close() + return true calculatePosition = ->