Commit 5cd9fd4e92b477fd49d644bdfd0ee23fb5f5eef0
1 parent
062ba87a4c
Exists in
master
try to prevent user from submitting blank edit
Showing 3 changed files with 8 additions and 7 deletions Side-by-side Diff
scripts/CardGridController.js
View file @
5cd9fd4
1 | 1 | angular.module('flashy.CardGridController', ['ui.router', 'ngAnimate', 'ngWebSocket', 'flashy.DeckFactory']).CardGridController = |
2 | 2 | function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, $interval, UserService, Flashcard, Deck) { |
3 | 3 | sectionId = parseInt($stateParams.sectionId); |
4 | + if (!UserService.isInSection(sectionId)) $state.go('addclass'); | |
4 | 5 | $scope.cards = []; // all cards |
5 | 6 | $scope.cardCols = null; // organized data |
6 | 7 | $scope.affectedCards = []; // cards affected by a position change move |
7 | 8 | |
... | ... | @@ -144,11 +145,11 @@ |
144 | 145 | $scope.editCardFormattedText = card.formatted_text; |
145 | 146 | console.log(card); |
146 | 147 | $('#editModal').openModal(card.editModalOptions); |
147 | - | |
148 | 148 | }; |
149 | 149 | |
150 | 150 | $scope.saveEditChanges = function() { |
151 | 151 | if (!$scope.currentEditingCard) return; |
152 | + if ($('#edit-card-input').text().length == 0) return; | |
152 | 153 | var myCard = { |
153 | 154 | 'text': $('#edit-card-input').text(), |
154 | 155 | 'mask': $scope.editCardBlanks, |
scripts/CardListController.js
View file @
5cd9fd4
1 | 1 | angular.module('flashy.CardListController', ['ui.router', 'angular.filter', 'ngSanitize', 'flashy.DeckFactory']). |
2 | - controller('CardListController', function($scope, $rootScope, $state, $http, $stateParams, Flashcard, Deck) { | |
2 | + controller('CardListController', function($scope, $rootScope, $state, $http, $stateParams, Flashcard, UserService, Deck) { | |
3 | 3 | // cards array |
4 | 4 | sectionId = parseInt($stateParams.sectionId); |
5 | + if (!UserService.isInSection(sectionId)) $state.go('addclass'); | |
5 | 6 | $scope.deck = new Deck(sectionId, { |
6 | 7 | cardPullCallback: function(card) { |
7 | 8 | Materialize.toast('Pulled!', 3000); |
scripts/FeedController.js
View file @
5cd9fd4
... | ... | @@ -266,12 +266,11 @@ |
266 | 266 | $scope.cards = data.map(function(card) { |
267 | 267 | return new Flashcard(card, $scope.deck); |
268 | 268 | }); |
269 | - $scope.refreshLayout().then(function() { | |
270 | - $timeout($scope.refreshColumnWidth).then(function() { | |
271 | - $scope.showGrid = true; | |
272 | - }); | |
273 | - console.log('layout done'); | |
269 | + $scope.refreshLayout(); | |
270 | + $timeout($scope.refreshColumnWidth).then(function() { | |
271 | + $scope.showGrid = true; | |
274 | 272 | }); |
273 | + console.log('layout done'); | |
275 | 274 | }); |
276 | 275 | |
277 | 276 | }); |