Anton Shestakov <av6@dwimlabs.net>, Sat, 16 Sep 2017 22:29:17 +0800
Make: use npm update for devel target
package.json says we want coffee-script >= 1.6.1, so that's what `make devel`
should install (the newest version): since .js source is tracked, there's no
risk of running into breaking changes in coffee-script outside of test
environment. But running into such changes during tests is OK and even
potentially desirable.
coffee/forms.coffee
Permissions: -rw-r--r--
class Tram.RegistrationForm extends Backbone.Model validate: (attrs, options) -> @unset('username-errors') @unset('password1-errors') @unset('password2-errors') if (attrs.username ? '').trim() is '' @set('username-errors', ['This field is required.']) if (attrs.password1 ? '') is '' @set('password1-errors', ['This field is required.']) if (attrs.password1 ? '') isnt (attrs.password2 ? '') @set('password2-errors', ['Passwords must match.']) else if (attrs.password2 ? '') is '' @set('password2-errors', ['This field is required.']) return @has('username-errors') or @has('password1-errors') or @has('password2-errors') class Tram.ProfileForm extends Backbone.Model validate: (attrs, options) -> file = $('#avatar').get(0).files[0] if not file.type.match('image/.*')? ae.push("File doesn't look like an image.") ae.push('File is too big.') @set('avatar-errors', ae) return @has('avatar-errors') class Tram.ConnectionForm extends Backbone.Model validate: (attrs, options) -> @unset('username-errors') @unset('password-errors') if (attrs.username ? '').trim() is '' @set('username-errors', ['This field is required.']) if (attrs.password ? '') is '' @set('password-errors', ['This field is required.']) return @has('username-errors') or @has('password-errors') $form.find('input').on 'keydown', (e) -> if (not @required or @value isnt '') and e.keyCode is 13 index = $form.find('input').index(@) $next = $form.find('input').eq(index + 1) $form.find('button').trigger('click')