--- a/coffee/register.coffee Fri Mar 25 10:16:40 2016 +0800
+++ b/coffee/register.coffee Sun Mar 27 11:21:22 2016 +0800
+class RegistrationData 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 ProfileData extends Backbone.Model
+window.regData = new RegistrationData()
+window.vcData = new ProfileData()
+ X.register(regData.get('username').trim(), regData.get('password1'))
+ fullname: vcData.get('fullname').trim()
+ nickname: vcData.get('nickname').trim()
+ console.debug('vcard is set!', arguments)
+ $('[data-step="vcard"]').addClass('uk-hidden')
+ console.warn('vcard is NOT set!', arguments)
+ $('[data-msg="save-failed"]').removeClass('uk-hidden')
+ file = $('#avatar').get(0).files[0]
+ reader = new FileReader()
+ _(data).extend(avatar: reader.result)
+ X.savevCard(data, okcb, failcb)
+ reader.readAsDataURL(file)
+ X.savevCard(data, okcb, failcb)
+window.regRivet = rivets.bind($('[data-form="registration"]'), data: regData, register: registerfn)
+window.vcRivet = rivets.bind($('[data-form="vcard"]'), data: vcData, save: savefn)
window.X = new Tram.XMPPInterface()
- Tram.validation.setError($('#username'), 'A user with this username already exists.')
+ regData.set('username-errors', ['A user with this username already exists.'])
- $('#nickname').val($('#username').val())
+ vcData.set('nickname', regData.get('username').trim())
$('[data-step="vcard"]').removeClass('uk-hidden')
$form.find('button').trigger('click')
-$('[data-form="registration"] button').on 'click', ->
- Tram.validation.unsetError($('#username, #password1, #password2'))
- ok &= Tram.validation.validateRequired($('#username'), true)
- ok &= Tram.validation.validatePasswords($('#password1'), $('#password2'))
- ok &= Tram.validation.validateRequired($('#password1'))
- ok &= Tram.validation.validateRequired($('#password2'))
- X.register($('#username').val().trim(), $('#password1').val())
-$('[data-form="vcard"] button').on 'click', ->
- fullname: $('#fullname').val()
- nickname: $('#nickname').val()
- console.debug('vcard is set!', arguments)
- $('[data-step="vcard"]').addClass('uk-hidden')
- console.warn('vcard is NOT set!', arguments)
- $('[data-msg="save-failed"]').removeClass('uk-hidden')
- file = $('#avatar').get(0).files[0]
- reader = new FileReader()
- _(data).extend(avatar: reader.result)
- X.savevCard(data, okcb, failcb)
- reader.readAsDataURL(file)
- X.savevCard(data, okcb, failcb)
--- a/js/register.js Fri Mar 25 10:16:40 2016 +0800
+++ b/js/register.js Sun Mar 27 11:21:22 2016 +0800
// Generated by CoffeeScript 1.10.0
+ var ProfileData, RegistrationData, registerfn, savefn,
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ hasProp = {}.hasOwnProperty;
+ RegistrationData = (function(superClass) {
+ extend(RegistrationData, superClass);
+ function RegistrationData() {
+ return RegistrationData.__super__.constructor.apply(this, arguments);
+ RegistrationData.prototype.defaults = {
+ RegistrationData.prototype.validate = function(attrs, options) {
+ var ref, ref1, ref2, ref3, ref4;
+ this.unset('username-errors');
+ this.unset('password1-errors');
+ this.unset('password2-errors');
+ if (((ref = attrs.username) != null ? ref : '').trim() === '') {
+ this.set('username-errors', ['This field is required.']);
+ if (((ref1 = attrs.password1) != null ? ref1 : '') === '') {
+ this.set('password1-errors', ['This field is required.']);
+ if (((ref2 = attrs.password1) != null ? ref2 : '') !== ((ref3 = attrs.password2) != null ? ref3 : '')) {
+ this.set('password2-errors', ['Passwords must match.']);
+ } else if (((ref4 = attrs.password2) != null ? ref4 : '') === '') {
+ this.set('password2-errors', ['This field is required.']);
+ return this.has('username-errors') || this.has('password1-errors') || this.has('password2-errors');
+ return RegistrationData;
+ ProfileData = (function(superClass) {
+ extend(ProfileData, superClass);
+ function ProfileData() {
+ return ProfileData.__super__.constructor.apply(this, arguments);
+ ProfileData.prototype.defaults = {
+ window.regData = new RegistrationData();
+ window.vcData = new ProfileData();
+ registerfn = function() {
+ if (regData.isValid()) {
+ return X.register(regData.get('username').trim(), regData.get('password1'));
+ var data, failcb, file, okcb, reader;
+ fullname: vcData.get('fullname').trim(),
+ nickname: vcData.get('nickname').trim()
+ console.debug('vcard is set!', arguments);
+ $('[data-step="vcard"]').addClass('uk-hidden');
+ return location.href = '/';
+ console.warn('vcard is NOT set!', arguments);
+ return $('[data-msg="save-failed"]').removeClass('uk-hidden');
+ file = $('#avatar').get(0).files[0];
+ reader = new FileReader();
+ reader.onloadend = function() {
+ return X.savevCard(data, okcb, failcb);
+ return reader.readAsDataURL(file);
+ return X.savevCard(data, okcb, failcb);
+ window.regRivet = rivets.bind($('[data-form="registration"]'), {
+ window.vcRivet = rivets.bind($('[data-form="vcard"]'), {
window.X = new Tram.XMPPInterface();
X.on('register', function() {
X.on('conflict', function() {
- return Tram.validation.setError($('#username'), 'A user with this username already exists.');
+ return regData.set('username-errors', ['A user with this username already exists.']);
X.on('notacceptable', function() {
X.on('connected', function() {
- $('#nickname').val($('#username').val());
+ vcData.set('nickname', regData.get('username').trim());
$('[data-step="vcard"]').removeClass('uk-hidden');
return $('#fullname').focus();
- $('[data-form="registration"] button').on('click', function() {
- Tram.validation.unsetError($('#username, #password1, #password2'));
- ok &= Tram.validation.validateRequired($('#username'), true);
- ok &= Tram.validation.validatePasswords($('#password1'), $('#password2'));
- ok &= Tram.validation.validateRequired($('#password1'));
- ok &= Tram.validation.validateRequired($('#password2'));
- return X.register($('#username').val().trim(), $('#password1').val());
- $('[data-form="vcard"] button').on('click', function() {
- var data, failcb, file, okcb, reader;
- fullname: $('#fullname').val(),
- nickname: $('#nickname').val()
- console.debug('vcard is set!', arguments);
- $('[data-step="vcard"]').addClass('uk-hidden');
- return location.href = '/';
- console.warn('vcard is NOT set!', arguments);
- return $('[data-msg="save-failed"]').removeClass('uk-hidden');
- file = $('#avatar').get(0).files[0];
- reader = new FileReader();
- reader.onloadend = function() {
- return X.savevCard(data, okcb, failcb);
- return reader.readAsDataURL(file);
- return X.savevCard(data, okcb, failcb);
//# sourceMappingURL=register.js.map
--- a/js/register.js.map Fri Mar 25 10:16:40 2016 +0800
+++ b/js/register.js.map Sun Mar 27 11:21:22 2016 +0800
- "mappings": ";AAAA;EAAA,MAAM,CAAC,CAAP,GAAe,IAAA,IAAI,CAAC,aAAL,CAAA;;EAGf,CAAC,CAAC,EAAF,CAAK,UAAL,EAAiB,SAAA;WACf,CAAA,CAAE,4BAAF,CAA+B,CAAC,WAAhC,CAA4C,WAA5C;EADe,CAAjB;;EAIA,CAAC,CAAC,EAAF,CAAK,YAAL,EAAmB,SAAA;IACjB,CAAC,CAAC,kBAAF,CAAA;WACA,CAAA,CAAE,4BAAF,CAA+B,CAAC,QAAhC,CAAyC,WAAzC;EAFiB,CAAnB;;EAKA,CAAC,CAAC,EAAF,CAAK,UAAL,EAAiB,SAAA;WACf,CAAA,CAAE,kCAAF,CAAqC,CAAC,WAAtC,CAAkD,WAAlD;EADe,CAAjB;;EAIA,CAAC,CAAC,EAAF,CAAK,UAAL,EAAiB,SAAA;WACf,IAAI,CAAC,UAAU,CAAC,QAAhB,CAAyB,CAAA,CAAE,WAAF,CAAzB,EAAyC,2CAAzC;EADe,CAAjB;;EAIA,CAAC,CAAC,EAAF,CAAK,eAAL,EAAsB,SAAA;WACpB,CAAA,CAAE,kCAAF,CAAqC,CAAC,WAAtC,CAAkD,WAAlD;EADoB,CAAtB;;EAIA,CAAC,CAAC,EAAF,CAAK,WAAL,EAAkB,SAAA;IAChB,CAAA,CAAE,WAAF,CAAc,CAAC,GAAf,CAAmB,CAAA,CAAE,WAAF,CAAc,CAAC,GAAf,CAAA,CAAnB;IACA,CAAA,CAAE,qBAAF,CAAwB,CAAC,WAAzB,CAAqC,WAArC;WACA,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AAW,UAAX,EAAuB,OAAO,CAAC,GAAR,CAAY,UAAZ,CAAuB,CAAC,IAAxB,CAAA,CAAvB;IACA,CAAA,CAAE,qBAAF,CAAwB,CAAC,WAAzB,CAAqC,WAArC;WACA,CAAA,CAAE,WAAF,CAAc,CAAC,KAAf,CAAA;EAHgB,CAAlB;;EAMA,CAAC,CAAC,iBAAF,CAAA;;EAGA,CAAA,CAAE,iDAAF,CAAoD,CAAC,IAArD,CAA0D,SAAA;AACxD,QAAA;IAAA,KAAA,GAAQ,CAAA,CAAE,IAAF;WACR,KAAK,CAAC,IAAN,CAAW,OAAX,CAAmB,CAAC,EAApB,CAAuB,SAAvB,EAAkC,SAAC,CAAD;AAChC,UAAA;MAAA,IAAG,CAAC,CAAI,IAAC,CAAA,QAAL,IAAiB,IAAC,CAAA,KAAD,KAAY,EAA9B,CAAA,IAAsC,CAAC,CAAC,OAAF,KAAa,EAAtD;QACE,CAAC,CAAC,cAAF,CAAA;QACA,KAAA,GAAQ,KAAK,CAAC,IAAN,CAAW,OAAX,CAAmB,CAAC,KAApB,CAA0B,IAA1B;QACR,KAAA,GAAQ,KAAK,CAAC,IAAN,CAAW,OAAX,CAAmB,CAAC,EAApB,CAAuB,KAAA,GAAQ,CAA/B;QACR,IAAG,KAAK,CAAC,MAAN,KAAkB,CAArB;iBACE,KAAK,CAAC,KAAN,CAAA,EADF;SAAA,MAAA;iBAGE,KAAK,CAAC,IAAN,CAAW,QAAX,CAAoB,CAAC,OAArB,CAA6B,OAA7B,EAHF;SAJF;;IADgC,CAAlC;EAFwD,CAA1D;AAnGA"
\ No newline at end of file
--- a/register.html Fri Mar 25 10:16:40 2016 +0800
+++ b/register.html Sun Mar 27 11:21:22 2016 +0800
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.3/backbone-min.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/rivets/0.8.1/rivets.bundled.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.25.0/js/uikit.min.js"></script>
<script src="/vendor/strophejs/strophe.min.js"></script>
<script src="/vendor/strophejs-plugins/register/strophe.register.js"></script>
<div class="uk-form-row">
<label for="username" class="uk-form-label">Username</label>
<div class="uk-form-controls">
- <input id="username" type="text" class="uk-width-1-1" value="" required autofocus>
+ <input id="username" type="text" class="uk-width-1-1" required autofocus
+ rv-value="data:username" rv-class-uk-form-danger="data:username-errors">
+ <div class="uk-text-danger" rv-each-error="data:username-errors">{ error }</div>
<div class="uk-form-row">
<label for="password1" class="uk-form-label">Password</label>
<div class="uk-form-controls">
- <input id="password1" type="password" class="uk-width-1-1" value="" required>
+ <input id="password1" type="password" class="uk-width-1-1" required
+ rv-value="data:password1" rv-class-uk-form-danger="data:password1-errors">
+ <div class="uk-text-danger" rv-each-error="data:password1-errors">{ error }</div>
<div class="uk-form-row">
<label for="password2" class="uk-form-label">Confirmation</label>
<div class="uk-form-controls">
- <input id="password2" type="password" class="uk-width-1-1" value="" required>
+ <input id="password2" type="password" class="uk-width-1-1" required
+ rv-value="data:password2" rv-class-uk-form-danger="data:password2-errors">
+ <div class="uk-text-danger" rv-each-error="data:password2-errors">{ error }</div>
<div class="uk-form-row">
<div class="uk-form-controls">
<div class="uk-alert uk-alert-danger uk-hidden" data-msg="registration-failed">Unspecified error, sorry.</div>
- <button type="button" class="uk-button uk-button-primary">Register</button>
+ <button type="button" class="uk-button uk-button-primary" rv-on-click="register">Register</button>
<a class="uk-float-right uk-button uk-button-link" href="/">Log in</a>
<div class="uk-form-row">
<label for="fullname" class="uk-form-label">Full Name</label>
<div class="uk-form-controls">
- <input id="fullname" class="uk-width-1-1" type="text" value="">
+ <input id="fullname" class="uk-width-1-1" type="text" rv-value="data:fullname">
<div class="uk-form-row">
<label for="nickname" class="uk-form-label">Nickname</label>
<div class="uk-form-controls">
- <input id="nickname" class="uk-width-1-1" type="text" value="">
+ <input id="nickname" class="uk-width-1-1" type="text" rv-value="data:nickname">
<div class="uk-form-row">
<div class="uk-form-row">
<div class="uk-form-controls">
- <button class="uk-button uk-button-primary">Save</button>
+ <button class="uk-button uk-button-primary" rv-on-click="save">Save</button>
<script src='/js/tram.js'></script>
- <script src='/js/validation.js'></script>
+ <script src='/js/rivets.js'></script>
<script src='/js/xmpp.js'></script>
<script src='/config.js'></script>
<script src='/js/register.js'></script>