Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

updated track validation #492

Merged
merged 1 commit into from
Oct 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions app/settings/edit-profile/edit-profile.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@

processData(vm.userData);

$scope.tracks = vm.tracks;
$scope.$watch('tracks', function watcher() {
if (!tracksValid()) {
toaster.pop('error', "Error", "Please select at least one track.");
}
}, true);
// commenting out since this might come back
// $scope.tracks = vm.tracks;
// $scope.$watch('tracks', function watcher() {
// if (!tracksValid()) {
// toaster.pop('error', "Error", "Please select at least one track.");
// }
// }, true);

ExternalAccountService.getLinkedExternalAccounts(vm.userData.userId).then(function(data) {
vm.linkedExternalAccounts = data;
Expand Down Expand Up @@ -117,6 +118,10 @@
}

function updateProfile() {
if (!vm.tracksValid()) {
toaster.pop('error', "Error", "Please select at least one track.");
return false;
}
vm.profileFormProcessing = true;
vm.userData.tracks = _.reduce(vm.tracks, function(result, isInterested, trackName) {
if (isInterested) {
Expand Down
4 changes: 2 additions & 2 deletions app/settings/edit-profile/edit-profile.jade
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
track-toggle(tracks="vm.tracks")

.save-section
button.tc-btn.tc-btn-primary.tc-btn-s(ng-show="!(vm.editProfile.$invalid || vm.editProfile.$pristine || !vm.tracksValid())", type="submit", tc-busy-button, tc-busy-when="vm.profileFormProcessing" ng-disabled="vm.editProfile.$invalid || vm.editProfile.$pristine", ng-class="{' ': vm.editProfile.$valid, 'disabled': disabled}") Save
button.tc-btn.tc-btn-secondary.tc-btn-s(ng-show="vm.editProfile.$invalid || vm.editProfile.$pristine || !vm.tracksValid()", type="button", disabled="disabled") Save
button.tc-btn.tc-btn-primary.tc-btn-s(ng-show="!(vm.editProfile.$invalid || vm.editProfile.$pristine)", type="submit", tc-busy-button, tc-busy-when="vm.profileFormProcessing" ng-disabled="vm.editProfile.$invalid || vm.editProfile.$pristine", ng-class="{' ': vm.editProfile.$valid, 'disabled': disabled}") Save
button.tc-btn.tc-btn-secondary.tc-btn-s(ng-show="vm.editProfile.$invalid || vm.editProfile.$pristine", type="button", disabled="disabled") Save

.settings-section.skills
.section-info
Expand Down