Merge branch 'master' into roster_refactor

This commit is contained in:
JC Brand 2015-04-21 17:36:13 +02:00
commit 96e8a285b7
5 changed files with 32 additions and 17 deletions

View File

@ -5092,7 +5092,7 @@
*/ */
var $form= this.$('form'), var $form= this.$('form'),
$stanza = $(stanza), $stanza = $(stanza),
$fields; $fields, $input;
$form.empty().append(converse.templates.registration_form({ $form.empty().append(converse.templates.registration_form({
'domain': this.domain, 'domain': this.domain,
'title': this.title, 'title': this.title,
@ -5100,16 +5100,27 @@
})); }));
if (this.form_type == 'xform') { if (this.form_type == 'xform') {
$fields = $stanza.find('field'); $fields = $stanza.find('field');
_.each($fields, $.proxy(function (field) { _.each($fields, function (field) {
$form.append(utils.xForm2webForm.bind(this, $(field), $stanza)); $form.append(utils.xForm2webForm.bind(this, $(field), $stanza));
}, this)); }.bind(this));
} else { } else {
// Show fields // Show fields
_.each(Object.keys(this.fields), $.proxy(function (key) { _.each(Object.keys(this.fields), $.proxy(function (key) {
$form.append('<label>'+key+'</label>'); if (key == "username") {
var $input = $('<input placeholder="'+key+'" name="'+key+'"></input>'); $input = templates.form_username({
if (key === 'password' || key === 'email') { domain: ' @'+this.domain,
$input.attr('type', key); name: key,
type: "text",
label: key,
value: '',
required: 1
});
} else {
$form.append('<label>'+key+'</label>');
$input = $('<input placeholder="'+key+'" name="'+key+'"></input>');
if (key === 'password' || key === 'email') {
$input.attr('type', key);
}
} }
$form.append($input); $form.append($input);
}, this)); }, this));
@ -5185,8 +5196,7 @@
return; return;
} }
var $inputs = $(ev.target).find(':input:not([type=button]):not([type=submit])'), var $inputs = $(ev.target).find(':input:not([type=button]):not([type=submit])'),
iq = $iq({type: "set"}) iq = $iq({type: "set"}).c("query", {xmlns:Strophe.NS.REGISTER});
.c("query", {xmlns:Strophe.NS.REGISTER})
if (this.form_type == 'xform') { if (this.form_type == 'xform') {
iq.c("x", {xmlns: Strophe.NS.XFORM, type: 'submit'}); iq.c("x", {xmlns: Strophe.NS.XFORM, type: 'submit'});
@ -5199,7 +5209,6 @@
iq.c($input.attr('name'), {}, $input.val()); iq.c($input.attr('name'), {}, $input.val());
}); });
} }
converse.connection._addSysHandler(this._onRegisterIQ.bind(this), null, "iq", null, null); converse.connection._addSysHandler(this._onRegisterIQ.bind(this), null, "iq", null, null);
converse.connection.send(iq); converse.connection.send(iq);
this.setFields(iq.tree()); this.setFields(iq.tree());

View File

@ -965,13 +965,15 @@
margin: 5px 0 10px 0; margin: 5px 0 10px 0;
padding-left: 0.5em; } padding-left: 0.5em; }
#conversejs #converse-register .input-group { #conversejs #converse-register .input-group {
table-layout: fixed;
display: table; display: table;
margin: auto; margin: auto;
width: 178px; } width: 178px; }
#conversejs #converse-register .input-group span {
overflow-x: hidden;
text-overflow: ellipsis; }
#conversejs #converse-register .input-group span, #conversejs #converse-register .input-group input[name=username] { #conversejs #converse-register .input-group span, #conversejs #converse-register .input-group input[name=username] {
display: table-cell; } display: table-cell; }
#conversejs #converse-register .input-group input[name=username] {
width: 100%; }
#conversejs .cancel-submit, #conversejs .save-submit { #conversejs .cancel-submit, #conversejs .save-submit {
width: 45%; width: 45%;
margin: 5px 3px 5px 3px; } margin: 5px 3px 5px 3px; }

View File

@ -6,6 +6,8 @@ Changelog
* Add the ability to log in anonymously. [jcbrand] * Add the ability to log in anonymously. [jcbrand]
* Add the ability to log in automatically. [jcbrand] * Add the ability to log in automatically. [jcbrand]
* #370 Unable to register a new user to ejabberd 2.1.11. [gbonvehi]
* #372 Some offline users have a visible empty <dd> in the roster. [floriancargoet]
* #374 Fix collapsed group visibility on page load. [floriancargoet] * #374 Fix collapsed group visibility on page load. [floriancargoet]
0.9.2 (2015-04-09) 0.9.2 (2015-04-09)

View File

@ -1135,15 +1135,17 @@
#converse-register { #converse-register {
.input-group { .input-group {
table-layout: fixed;
display: table; display: table;
margin: auto; margin: auto;
width: 178px; width: 178px;
span {
overflow-x: hidden;
text-overflow: ellipsis;
}
span, input[name=username] { span, input[name=username] {
display: table-cell; display: table-cell;
} }
input[name=username] {
width: 100%;
}
} }
} }

View File

@ -4,8 +4,8 @@
</label> </label>
{[ } ]} {[ } ]}
<div class="input-group"> <div class="input-group">
<input name="{{name}}" type="{{type}}" <input name="{{name}}" type="{{type}}"
{[ if (value) { ]} value="{{value}}" {[ } ]} {[ if (value) { ]} value="{{value}}" {[ } ]}
{[ if (required) { ]} class="required" {[ } ]} /> {[ if (required) { ]} class="required" {[ } ]} />
<span>{{domain}}</span> <span title="{{domain}}">{{domain}}</span>
</div> </div>