Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
69ccdc9a
Commit
69ccdc9a
authored
Nov 13, 2014
by
Guillermo Bonvehí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more field types to MUC config
Added support for fixed, jid-multi and list-multi types.
parent
572b3e8d
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
13 deletions
+53
-13
converse.js
converse.js
+36
-7
css/converse.css
css/converse.css
+3
-0
main.js
main.js
+2
-1
src/templates.js
src/templates.js
+4
-2
src/templates/field.html
src/templates/field.html
+5
-1
src/templates/form_select.html
src/templates/form_select.html
+1
-1
src/templates/form_textarea.html
src/templates/form_textarea.html
+1
-0
src/templates/select_option.html
src/templates/select_option.html
+1
-1
No files found.
converse.js
View file @
69ccdc9a
...
@@ -2394,13 +2394,17 @@
...
@@ -2394,13 +2394,17 @@
$fields
=
$stanza
.
find
(
'
field
'
),
$fields
=
$stanza
.
find
(
'
field
'
),
title
=
$stanza
.
find
(
'
title
'
).
text
(),
title
=
$stanza
.
find
(
'
title
'
).
text
(),
instructions
=
$stanza
.
find
(
'
instructions
'
).
text
(),
instructions
=
$stanza
.
find
(
'
instructions
'
).
text
(),
i
,
j
,
options
=
[],
$field
,
$options
;
i
,
j
,
options
=
[],
$field
,
$options
,
values
=
[],
$values
,
value
;
var
input_types
=
{
var
input_types
=
{
'
text-private
'
:
'
password
'
,
'
text-private
'
:
'
password
'
,
'
text-single
'
:
'
textline
'
,
'
text-single
'
:
'
textline
'
,
'
fixed
'
:
'
label
'
,
'
boolean
'
:
'
checkbox
'
,
'
boolean
'
:
'
checkbox
'
,
'
hidden
'
:
'
hidden
'
,
'
hidden
'
:
'
hidden
'
,
'
list-single
'
:
'
dropdown
'
'
jid-multi
'
:
'
textarea
'
,
'
list-single
'
:
'
dropdown
'
,
'
list-multi
'
:
'
dropdown
'
};
};
$form
.
find
(
'
span.spinner
'
).
remove
();
$form
.
find
(
'
span.spinner
'
).
remove
();
$form
.
append
(
$
(
'
<legend>
'
).
text
(
title
));
$form
.
append
(
$
(
'
<legend>
'
).
text
(
title
));
...
@@ -2409,19 +2413,35 @@
...
@@ -2409,19 +2413,35 @@
}
}
for
(
i
=
0
;
i
<
$fields
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
$fields
.
length
;
i
++
)
{
$field
=
$
(
$fields
[
i
]);
$field
=
$
(
$fields
[
i
]);
if
(
$field
.
attr
(
'
type
'
)
==
'
list-single
'
)
{
if
(
$field
.
attr
(
'
type
'
)
==
'
list-single
'
||
$field
.
attr
(
'
type
'
)
==
'
list-multi
'
)
{
values
=
[];
$values
=
$field
.
children
(
'
value
'
);
for
(
j
=
0
;
j
<
$values
.
length
;
j
++
)
{
values
.
push
(
$
(
$values
[
j
]).
text
());
}
options
=
[];
options
=
[];
$options
=
$field
.
find
(
'
option
'
);
$options
=
$field
.
children
(
'
option
'
);
for
(
j
=
0
;
j
<
$options
.
length
;
j
++
)
{
for
(
j
=
0
;
j
<
$options
.
length
;
j
++
)
{
value
=
$
(
$options
[
j
]).
find
(
'
value
'
).
text
();
options
.
push
(
converse
.
templates
.
select_option
({
options
.
push
(
converse
.
templates
.
select_option
({
value
:
$
(
$options
[
j
]).
find
(
'
value
'
).
text
(),
value
:
value
,
label
:
$
(
$options
[
j
]).
attr
(
'
label
'
)
label
:
$
(
$options
[
j
]).
attr
(
'
label
'
),
selected
:
(
values
.
indexOf
(
value
)
>=
0
)
}));
}));
}
}
$form
.
append
(
converse
.
templates
.
form_select
({
$form
.
append
(
converse
.
templates
.
form_select
({
name
:
$field
.
attr
(
'
var
'
),
name
:
$field
.
attr
(
'
var
'
),
label
:
$field
.
attr
(
'
label
'
),
label
:
$field
.
attr
(
'
label
'
),
options
:
options
.
join
(
''
)
options
:
options
.
join
(
''
),
multiple
:
(
$field
.
attr
(
'
type
'
)
==
'
list-multi
'
)
}));
}
else
if
(
$field
.
attr
(
'
type
'
)
==
'
fixed
'
)
{
$form
.
append
(
$
(
'
<p>
'
).
text
(
$field
.
find
(
'
value
'
).
text
()));
}
else
if
(
$field
.
attr
(
'
type
'
)
==
'
jid-multi
'
)
{
$form
.
append
(
converse
.
templates
.
form_textarea
({
name
:
$field
.
attr
(
'
var
'
),
label
:
$field
.
attr
(
'
label
'
)
||
''
,
value
:
$field
.
find
(
'
value
'
).
text
()
}));
}));
}
else
if
(
$field
.
attr
(
'
type
'
)
==
'
boolean
'
)
{
}
else
if
(
$field
.
attr
(
'
type
'
)
==
'
boolean
'
)
{
$form
.
append
(
converse
.
templates
.
form_checkbox
({
$form
.
append
(
converse
.
templates
.
form_checkbox
({
...
@@ -2455,6 +2475,15 @@
...
@@ -2455,6 +2475,15 @@
var
$input
=
$
(
this
),
value
;
var
$input
=
$
(
this
),
value
;
if
(
$input
.
is
(
'
[type=checkbox]
'
))
{
if
(
$input
.
is
(
'
[type=checkbox]
'
))
{
value
=
$input
.
is
(
'
:checked
'
)
&&
1
||
0
;
value
=
$input
.
is
(
'
:checked
'
)
&&
1
||
0
;
}
else
if
(
$input
.
is
(
'
textarea
'
))
{
value
=
[];
var
lines
=
$input
.
val
().
split
(
'
\n
'
);
for
(
var
vk
=
0
;
vk
<
lines
.
length
;
vk
++
)
{
var
val
=
$
.
trim
(
lines
[
vk
]);
if
(
val
==
''
)
continue
;
value
.
push
(
val
);
}
}
else
{
}
else
{
value
=
$input
.
val
();
value
=
$input
.
val
();
}
}
...
...
css/converse.css
View file @
69ccdc9a
...
@@ -926,6 +926,9 @@ dl.add-converse-contact {
...
@@ -926,6 +926,9 @@ dl.add-converse-contact {
display
:
block
;
display
:
block
;
clear
:
both
;
clear
:
both
;
}
}
#conversejs
.chatroom-form
label
.label-ta
{
height
:
auto
;
}
#conversejs
.chatroom-form
label
input
,
#conversejs
.chatroom-form
label
input
,
#conversejs
.chatroom-form
label
select
{
#conversejs
.chatroom-form
label
select
{
float
:
right
;
float
:
right
;
...
...
main.js
View file @
69ccdc9a
...
@@ -103,7 +103,8 @@ require.config({
...
@@ -103,7 +103,8 @@ require.config({
"
status_option
"
:
"
src/templates/status_option
"
,
"
status_option
"
:
"
src/templates/status_option
"
,
"
toggle_chats
"
:
"
src/templates/toggle_chats
"
,
"
toggle_chats
"
:
"
src/templates/toggle_chats
"
,
"
toolbar
"
:
"
src/templates/toolbar
"
,
"
toolbar
"
:
"
src/templates/toolbar
"
,
"
trimmed_chat
"
:
"
src/templates/trimmed_chat
"
"
trimmed_chat
"
:
"
src/templates/trimmed_chat
"
,
"
form_textarea
"
:
"
src/templates/form_textarea
"
},
},
map
:
{
map
:
{
...
...
src/templates.js
View file @
69ccdc9a
...
@@ -41,7 +41,8 @@ define("converse-templates", [
...
@@ -41,7 +41,8 @@ define("converse-templates", [
"
tpl!status_option
"
,
"
tpl!status_option
"
,
"
tpl!toggle_chats
"
,
"
tpl!toggle_chats
"
,
"
tpl!toolbar
"
,
"
tpl!toolbar
"
,
"
tpl!trimmed_chat
"
"
tpl!trimmed_chat
"
,
"
tpl!form_textarea
"
],
function
()
{
],
function
()
{
return
{
return
{
action
:
arguments
[
0
],
action
:
arguments
[
0
],
...
@@ -86,6 +87,7 @@ define("converse-templates", [
...
@@ -86,6 +87,7 @@ define("converse-templates", [
status_option
:
arguments
[
39
],
status_option
:
arguments
[
39
],
toggle_chats
:
arguments
[
40
],
toggle_chats
:
arguments
[
40
],
toolbar
:
arguments
[
41
],
toolbar
:
arguments
[
41
],
trimmed_chat
:
arguments
[
42
]
trimmed_chat
:
arguments
[
42
],
form_textarea
:
arguments
[
43
]
};
};
});
});
src/templates/field.html
View file @
69ccdc9a
<field
var=
"{{name}}"
><value>
{{value}}
</value></field>
<field
var=
"{{name}}"
>
{[ if (_.isArray(value)) { ]}
{[ _.each(value,function(arrayValue) { ]}
<value>
{{arrayValue}}
</value>
{[ }); ]}
{[ } else { ]}
<value>
{{value}}
</value>
{[ } ]}
</field>
src/templates/form_select.html
View file @
69ccdc9a
<label>
{{label}}
<select
name=
"{{name}}"
>
{{options}}
</select></label>
<label>
{{label}}
<select
name=
"{{name}}"
{[
if
(
multiple
)
{
]}
multiple=
"multiple"
{[
}
]}
>
{{options}}
</select></label>
src/templates/form_textarea.html
0 → 100644
View file @
69ccdc9a
<label
class=
"label-ta"
>
{{label}}
<textarea
name=
"{{name}}"
>
{{value}}
</textarea></label>
src/templates/select_option.html
View file @
69ccdc9a
<option
value=
"{{value}}"
>
{{label}}
</option>
<option
value=
"{{value}}"
{[
if
(
selected
)
{
]}
selected=
"selected"
{[
}
]}
>
{{label}}
</option>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment