#1: Removed double negatives in the pfmPopup directive.

This commit is contained in:
Peter Deltchev 2016-01-16 22:16:47 -08:00
parent ffca74f45d
commit 93b447f05c
5 changed files with 16 additions and 15 deletions

View file

@ -25,7 +25,7 @@
<pfm-image-upload set-image="setCover" image="album.cover" />
</div>
<div class="form-row track-selector">
<a pfm-popup="track-selector,right" href="#" class="btn btn-small pull-right btn-info">Add Tracks</a>
<a pfm-popup="track-selector,right" pfm-popup-close-on-click href="#" class="btn btn-small pull-right btn-info">Add Tracks</a>
<label class="strong">Album Tracks</label>
<div id="track-selector" class="pfm-popup">
<ul>

View file

@ -50,7 +50,7 @@
</div>
<div class="row-fluid">
<div class="form-row album span6" ng-class="{'has-error': errors.album_id != null}">
<a pfm-popup="album-selector" href="#" class="btn btn-small">
<a pfm-popup="album-selector" pfm-popup-close-on-click href="#" class="btn btn-small">
Album:
<strong ng-show="selectedAlbum">{{selectedAlbum.title}}</strong>
<strong ng-hide="selectedAlbum">None</strong>
@ -68,7 +68,7 @@
<div class="error">{{errors.album_id}}</div>
</div>
<div class="form-row show-songs span6" ng-show="edit.track_type_id == 2" ng-class="{'has-error': errors.show_song_ids != null}">
<a pfm-popup="song-selector" href="#" class="btn btn-small">Show Songs: <strong>{{selectedSongsTitle}}</strong></a>
<a pfm-popup="song-selector" pfm-popup-close-on-click href="#" class="btn btn-small">Show Songs: <strong>{{selectedSongsTitle}}</strong></a>
<div id="song-selector" class="pfm-popup">
<ul>
<li ng-repeat="song in taxonomies.showSongs" ng-class="{selected: selectedSongs[song.id]}">

View file

@ -5,7 +5,7 @@
<input type="file" onchange="angular.element(this).scope().setImageFile(this)" />
</p>
<div class="btn-group">
<a href="#" pfm-popup="image-selector" class="btn btn-small"><i class="icon-picture"></i> Gallery</a>
<a href="#" pfm-popup="image-selector" pfm-popup-close-on-click class="btn btn-small"><i class="icon-picture"></i> Gallery</a>
<a href="#" pfm-eat-click ng-click="uploadImage()" class="btn btn-info btn-small"><i class="icon-upload"></i> Upload</a>
<a href="#" pfm-eat-click ng-click="clearImage()" class="btn btn-danger btn-small" ng-show="isImageLoaded"><i class="icon-remove"></i></a>
</div>

View file

@ -5,7 +5,6 @@
placeholder="Search&hellip;"
ng-model="searchQuery"
pfm-popup="search-results"
pfm-popup-close-on-click
/>
<div class="search-results pfm-popup" id="search-results">

View file

@ -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 = ->