Add "form-control" class to each "CharField"

This commit is contained in:
Maël Solard
2014-08-07 18:38:42 +02:00
parent 4fa407fc22
commit 9fc7d2537c
14 changed files with 88 additions and 46 deletions
+19 -10
View File
@@ -71,7 +71,8 @@ class GeneralParametersForm(parameters.AdminParametersForm):
secret_key = forms.CharField(
label=ugettext_lazy("Secret key"),
initial=random_key(),
help_text=ugettext_lazy("Key used to encrypt/decrypt passwords")
help_text=ugettext_lazy("Key used to encrypt/decrypt passwords"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
# LDAP specific settings
@@ -80,7 +81,8 @@ class GeneralParametersForm(parameters.AdminParametersForm):
ldap_server_address = forms.CharField(
label=ugettext_lazy("Server address"),
initial="localhost",
help_text=ugettext_lazy("The IP address of the DNS name of the LDAP server")
help_text=ugettext_lazy("The IP address of the DNS name of the LDAP server"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
ldap_server_port = forms.IntegerField(
@@ -109,14 +111,15 @@ class GeneralParametersForm(parameters.AdminParametersForm):
label=ugettext_lazy("Bind DN"),
initial='',
help_text=ugettext_lazy("The distinguished name to use when binding to the LDAP server. Leave empty for an anonymous bind"),
required=False
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
ldap_bind_password = forms.CharField(
label=ugettext_lazy("Bind password"),
initial='',
help_text=ugettext_lazy("The password to use when binding to the LDAP server (with 'Bind DN')"),
widget=forms.PasswordInput(render_value=True),
widget=forms.PasswordInput(attrs={"class": "form-control"}, render_value=True),
required=False
)
@@ -124,27 +127,31 @@ class GeneralParametersForm(parameters.AdminParametersForm):
label=ugettext_lazy("Users search base"),
initial="",
help_text=ugettext_lazy("The distinguished name of the search base used to find users"),
required=False
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
ldap_search_filter = forms.CharField(
label=ugettext_lazy("Search filter"),
initial="(mail=%(user)s)",
help_text=ugettext_lazy("An optional filter string (e.g. '(objectClass=person)'). In order to be valid, it must be enclosed in parentheses."),
required=False
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
ldap_user_dn_template = forms.CharField(
label=ugettext_lazy("User DN template"),
initial="",
help_text=ugettext_lazy("The template used to construct a user's DN. It should contain one placeholder (ie. %(user)s)"),
required=False
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
ldap_password_attribute = forms.CharField(
label=ugettext_lazy("Password attribute"),
initial="userPassword",
help_text=ugettext_lazy("The attribute used to store user passwords")
help_text=ugettext_lazy("The attribute used to store user passwords"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
ldap_is_active_directory = YesNoField(
@@ -160,7 +167,8 @@ class GeneralParametersForm(parameters.AdminParametersForm):
"Members of those LDAP Posix groups will be created as domain "
"administrators. Use ';' characters to separate groups."
),
required=False
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
ldap_groups_search_base = forms.CharField(
@@ -169,7 +177,8 @@ class GeneralParametersForm(parameters.AdminParametersForm):
help_text=ugettext_lazy(
"The distinguished name of the search base used to find groups"
),
required=False
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
sep3 = SeparatorField(label=ugettext_lazy("Miscellaneous"))
+2 -1
View File
@@ -21,7 +21,8 @@ class AdminParametersForm(parameters.AdminParametersForm):
mailboxes_owner = forms.CharField(
label=ugettext_lazy("Mailboxes ower"),
initial="vmail",
help_text=ugettext_lazy("The UNIX account who owns mailboxes on the filesystem")
help_text=ugettext_lazy("The UNIX account who owns mailboxes on the filesystem"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
default_domain_quota = forms.IntegerField(
+7 -4
View File
@@ -20,7 +20,8 @@ class AccountFormGeneral(forms.ModelForm):
help_text=ugettext_lazy(
"The user's name. Must be a valid e-mail address for simple users "
"or administrators with a mailbox."
)
),
widget=forms.TextInput(attrs={"class": "form-control"})
)
role = forms.ChoiceField(
label=ugettext_lazy("Role"),
@@ -29,11 +30,12 @@ class AccountFormGeneral(forms.ModelForm):
widget=forms.Select(attrs={"class": "form-control"})
)
password1 = forms.CharField(
label=ugettext_lazy("Password"), widget=forms.PasswordInput
label=ugettext_lazy("Password"),
widget=forms.PasswordInput(attrs={"class": "form-control"})
)
password2 = forms.CharField(
label=ugettext_lazy("Confirmation"),
widget=forms.PasswordInput,
widget=forms.PasswordInput(attrs={"class": "form-control"}),
help_text=ugettext_lazy("Enter the same password as above, for verification.")
)
@@ -50,7 +52,8 @@ class AccountFormGeneral(forms.ModelForm):
if user.group == "DomainAdmins":
self.fields["role"] = forms.CharField(
label="",
widget=forms.HiddenInput, required=False
widget=forms.HiddenInput(attrs={"class": "form-control"}),
required=False
)
else:
self.fields["role"].choices = [('', ugettext_lazy("Choose"))]
+1 -1
View File
@@ -190,7 +190,7 @@ class DomainFormOptions(forms.Form):
"The administrator's name. Don't include the domain's name here, "
"it will be automatically appended."
),
widget=forms.widgets.TextInput(attrs={"class": "input-small"}),
widget=forms.widgets.TextInput(attrs={"class": "form-control input-small"}),
required=False
)
+8 -2
View File
@@ -4,10 +4,16 @@ from django.utils.translation import ugettext_lazy
class ExportDataForm(forms.Form):
filename = forms.CharField(
label=ugettext_lazy("File name"), max_length=100, required=False
label=ugettext_lazy("File name"),
max_length=100,
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
sepchar = forms.CharField(
label=ugettext_lazy("Separator"), max_length=1, required=False
label=ugettext_lazy("Separator"),
max_length=1,
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
def __init__(self, *args, **kwargs):
+4 -1
View File
@@ -5,7 +5,10 @@ from django.utils.translation import ugettext_lazy
class ImportDataForm(forms.Form):
sourcefile = forms.FileField(label=ugettext_lazy("Select a file"))
sepchar = forms.CharField(
label=ugettext_lazy("Separator"), max_length=1, required=False
label=ugettext_lazy("Separator"),
max_length=1,
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
continue_if_exists = forms.BooleanField(
label=ugettext_lazy("Continue on error"), required=False,
+4 -2
View File
@@ -36,7 +36,8 @@ class ParametersForm(AdminParametersForm):
am_pdp_host = forms.CharField(
label=_("PDP server address"),
initial="localhost",
help_text=_("PDP server address (if inet mode)")
help_text=_("PDP server address (if inet mode)"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
am_pdp_port = forms.IntegerField(
@@ -49,7 +50,8 @@ class ParametersForm(AdminParametersForm):
am_pdp_socket = forms.CharField(
label=_("PDP server socket"),
initial="/var/amavis/amavisd.sock",
help_text=_("Path to the PDP server socket (if unix mode)")
help_text=_("Path to the PDP server socket (if unix mode)"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
check_requests_interval = forms.IntegerField(
@@ -22,7 +22,8 @@ class ParametersForm(AdminParametersForm):
initial=ugettext_lazy("I'm off"),
help_text=ugettext_lazy(
"Default subject used when an auto-reply message is created automatically"
)
),
widget=forms.TextInput(attrs={"class": "form-control"})
)
default_content = forms.CharField(
@@ -38,7 +39,7 @@ Best regards,
"automatically. The '%(name)s' macro will be replaced by the "
"user's full name."
),
widget=forms.widgets.Textarea
widget=forms.widgets.Textarea(attrs={"class": "form-control"})
)
def clean_default_content(self):
@@ -9,5 +9,6 @@ class AdminParametersForm(parameters.AdminParametersForm):
master_cf_path = forms.CharField(
label=ugettext_lazy("Postfix's master.cf path"),
initial="/etc/postfix/master.cf",
help_text=ugettext_lazy('Path to the master.cf configuration file')
help_text=ugettext_lazy('Path to the master.cf configuration file'),
widget=forms.TextInput(attrs={"class": "form-control"})
)
@@ -21,7 +21,8 @@ class ParametersForm(AdminParametersForm):
server = forms.CharField(
label=_("Server address"),
initial="127.0.0.1",
help_text=_("Address of your MANAGESIEVE server")
help_text=_("Address of your MANAGESIEVE server"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
port = forms.IntegerField(
+4 -4
View File
@@ -9,7 +9,7 @@ from modoboa.extensions.admin.templatetags.admin_tags import gender
class FiltersSetForm(forms.Form):
name = forms.CharField()
name = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
active = forms.BooleanField(
label=gender("Active", "m"), required=False,
initial=False,
@@ -57,7 +57,7 @@ class FilterForm(forms.Form):
def __init__(self, conditions, actions, request, *args, **kwargs):
super(FilterForm, self).__init__(*args, **kwargs)
self.fields["name"] = forms.CharField(label=_("Name"))
self.fields["name"] = forms.CharField(label=_("Name"), widget=forms.TextInput(attrs={"class": "form-control"}))
self.fields["match_type"] = forms.ChoiceField(
choices=[("allof", _("All of the following")),
("anyof", _("Any of the following")),
@@ -117,7 +117,7 @@ class FilterForm(forms.Form):
if op != opdef[0]:
continue
if opdef[2] in ["string", "number"]:
vfield = forms.CharField(max_length=255, initial=value)
vfield = forms.CharField(max_length=255, initial=value, widget=forms.TextInput(attrs={"class": "form-control"}))
self.fields["cond_target_%d" % self.conds_cnt] = \
forms.ChoiceField(initial=name, choices=targets)
@@ -154,7 +154,7 @@ class FilterForm(forms.Form):
arg = args[cnt]
aname = "action_arg_%d_%d" % (self.actions_cnt, cnt)
if arg["type"] == "string":
self.fields[aname] = forms.CharField(max_length=255, initial=value)
self.fields[aname] = forms.CharField(max_length=255, initial=value, widget=forms.TextInput(attrs={"class": "form-control"}))
elif arg["type"] == "list":
choices = getattr(self, arg["vloader"])(request)
self.fields[aname] = forms.ChoiceField(initial=value, choices=choices)
+4 -2
View File
@@ -13,11 +13,13 @@ class ParametersForm(AdminParametersForm):
logfile = forms.CharField(
label=ugettext_lazy("Path to the log file"),
initial="/var/log/mail.log",
help_text=ugettext_lazy("Path to log file used to collect statistics")
help_text=ugettext_lazy("Path to log file used to collect statistics"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
rrd_rootdir = forms.CharField(
label=ugettext_lazy("Directory to store RRD files"),
initial="/tmp/modoboa",
help_text=ugettext_lazy("Path to directory where RRD files are stored")
help_text=ugettext_lazy("Path to directory where RRD files are stored"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
+13 -7
View File
@@ -13,7 +13,8 @@ class ParametersForm(AdminParametersForm):
max_attachment_size = forms.CharField(
label=_("Maximum attachment size"),
initial="2048",
help_text=_("Maximum attachment size in bytes (or KB, MB, GB if specified)")
help_text=_("Maximum attachment size in bytes (or KB, MB, GB if specified)"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
sep1 = SeparatorField(label=_("IMAP settings"))
@@ -21,7 +22,8 @@ class ParametersForm(AdminParametersForm):
imap_server = forms.CharField(
label=_("Server address"),
initial="127.0.0.1",
help_text=_("Address of your IMAP server")
help_text=_("Address of your IMAP server"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
imap_secured = YesNoField(
@@ -42,7 +44,8 @@ class ParametersForm(AdminParametersForm):
smtp_server = forms.CharField(
label=_("Server address"),
initial="127.0.0.1",
help_text=_("Address of your SMTP server")
help_text=_("Address of your SMTP server"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
smtp_secured_mode = forms.ChoiceField(
@@ -114,19 +117,22 @@ class UserSettings(UserParametersForm):
trash_folder = forms.CharField(
initial="Trash",
label=_("Trash folder"),
help_text=_("Folder where deleted messages go")
help_text=_("Folder where deleted messages go"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
sent_folder = forms.CharField(
initial="Sent",
label=_("Sent folder"),
help_text=_("Folder where copies of sent messages go")
help_text=_("Folder where copies of sent messages go"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
drafts_folder = forms.CharField(
initial="Drafts",
label=_("Drafts folder"),
help_text=_("Folder where drafts go")
help_text=_("Folder where drafts go"),
widget=forms.TextInput(attrs={"class": "form-control"})
)
sep3 = SeparatorField(label=_("Composing messages"))
@@ -143,7 +149,7 @@ class UserSettings(UserParametersForm):
initial="",
label=_("Signature text"),
help_text=_("User defined email signature"),
widget=forms.widgets.Textarea,
widget=forms.widgets.Textarea(attrs={"class": "form-control"}),
required=False
)
+15 -8
View File
@@ -79,16 +79,21 @@ def make_body_images_inline(body):
class ComposeMailForm(forms.Form):
"""Compose mail form.
"""
to = forms.CharField(label=_("To"))
cc = forms.CharField(label=_("Cc"), required=False)
cci = forms.CharField(label=_("Cci"), required=False)
to = forms.CharField(label=_("To"), widget=forms.TextInput(attrs={"class": "form-control"}))
cc = forms.CharField(label=_("Cc"), required=False, widget=forms.TextInput(attrs={"class": "form-control"}))
cci = forms.CharField(label=_("Cci"), required=False, widget=forms.TextInput(attrs={"class": "form-control"}))
subject = forms.CharField(
label=_("Subject"), max_length=255, required=False
label=_("Subject"),
max_length=255,
required=False,
widget=forms.TextInput(attrs={"class": "form-control"})
)
origmsgid = forms.CharField(
label="", widget=forms.HiddenInput(), required=False
label="",
widget=forms.HiddenInput(attrs={"class": "form-control"}),
required=False
)
body = forms.CharField(widget=forms.widgets.Textarea)
body = forms.CharField(widget=forms.widgets.Textarea(attrs={"class": "form-control"}))
def _html_msg(self):
"""Create a multipart message.
@@ -189,9 +194,11 @@ class ForwardMailForm(ComposeMailForm):
class FolderForm(forms.Form):
oldname = forms.CharField(
label="", widget=forms.HiddenInput(), required=False
label="",
widget=forms.HiddenInput(attrs={"class": "form-control"}),
required=False
)
name = forms.CharField()
name = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
class AttachmentForm(forms.Form):