mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-13 07:29:39 +00:00
Chat: Use StringField instead of TextField
This commit is contained in:
parent
0ac7945969
commit
691e40bec9
@ -18,7 +18,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from flask_pluginengine import current_plugin
|
||||
from wtforms.fields.core import BooleanField
|
||||
from wtforms.fields.simple import TextField, TextAreaField
|
||||
from wtforms.fields.simple import StringField, TextAreaField
|
||||
from wtforms.validators import DataRequired, ValidationError
|
||||
|
||||
from indico.web.forms.base import IndicoForm, generated_data
|
||||
@ -33,9 +33,9 @@ class EditChatroomForm(IndicoForm):
|
||||
event_specific_fields = {'hidden', 'show_password'}
|
||||
|
||||
# Room-wide options
|
||||
name = TextField(_('Name'), [DataRequired()], description=_('The name of the room'))
|
||||
name = StringField(_('Name'), [DataRequired()], description=_('The name of the room'))
|
||||
description = TextAreaField(_('Description'), description=_('The description of the room'))
|
||||
password = TextField(_('Password'), description=_('An optional password required to join the room'))
|
||||
password = StringField(_('Password'), description=_('An optional password required to join the room'))
|
||||
# Event-specific options
|
||||
hidden = BooleanField(_('Hidden'), description=_('Hides the room on public event pages.'))
|
||||
show_password = BooleanField(_('Show password'), description=_('Shows the room password on public event pages.'))
|
||||
@ -43,10 +43,10 @@ class EditChatroomForm(IndicoForm):
|
||||
|
||||
class AddChatroomForm(EditChatroomForm):
|
||||
use_custom_server = BooleanField(_('Use custom server'))
|
||||
custom_server = TextField(_('Custom server'), [UsedIf(lambda form, field: form.use_custom_server.data),
|
||||
DataRequired()],
|
||||
filters=[lambda x: x.lower() if x else x],
|
||||
description=_('External Jabber server.'))
|
||||
custom_server = StringField(_('Custom server'), [UsedIf(lambda form, field: form.use_custom_server.data),
|
||||
DataRequired()],
|
||||
filters=[lambda x: x.lower() if x else x],
|
||||
description=_('External Jabber server.'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._date = kwargs.pop('date')
|
||||
|
||||
@ -21,7 +21,7 @@ from flask_pluginengine import render_plugin_template
|
||||
from wtforms import ValidationError
|
||||
from wtforms.fields.core import BooleanField
|
||||
from wtforms.fields.html5 import URLField
|
||||
from wtforms.fields.simple import TextField, TextAreaField
|
||||
from wtforms.fields.simple import StringField, TextAreaField
|
||||
from wtforms.validators import DataRequired
|
||||
|
||||
from indico.core import signals
|
||||
@ -46,11 +46,12 @@ from indico_chat.views import WPChatEventPage, WPChatEventMgmt
|
||||
|
||||
class SettingsForm(IndicoForm):
|
||||
admins = PrincipalField(_('Administrators'), description=_('Users who can manage chatrooms for all events'))
|
||||
server = TextField(_('XMPP server'), [DataRequired()], description=_('The hostname of the XMPP server'))
|
||||
muc_server = TextField(_('XMPP MUC server'), [DataRequired()], description=_("The hostname of the XMPP MUC server"))
|
||||
bot_jid = TextField(_('Bot JID'), [DataRequired()],
|
||||
description=_("Jabber ID of the XMPP bot. Can be just a username (in that case the default "
|
||||
"server is assumed) or a username@server."))
|
||||
server = StringField(_('XMPP server'), [DataRequired()], description=_('The hostname of the XMPP server'))
|
||||
muc_server = StringField(_('XMPP MUC server'), [DataRequired()],
|
||||
description=_("The hostname of the XMPP MUC server"))
|
||||
bot_jid = StringField(_('Bot JID'), [DataRequired()],
|
||||
description=_("Jabber ID of the XMPP bot. Can be just a username (in that case the default "
|
||||
"server is assumed) or a username@server."))
|
||||
bot_password = UnsafePasswordField(_('Bot Password'), [DataRequired()], description=_("Password for the bot"))
|
||||
notify_admins = BooleanField(_('Notify admins'),
|
||||
description=_("Should chat administrators receive email notifications?"))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user