diff --git a/app/models/Commands/EditTrackCommand.php b/app/models/Commands/EditTrackCommand.php index 084a7dd0..656bb9dd 100644 --- a/app/models/Commands/EditTrackCommand.php +++ b/app/models/Commands/EditTrackCommand.php @@ -52,7 +52,7 @@ if ($isVocal) $rules['lyrics'] = 'required'; - if ($this->_input['track_type_id'] == 2) + if (isset($this->_input['track_type_id']) && $this->_input['track_type_id'] == 2) $rules['show_song_ids'] = 'required|exists:show_songs,id'; $validator = \Validator::make($this->_input, $rules); @@ -63,8 +63,8 @@ $track = $this->_track; $track->title = $this->_input['title']; $track->released_at = $this->_input['released_at'] != "" ? strtotime($this->_input['released_at']) : null; - $track->description = $this->_input['description']; - $track->lyrics = $this->_input['lyrics']; + $track->description = isset($this->_input['description']) ? $this->_input['description'] : ''; + $track->lyrics = isset($this->_input['lyrics']) ? $this->_input['lyrics'] : ''; $track->license_id = $this->_input['license_id']; $track->genre_id = $this->_input['genre_id']; $track->track_type_id = $this->_input['track_type_id']; diff --git a/public/scripts/app/controllers/account-track.coffee b/public/scripts/app/controllers/account-track.coffee index f9ae1b10..ee52ae76 100644 --- a/public/scripts/app/controllers/account-track.coffee +++ b/public/scripts/app/controllers/account-track.coffee @@ -93,7 +93,7 @@ angular.module('ponyfm').controller "account-track", [ return if value == null if typeof(value) == 'object' formData.append name, value, value.name - else + else if value != null formData.append name, value if $scope.edit.track_type_id == 2 @@ -105,6 +105,7 @@ angular.module('ponyfm').controller "account-track", [ xhr.send formData tracks.getEdit($state.params.track_id).done (track) -> + console.log (track.album_id); $scope.edit = id: track.id title: track.title diff --git a/public/scripts/app/filters/pfm-date.js b/public/scripts/app/filters/pfm-date.js index f0f4f637..a226d89e 100644 --- a/public/scripts/app/filters/pfm-date.js +++ b/public/scripts/app/filters/pfm-date.js @@ -178,6 +178,10 @@ angular.module('ponyfm').filter('pfmdate', [ parts = [], fn, match; + if (typeof(date) == 'object' && date.date) { + date = date.date; + } + format = format || 'mediumDate'; format = $locale.DATETIME_FORMATS[format] || format; if (isString(date)) { @@ -192,10 +196,6 @@ angular.module('ponyfm').filter('pfmdate', [ date = new Date(date); } - if (typeof(date) == 'object' && date.date) { - date = new Date(date.date); - } - if (!isDate(date)) { return date; }