Skip to content

Commit 46d6319

Browse files
committed
Cleanup macro registration.
1 parent 7af1524 commit 46d6319

File tree

3 files changed

+28
-40
lines changed

3 files changed

+28
-40
lines changed

HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
History
33
=======
44

5+
1.2.1 (unreleased)
6+
------------------
7+
8+
- Cleanup macro registration.
9+
[rnix]
10+
511
1.2 (2015-01-23)
612
----------------
713

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44

55

6-
version = '1.2'
6+
version = '1.2.1.dev0'
77
shortdesc = 'Bootstrap Styles for YAFOWIL'
88
longdesc = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
99
longdesc += open(os.path.join(os.path.dirname(__file__), 'HISTORY.rst')).read()

src/yafowil/bootstrap/common.py

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -74,44 +74,26 @@ def configure_factory():
7474

7575

7676
def register_macros():
77-
macros = dict()
78-
macros['form'] = {
79-
'chain': 'form',
80-
'props': {
81-
'form.class': 'form-horizontal',
82-
}
83-
}
84-
macros['field'] = {
85-
'chain': 'field:label:div:help:error',
86-
'props': {
87-
'label.class_add': 'col-sm-2',
88-
'div.class_add': 'col-sm-10',
89-
}
90-
}
91-
macros['button'] = {
92-
'chain': 'submit',
93-
'props': {
94-
'submit.class': 'btn',
95-
'submit.class_add': 'btn-default',
96-
}
97-
}
77+
# common
78+
factory.register_macro('form', 'form', {
79+
'form.class': 'form-horizontal',
80+
})
81+
factory.register_macro('field', 'field:label:div:help:error', {
82+
'label.class_add': 'col-sm-2',
83+
'div.class_add': 'col-sm-10',
84+
})
85+
factory.register_macro('button', 'submit', {
86+
'submit.class': 'btn',
87+
'submit.class_add': 'btn-default',
88+
})
9889

9990
# yafowil.widget.array
100-
macros['array'] = {
101-
'chain': 'field:label:help:error:array',
102-
'props': {
103-
'array.label': ' ',
104-
'field.class': 'form-group',
105-
'label.class_add': 'col-sm-2',
106-
'array.class_add': 'col-sm-10',
107-
'help.class_add': 'col-sm-offset-2 col-sm-10',
108-
'error.class_add': 'col-sm-offset-2 col-sm-10',
109-
}
110-
}
111-
macros['arrayfield'] = {
112-
'chain': 'field:label:help:error',
113-
'props': {}
114-
}
115-
116-
for name, value in macros.items():
117-
factory.register_macro(name, value['chain'], value['props'])
91+
factory.register_macro('array', 'field:label:help:error:array', {
92+
'array.label': ' ',
93+
'field.class': 'form-group',
94+
'label.class_add': 'col-sm-2',
95+
'array.class_add': 'col-sm-10',
96+
'help.class_add': 'col-sm-offset-2 col-sm-10',
97+
'error.class_add': 'col-sm-offset-2 col-sm-10',
98+
})
99+
factory.register_macro('arrayfield', 'field:label:help:error', {})

0 commit comments

Comments
 (0)