|
@@ -55,6 +55,7 @@ function GameCtrl($scope, Taboo) {
|
|
|
|
|
|
function ContributeCtrl($scope, $http, $timeout) {
|
|
function ContributeCtrl($scope, $http, $timeout) {
|
|
$scope.submitting = false;
|
|
$scope.submitting = false;
|
|
|
|
+ $scope.exists = false;
|
|
|
|
|
|
function init() {
|
|
function init() {
|
|
$scope.card = {
|
|
$scope.card = {
|
|
@@ -63,6 +64,22 @@ function ContributeCtrl($scope, $http, $timeout) {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function check() {
|
|
|
|
+ $http.get(jsRoutes.controllers.Cards.exists($scope.card.word).url)
|
|
|
|
+ .then(function(data) {
|
|
|
|
+ $scope.exists = data.data.exists;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var promise = null;
|
|
|
|
+
|
|
|
|
+ $scope.check = function() {
|
|
|
|
+ if(promise != null) {
|
|
|
|
+ $timeout.cancel(promise);
|
|
|
|
+ }
|
|
|
|
+ promise = $timeout(check, 200);
|
|
|
|
+ }
|
|
|
|
+
|
|
$scope.submit = function() {
|
|
$scope.submit = function() {
|
|
if($scope.submitting) return;
|
|
if($scope.submitting) return;
|
|
$scope.submitting = true;
|
|
$scope.submitting = true;
|