#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" /> <pfm-image-upload set-image="setCover" image="album.cover" />
</div> </div>
<div class="form-row track-selector"> <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> <label class="strong">Album Tracks</label>
<div id="track-selector" class="pfm-popup"> <div id="track-selector" class="pfm-popup">
<ul> <ul>

View file

@ -50,7 +50,7 @@
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="form-row album span6" ng-class="{'has-error': errors.album_id != null}"> <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: Album:
<strong ng-show="selectedAlbum">{{selectedAlbum.title}}</strong> <strong ng-show="selectedAlbum">{{selectedAlbum.title}}</strong>
<strong ng-hide="selectedAlbum">None</strong> <strong ng-hide="selectedAlbum">None</strong>
@ -68,7 +68,7 @@
<div class="error">{{errors.album_id}}</div> <div class="error">{{errors.album_id}}</div>
</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}"> <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"> <div id="song-selector" class="pfm-popup">
<ul> <ul>
<li ng-repeat="song in taxonomies.showSongs" ng-class="{selected: selectedSongs[song.id]}"> <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)" /> <input type="file" onchange="angular.element(this).scope().setImageFile(this)" />
</p> </p>
<div class="btn-group"> <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="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> <a href="#" pfm-eat-click ng-click="clearImage()" class="btn btn-danger btn-small" ng-show="isImageLoaded"><i class="icon-remove"></i></a>
</div> </div>

View file

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

View file

@ -27,7 +27,7 @@ angular.module('ponyfm').directive 'pfmPopup', () ->
$element = $ element $element = $ element
$positionParent = null $positionParent = null
open = false open = false
dontCloseOnClick = attrs.pfmPopupCloseOnClick? closeOnClick = attrs.pfmPopupCloseOnClick?
close = () -> close = () ->
@ -36,16 +36,18 @@ angular.module('ponyfm').directive 'pfmPopup', () ->
documentClickHandler = (event) -> documentClickHandler = (event) ->
console.log(event) if !open
debugger return
return if !open
if (dontCloseOnClick and if (closeOnClick)
(event.target.id == elementId or close()
$(event.target).parents("##{elementId}").size())
)
return true 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() close()
return true return true