mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 21:18:00 +01:00
Added lots of "track by" and a few more one-time bindings.
This commit is contained in:
parent
cbce336478
commit
dbd46c8dc5
15 changed files with 29 additions and 27 deletions
|
@ -29,18 +29,18 @@
|
||||||
<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>
|
||||||
<li ng-repeat="track in data.tracksDb" ng-class="{selected: trackIds[track.id]}">
|
<li ng-repeat="track in data.tracksDb track by track.id" ng-class="{selected: trackIds[track.id]}">
|
||||||
<a pfm-eat-click href="#" ng-click="toggleTrack(track); $event.stopPropagation();">{{track.title}}</a>
|
<a pfm-eat-click href="#" ng-click="toggleTrack(track); $event.stopPropagation();">{{::track.title}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="album-track-listing" ui-sortable="{handle: '.handle', axis: 'y', forcePlaceholderSizeType: true, update: sortTracks}" ng-model="tracks">
|
<ul class="album-track-listing" ui-sortable="{handle: '.handle', axis: 'y', forcePlaceholderSizeType: true, update: sortTracks}" ng-model="tracks">
|
||||||
<li ng-repeat="track in tracks">
|
<li ng-repeat="track in tracks track by track.id">
|
||||||
<div>
|
<div>
|
||||||
<span class="btn btn-small pull-left handle"><i class="icon-sort"></i></span>
|
<span class="btn btn-small pull-left handle"><i class="icon-sort"></i></span>
|
||||||
<a href="#" class="btn btn-small pull-right btn-danger" ng-click="toggleTrack(track)" pfm-eat-click><i class="icon-remove"></i></a>
|
<a href="#" class="btn btn-small pull-right btn-danger" ng-click="toggleTrack(track)" pfm-eat-click><i class="icon-remove"></i></a>
|
||||||
<span>{{track.title}}</span>
|
<span>{{::track.title}}</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="two-pane-view" ng-class="{open: data.isEditorOpen, closed: !data.isEditorOpen}">
|
<div class="two-pane-view" ng-class="{open: data.isEditorOpen, closed: !data.isEditorOpen}">
|
||||||
<div class="list">
|
<div class="list">
|
||||||
<ul class="account-albums-listing stretch-to-bottom">
|
<ul class="account-albums-listing stretch-to-bottom">
|
||||||
<li ng-repeat="album in albums" ng-class="{selected: album.id == data.selectedAlbum.id}">
|
<li ng-repeat="album in albums track by album.id" ng-class="{selected: album.id == data.selectedAlbum.id}">
|
||||||
<a href="/account/albums/edit/{{album.id}}">
|
<a href="/account/albums/edit/{{album.id}}">
|
||||||
<img pfm-src-loader="album.covers.normal" pfm-src-size="normal" class="image" />
|
<img pfm-src-loader="album.covers.normal" pfm-src-size="normal" class="image" />
|
||||||
<span class="title">{{album.title}}</span>
|
<span class="title">{{album.title}}</span>
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-show="!albums.length" class="empty">
|
<li ng-show="!albums.length" class="empty">
|
||||||
No albums found...
|
No albums found…
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<ul class="playlists stretch-to-bottom">
|
<ul class="playlists stretch-to-bottom">
|
||||||
<li ng-repeat="playlist in playlists">
|
<li ng-repeat="playlist in playlists track by playlist.id">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a href="#" pfm-eat-click class="btn btn-small" ng-click="togglePlaylistPin(playlist)" ng-class="{active: playlist.is_pinned, 'btn-primary': playlist.is_pinned}">
|
<a href="#" pfm-eat-click class="btn btn-small" ng-click="togglePlaylistPin(playlist)" ng-class="{active: playlist.is_pinned, 'btn-primary': playlist.is_pinned}">
|
||||||
<i class="icon-pushpin"></i>
|
<i class="icon-pushpin"></i>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="pagination" ng-show="totalPages > 1">
|
<div class="pagination" ng-show="totalPages > 1">
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-class="{disabled: !prevPage}"><a href="#" ng-click="gotoPage(prevPage);" pfm-eat-click>Prev</a></li>
|
<li ng-class="{disabled: !prevPage}"><a href="#" ng-click="gotoPage(prevPage);" pfm-eat-click>Prev</a></li>
|
||||||
<li ng-repeat="page in pages" ng-class="{active: page == currentPage}">
|
<li ng-repeat="page in pages track by page" ng-class="{active: page == currentPage}">
|
||||||
<a href="#" ng-click="gotoPage(page);" pfm-eat-click>{{page}}</a>
|
<a href="#" ng-click="gotoPage(page);" pfm-eat-click>{{page}}</a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-class="{disabled: !nextPage}"><a href="#" ng-click="gotoPage(nextPage);" pfm-eat-click>Next</a></li>
|
<li ng-class="{disabled: !nextPage}"><a href="#" ng-click="gotoPage(nextPage);" pfm-eat-click>Next</a></li>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="pagination" ng-show="totalPages > 1">
|
<div class="pagination" ng-show="totalPages > 1">
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-class="{disabled: !prevPage}"><a href="#" ng-click="gotoPage(prevPage);" pfm-eat-click>Prev</a></li>
|
<li ng-class="{disabled: !prevPage}"><a href="#" ng-click="gotoPage(prevPage);" pfm-eat-click>Prev</a></li>
|
||||||
<li ng-repeat="page in pages" ng-class="{active: page == currentPage}">
|
<li ng-repeat="page in pages track by page" ng-class="{active: page == currentPage}">
|
||||||
<a href="#" ng-click="gotoPage(page);" pfm-eat-click>{{page}}</a>
|
<a href="#" ng-click="gotoPage(page);" pfm-eat-click>{{page}}</a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-class="{disabled: !nextPage}"><a href="#" ng-click="gotoPage(nextPage);" pfm-eat-click>Next</a></li>
|
<li ng-class="{disabled: !nextPage}"><a href="#" ng-click="gotoPage(nextPage);" pfm-eat-click>Next</a></li>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<li ng-show="resource.comments.length == 0" class="empty">
|
<li ng-show="resource.comments.length == 0" class="empty">
|
||||||
There are no comments yet!
|
There are no comments yet!
|
||||||
</li>
|
</li>
|
||||||
<li ng-repeat="comment in resource.comments">
|
<li ng-repeat="comment in resource.comments track by comment.id">
|
||||||
<img pfm-src-loader="::comment.user.avatars.thumbnail" pfm-src-size="thumbnail" />
|
<img pfm-src-loader="::comment.user.avatars.thumbnail" pfm-src-size="thumbnail" />
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<a ng-href="{{::comment.user.url}}">{{::comment.user.name}}</a>
|
<a ng-href="{{::comment.user.url}}">{{::comment.user.name}}</a>
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="image-selector" class="pfm-popup image-selector">
|
<div id="image-selector" class="pfm-popup image-selector">
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="image in images" ng-click="selectGalleryImage(image)">
|
<li ng-repeat="image in images track by image.id" ng-click="selectGalleryImage(image)">
|
||||||
<img ng-src="{{image.urls.small}}" />
|
<img ng-src="{{::image.urls.small}}" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -60,8 +60,8 @@
|
||||||
<li ng-class="{selected: selectedAlbum == null}">
|
<li ng-class="{selected: selectedAlbum == null}">
|
||||||
<a pfm-eat-click href="#" ng-click="selectAlbum(null);">None</a>
|
<a pfm-eat-click href="#" ng-click="selectAlbum(null);">None</a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-repeat="album in albums" ng-class="{selected: selectedAlbum.id == album.id}">
|
<li ng-repeat="album in albums track by album.id" ng-class="{selected: selectedAlbum.id == album.id}">
|
||||||
<a pfm-eat-click href="#" ng-click="selectAlbum(album);">{{album.title}}</a>
|
<a pfm-eat-click href="#" ng-click="selectAlbum(album);">{{::album.title}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -71,8 +71,8 @@
|
||||||
<a pfm-popup="song-selector" pfm-popup-close-on-click 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 track by song.id" ng-class="{selected: selectedSongs[song.id]}">
|
||||||
<a pfm-eat-click href="#" ng-click="toggleSong(song); $event.stopPropagation();">{{song.title}}</a>
|
<a pfm-eat-click href="#" ng-click="toggleSong(song); $event.stopPropagation();">{{::song.title}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -111,10 +111,10 @@
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label class="strong">Choose a License:</label>
|
<label class="strong">Choose a License:</label>
|
||||||
<ul class="license-grid">
|
<ul class="license-grid">
|
||||||
<li ng-repeat="license in taxonomies.licenses" ng-class="{selected: track.license_id == license.id}">
|
<li ng-repeat="license in ::taxonomies.licenses track by license.id" ng-class="{selected: track.license_id == license.id}">
|
||||||
<div ng-click="track.license_id = license.id; touchModel()">
|
<div ng-click="track.license_id = license.id; touchModel()">
|
||||||
<strong>{{license.title}}</strong>
|
<strong>{{::license.title}}</strong>
|
||||||
<p>{{license.description}}</p>
|
<p>{{::license.description}}</p>
|
||||||
<a href="#" pfm-eat-click class="btn" ng-class="{'btn-primary': track.license_id == license.id, 'disabled': isSaving}">
|
<a href="#" pfm-eat-click class="btn" ng-class="{'btn-primary': track.license_id == license.id, 'disabled': isSaving}">
|
||||||
<span ng-hide="track.license_id == license.id">Select</span>
|
<span ng-hide="track.license_id == license.id">Select</span>
|
||||||
<span ng-show="track.license_id == license.id">Selected</span>
|
<span ng-show="track.license_id == license.id">Selected</span>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<form ng-submit="login.submit()" class="form-horizontal">
|
<form ng-submit="login.submit()" class="form-horizontal">
|
||||||
<ul class="messages" ng-hide="!messages.length">
|
<ul class="messages" ng-hide="!messages.length">
|
||||||
<li ng-repeat="message in messages" class="alert alert-error">
|
<li ng-repeat="message in messages" class="alert alert-error">
|
||||||
{{message}}
|
{{::message}}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="pagination" ng-show="totalPages > 1">
|
<div class="pagination" ng-show="totalPages > 1">
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-class="{disabled: !prevPage}"><a href="#" ng-click="gotoPage(prevPage);" pfm-eat-click>Prev</a></li>
|
<li ng-class="{disabled: !prevPage}"><a href="#" ng-click="gotoPage(prevPage);" pfm-eat-click>Prev</a></li>
|
||||||
<li ng-repeat="page in pages" ng-class="{active: page == currentPage}">
|
<li ng-repeat="page in pages track by page" ng-class="{active: page == currentPage}">
|
||||||
<a href="#" ng-click="gotoPage(page);" pfm-eat-click>{{page}}</a>
|
<a href="#" ng-click="gotoPage(page);" pfm-eat-click>{{page}}</a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-class="{disabled: !nextPage}"><a href="#" ng-click="gotoPage(nextPage);" pfm-eat-click>Next</a></li>
|
<li ng-class="{disabled: !nextPage}"><a href="#" ng-click="gotoPage(nextPage);" pfm-eat-click>Next</a></li>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="btn btn-small dropdown-toggle" ng-show="::auth.isLogged">Add to Playlist</a>
|
<a href="#" class="btn btn-small dropdown-toggle" ng-show="::auth.isLogged">Add to Playlist</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li ng-repeat="playlist in playlists">
|
<li ng-repeat="playlist in playlists track by playlist.id">
|
||||||
<a ng-class="{disabled: playlist.message, 'btn-success': playlist.message}"
|
<a ng-class="{disabled: playlist.message, 'btn-success': playlist.message}"
|
||||||
ng-href="{{::playlist.url}}"
|
ng-href="{{::playlist.url}}"
|
||||||
pfm-eat-click
|
pfm-eat-click
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
</a>
|
</a>
|
||||||
<a class="btn" pfm-eat-click ng-click="clearFilter('genres')"><i class="icon-remove"></i></a>
|
<a class="btn" pfm-eat-click ng-click="clearFilter('genres')"><i class="icon-remove"></i></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li ng-repeat="genre in ::filters.genres.values" ng-class="{selected: query.isIdSelected('genres', genre.id)}">
|
<li ng-repeat="genre in ::filters.genres.values track by genre.id" ng-class="{selected: query.isIdSelected('genres', genre.id)}">
|
||||||
<a class="dont-close" pfm-eat-click href="#" ng-click="toggleListFilter('genres', genre.id); $event.stopPropagation();"><i class="icon-plus"></i></a>
|
<a class="dont-close" pfm-eat-click href="#" ng-click="toggleListFilter('genres', genre.id); $event.stopPropagation();"><i class="icon-plus"></i></a>
|
||||||
<a pfm-eat-click href="#" ng-click="setListFilter('genres', genre.id);">{{::genre.title}}</a>
|
<a pfm-eat-click href="#" ng-click="setListFilter('genres', genre.id);">{{::genre.title}}</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -10,19 +10,19 @@
|
||||||
<p>Please note that you need to publish your tracks after uploading them before they will become available to the public.</p>
|
<p>Please note that you need to publish your tracks after uploading them before they will become available to the public.</p>
|
||||||
|
|
||||||
<ul class="uploads">
|
<ul class="uploads">
|
||||||
<li ng-repeat="upload in data.queue" ng-class="{'uploading': upload.isUploading, 'has-error': upload.error != null, 'is-processing': upload.isProcessing || upload.progress >= 100}" ng-animate="'upload-queue'">
|
<li ng-repeat="upload in data.queue track by $index" ng-class="{'uploading': upload.isUploading, 'has-error': upload.error != null, 'is-processing': upload.isProcessing || upload.progress >= 100}" ng-animate="'upload-queue'">
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
<span ng-show="!upload.success">
|
<span ng-show="!upload.success">
|
||||||
<strong ng-show="upload.isUploading && upload.error == null && upload.progress < 100">Uploading…</strong>
|
<strong ng-show="upload.isUploading && upload.error == null && upload.progress < 100">Uploading…</strong>
|
||||||
<strong ng-show="upload.isProcessing || (upload.isUploading && upload.progress >= 100)">Processing…</strong>
|
<strong ng-show="upload.isProcessing || (upload.isUploading && upload.progress >= 100)">Processing…</strong>
|
||||||
<strong ng-show="upload.error != null">Error</strong>
|
<strong ng-show="upload.error != null">Error</strong>
|
||||||
{{upload.name}} -
|
{{::upload.name}} -
|
||||||
<strong ng-show="upload.error != null">{{upload.error}}</strong>
|
<strong ng-show="upload.error != null">{{upload.error}}</strong>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span ng-show="upload.success">
|
<span ng-show="upload.success">
|
||||||
<a href="/account/tracks/edit/{{upload.trackId}}" class="btn btn-small btn-primary">
|
<a href="/account/tracks/edit/{{::upload.trackId}}" class="btn btn-small btn-primary">
|
||||||
Publish
|
Publish
|
||||||
</a>
|
</a>
|
||||||
{{upload.name}}
|
{{upload.name}}
|
||||||
|
|
|
@ -33,6 +33,7 @@ angular.module('ponyfm').controller "account-albums", [
|
||||||
selectAlbum = (album) -> $scope.data.selectedAlbum = album
|
selectAlbum = (album) -> $scope.data.selectedAlbum = album
|
||||||
|
|
||||||
updateTracks = (tracks) ->
|
updateTracks = (tracks) ->
|
||||||
|
$scope.data.tracksDb.length = 0
|
||||||
$scope.data.tracksDb.push track for track in tracks
|
$scope.data.tracksDb.push track for track in tracks
|
||||||
|
|
||||||
tracks.refresh('published=true&in_album=false').done updateTracks
|
tracks.refresh('published=true&in_album=false').done updateTracks
|
||||||
|
@ -40,6 +41,7 @@ angular.module('ponyfm').controller "account-albums", [
|
||||||
albumsDb = {}
|
albumsDb = {}
|
||||||
|
|
||||||
updateAlbums = (albums) ->
|
updateAlbums = (albums) ->
|
||||||
|
albumsDb.length = 0
|
||||||
$scope.albums.length = 0
|
$scope.albums.length = 0
|
||||||
|
|
||||||
for album in albums
|
for album in albums
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
</h3>
|
</h3>
|
||||||
</li>
|
</li>
|
||||||
<li class="none" ng-show="!playlists.length"><span>no pinned playlists</span></li>
|
<li class="none" ng-show="!playlists.length"><span>no pinned playlists</span></li>
|
||||||
<li class="dropdown" ng-repeat="playlist in playlists" ng-cloak ng-class="{selected: stateIncludes('content.playlist') && $state.params.id == playlist.id}">
|
<li class="dropdown" ng-repeat="playlist in playlists track by playlist.id" ng-cloak ng-class="{selected: stateIncludes('content.playlist') && $state.params.id == playlist.id}">
|
||||||
<a href="{{Helpers::angular('playlist.url')}}" ng-bind="playlist.title"></a>
|
<a href="{{Helpers::angular('playlist.url')}}" ng-bind="playlist.title"></a>
|
||||||
</li>
|
</li>
|
||||||
@else
|
@else
|
||||||
|
|
Loading…
Reference in a new issue