2 name: "blerg.SignupDialog",
4 classes: "blerg-dialog",
10 {tag: "h2", content: "Sign Up"},
11 {name: "spinner", kind: "OldSchoolSpinner", showing: false, style: "position: absolute; top: 8px; right: 8px;"},
12 {kind: "onyx.Groupbox", components: [
13 {kind: "onyx.InputDecorator", components: [
14 {name: "username", kind: "onyx.Input", placeholder: "Username"}
16 {kind: "onyx.InputDecorator", components: [
17 {name: "password", kind: "onyx.Input", placeholder: "Password", type: "password"}
20 {name: "message", tag: "p", content: "No, really, that's all I need. I don't want to send you email. It's too much work to program in email updates. :-P"},
21 {name: "signupError", tag: "p", showing: false, classes: "blerg-error", content: "I couldn't sign you up. That username is already in use, or something went wrong on the backend. *shrug*"},
22 {name: "signupButton", kind: "onyx.Button", content: "Signup", onclick: "signupClick", classes: "onyx-affirmative"},
23 {kind: "onyx.Button", content: "Cancel", onclick: "cancelClick", classes: "onyx-negative"},
24 {name: "api", kind: "blerg.API",
25 onSignupSuccess: "signupSuccess",
26 onSignupFailure: "signupFailure"}
28 signupClick: function() {
29 this.$.signupButton.setDisabled(true);
30 this.$.spinner.show();
31 this.$.spinner.start();
32 this.$.api.signup(this.$.username.getValue(), this.$.password.getValue());
34 cancelClick: function() {
35 this.$.signupError.hide();
36 this.$.message.show();
37 this.$.username.setValue('');
38 this.$.password.setValue('');
41 signupSuccess: function(inSender, inEvent) {
42 this.$.signupButton.setDisabled(false);
43 this.$.spinner.hide();
44 this.$.spinner.stop();
45 this.bubble('onTryLogin', {
46 username: this.$.username.getValue(),
47 password: this.$.password.getValue()
49 window.location.href = '/#' + inEvent.username;
52 signupFailure: function(inSender, inEvent) {
53 this.$.signupButton.setDisabled(false);
54 this.$.spinner.hide();
55 this.$.spinner.stop();
56 this.$.message.hide();
57 this.$.signupError.show();