Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch processing validation #61

Merged
merged 3 commits into from
Sep 22, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Remove enter event on checkboxes to avoid submitting the form
  • Loading branch information
teneightfive committed Sep 18, 2015
commit 6ff8b93ff563614f8d7578ba1f7210e37b9fc114
Binary file modified mtp_cashbook/assets-src/images/box@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mtp_cashbook/assets-src/images/tickbox@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions mtp_cashbook/assets-src/javascripts/modules/moj.select-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
this.$body = $('body');
this.$selectAll = $(this.selector);
this.fieldName = this.$selectAll.data('name');
this.$checks = $('[name="' + this.fieldName + '"]');
this.checksSelector = '[name="' + this.fieldName + '"]';
this.$checks = $(this.checksSelector);
},

bindEvents: function () {
moj.Events.on('SelectAll.render', this.render);
this.$body.on('change', this.selector, this.onSelectAllChange);
this.$body.on('change', this.$checks, this.onCheckChange);
this.$body
.on('change.SelectAll', this.selector, this.onSelectAllChange)
.on('change.SelectAll', this.checksSelector, this.onCheckChange)
.on('keypress.SelectAll', this.checksSelector + ', ' + this.selector, this.onCheckKeypress);
},

onSelectAllChange: function (e) {
Expand Down Expand Up @@ -53,6 +56,13 @@
}
},

onCheckKeypress: function (e) {
if (e.keyCode === 13) {
e.preventDefault();
return false;
}
},

render: function () {
this.$checks.each(function() {
$(this).change();
Expand Down
2 changes: 2 additions & 0 deletions mtp_cashbook/assets-src/stylesheets/elements/_checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ $component: Checkbox;
only screen and (min-device-pixel-ratio: 2) {
+ label {
background-image: url(../images/box@2x.png);
background-size: 20px 20px;
}

&:checked + label {
background-image: url(../images/tickbox@2x.png);
background-size: 20px 20px;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n %}
<div>
<button type="submit" name="submit" value="submit" class="button" id="tour-step6">{% trans "I've credited ticked payments in NOMIS" %}</button>
<button class="button button-secondary" name="cancel" value="cancel" id="tour-step7">{% trans "Back to start" %}</button>
<button type="cancel" class="button button-secondary" name="cancel" value="cancel" id="tour-step7">{% trans "Back to start" %}</button>
</div>