Skip to content

Commit

Permalink
Merge pull request #55 from Kovah/dev
Browse files Browse the repository at this point in the history
Improve submit disabling with form check (#53)
  • Loading branch information
Kovah authored Jul 2, 2019
2 parents 409dc79 + 6ecf8bf commit 540f1e7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.15.0
27 changes: 19 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ branches:
only:
- master

language: php
php:
- '7.1.3'
- '7.2'
- '7.3'
stages:
- test-backend
- test-frontend

install:
- cp .env.example .env
- composer install
jobs:
include:
- stage: test-backend
language: php
php:
- '7.1.3'
- '7.2'
- '7.3'
install:
- cp .env.example .env
- composer install

- stage: test-frontend
language: node_js
node_js:
- 'lts/*'
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"scripts": {
"dev": "grunt dev",
"build": "grunt build"
"build": "grunt build",
"test": "grunt build"
},
"devDependencies": {
"autoprefixer": "^8.6.5",
Expand Down
9 changes: 8 additions & 1 deletion resources/assets/js/components/LoadingButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ export default class LoadingButton {

constructor ($el) {
this.$el = $el;
this.$form = this.$el.form;

this.$el.addEventListener('click', this.onClick.bind(this))
}

onClick () {
this.$el.disabled = true;
if (this.formIsValid()) {
this.$el.disabled = true;
}
}

formIsValid() {
return this.$form.checkValidity();
}
}

0 comments on commit 540f1e7

Please sign in to comment.