Anton Shestakov <av6@dwimlabs.net>, Wed, 01 Nov 2017 00:50:57 +0800
Makefile: use file targets more, results in incremental building
Less work to do when only some files get changed, but more work when building
from scratch. But, multiple compilers can run in parallel.
coffee/register.coffee
Permissions: -rw-r--r--
window.clientState = new Tram.ClientState() window.progressApp = new Tram.ProgressApp(el: $('[data-app="progress"]'), model: clientState) window.regForm = new Tram.RegistrationForm() window.profileForm = new Tram.ProfileForm() clientState.set('progress', 0) X.register(regForm.get('username').trim(), regForm.get('password1')) if not profileForm.isValid() fullname: profileForm.get('fullname').trim() nickname: profileForm.get('nickname').trim() clientState.set('progress', 100) $('[data-step="profile"]').addClass('uk-hidden') clientState.unset('progress') console.warn('profile 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) clientState.set('progress', 0) X.savevCard(data, okcb, failcb) reader.readAsDataURL(file) clientState.set('progress', 0) X.savevCard(data, okcb, failcb) window.regRivet = rivets.bind($('[data-form="registration"]'), form: regForm, register: registerfn) window.profileRivet = rivets.bind($('[data-form="profile"]'), form: profileForm, save: savefn, cancel: cancelfn) window.X = new Tram.XMPPInterface() $('[data-step="registration"]').removeClass('uk-hidden') $('[data-step="registration"]').addClass('uk-hidden') $('[data-msg="registration-closed"]').removeClass('uk-hidden') regForm.set('username-errors', ['A user with this username already exists.']) $('[data-msg="registration-failed"]').removeClass('uk-hidden') profileForm.set('nickname', regForm.get('username').trim()) $('[data-step="profile"]').removeClass('uk-hidden') X.on 'status', (status) -> when Strophe.Status.REGISTERED clientState.set('progress', 50) when Strophe.Status.CONNECTED clientState.set('progress', 100) clientState.unset('progress') $('[data-form="registration"], [data-form="profile"]').streamline()