Skip to content

Commit d04ae3e

Browse files
authored
Added further cleanup (divio#133)
1 parent b2e4f9e commit d04ae3e

File tree

10 files changed

+28
-11
lines changed

10 files changed

+28
-11
lines changed

CHANGELOG.rst

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Changelog
2323
* Added default CKEditor "styleSet" to load via djangocms-text-ckeditor in
2424
``/static/aldryn_bootstrap3/js/ckeditor.js``
2525
* Added transifex integration for translations
26+
* Added ``ALDRYN_BOOTSTRAP3_GRID_SIZE`` to Divio Cloud settings
2627
* Set all max_values to 255
2728
* Fixed an issue where column offset, push and pull did not accept "0" as a value
2829
* Restructured code to reflect Bootstrap 3's documentation

README.rst

+5
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ In addition you can set or extend your own icon fonts using ``ALDRYN_BOOTSTRAP3_
107107
('icons', 'icon', 'Custom Icons'),
108108
]
109109

110+
The default grid size is set to **24** when validating the column input,
111+
you can override this by setting::
112+
113+
ALDRYN_BOOTSTRAP3_GRID_SIZE = 12
114+
110115

111116
Running Tests
112117
-------------

aldryn_bootstrap3/constants.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88

99
# Changable constants, overriden through settings
10-
GRID_SIZE = settings.ALDRYN_BOOTSTRAP3_GRID_SIZE
11-
10+
GRID_SIZE = getattr(settings, 'ALDRYN_BOOTSTRAP3_GRID_SIZE', 24)
1211

1312
# Fixed constants, not influenced by settings
1413
# Changes here will most likely require database migrtions

aldryn_bootstrap3/fields.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
from . import widgets, constants
99

1010

11-
# Please check `model_fields.py` for import reference
12-
13-
1411
class Context(django.forms.fields.ChoiceField):
1512
widget = widgets.Context
1613
CHOICES = constants.CONTEXT_CHOICES

aldryn_bootstrap3/migrations/0014_translations_update.py

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import djangocms_text_ckeditor.fields
66
import filer.fields.file
77
import django.db.models.deletion
8+
from aldryn_bootstrap3.models import Bootstrap3CarouselPlugin
9+
from aldryn_bootstrap3.model_fields import get_additional_styles
10+
811

912
class Migration(migrations.Migration):
1013

@@ -78,4 +81,9 @@ class Migration(migrations.Migration):
7881
name='content',
7982
field=djangocms_text_ckeditor.fields.HTMLField(default='', help_text='Content may also be added using child plugins.', verbose_name='Content', blank=True),
8083
),
84+
migrations.AlterField(
85+
model_name='bootstrap3carouselplugin',
86+
name='style',
87+
field=models.CharField(choices=Bootstrap3CarouselPlugin.STYLE_CHOICES + get_additional_styles(), default='standard', max_length=255, verbose_name='Style'),
88+
),
8189
]
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# -*- coding: utf-8 -*-

aldryn_bootstrap3/model_fields.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ def get_additional_styles():
3737
if raw:
3838
if isinstance(raw, str):
3939
raw = raw.split(',')
40-
for choice in raw:
41-
clean = choice.strip()
42-
choices.append((clean.lower(), clean.title()))
40+
for choice in raw:
41+
clean = choice.strip()
42+
choices.append((clean.lower(), clean.title()))
43+
else:
44+
for choice in raw:
45+
choices.append(choice)
4346
return choices
4447

4548

Binary file not shown.

aldryn_bootstrap3/widgets.py

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
from .conf import settings
88

99

10-
# Please check `fields.py` for import reference
11-
12-
1310
class ContextRenderer(django.forms.widgets.RadioFieldRenderer):
1411
def render(self):
1512
from django.template.loader import render_to_string

aldryn_config.py

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ def split_and_strip(string):
77

88

99
class Form(forms.BaseForm):
10+
grid_size = forms.NumberField(
11+
'Maximum columns to support',
12+
required=False
13+
)
1014
enable_glyphicons = forms.CheckboxField(
1115
'Enable Glyphicons',
1216
required=False,
@@ -38,6 +42,8 @@ def clean(self):
3842

3943
def to_settings(self, data, settings):
4044
choices = []
45+
if data['grid_size']:
46+
settings['ALDRYN_BOOTSTRAP3_GRID_SIZE'] = int(data['grid_size'])
4147
if data['enable_glyphicons']:
4248
choices.append(
4349
('glyphicons', 'glyphicons', 'Glyphicons')

0 commit comments

Comments
 (0)