Просмотр исходного кода

Drop alert for thanking contributions

Thomas Dy 11 лет назад
Родитель
Сommit
6bc78a9648
2 измененных файлов с 6 добавлено и 2 удалено
  1. 5 2
      public/javascripts/main.js
  2. 1 0
      public/partials/contribute.html

+ 5 - 2
public/javascripts/main.js

@@ -48,7 +48,7 @@ function GameCtrl($scope, Taboo) {
   $scope.game = Taboo;
 }
 
-function ContributeCtrl($scope, $http) {
+function ContributeCtrl($scope, $http, $timeout) {
   $scope.submitting = false;
 
   function init() {
@@ -64,7 +64,10 @@ function ContributeCtrl($scope, $http) {
     $http.post(jsRoutes.controllers.Cards.add().url, $scope.card)
       .then(function() {
         $scope.submitting = false;
-        alert("Thank you for your contribution!");
+        $scope.thanks = true;
+        $timeout(function() {
+          $scope.thanks = false;
+        }, 3000);
         init();
         $('#inputWord').focus();
       });

+ 1 - 0
public/partials/contribute.html

@@ -23,6 +23,7 @@
         <input type="text" ng-model="card.taboos[4]" placeholder="Taboo Word" required>
         <hr>
         <input ng-disabled="submitting" class="btn btn-primary" type="submit" value="{{submitting ? 'Submitting...' : 'Submit'}}">
+        <span ng-show="thanks">Thank you!</span>
       </form>
     </div>
     <div class="span4">