Coverage for khufu/scaffolding/grid_column.py : 60%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# encoding: utf-8
2from . import *
4def grid_column(
5 span=1,
6 offset=0,
7 content='',
8 htmlId=False,
9 htmlClass=False,
10 pull=False,
11 onPhone=True,
12 onTablet=True,
13 onDesktop=True,
14 dataspy=False
15):
16 """ *Get a column block for the Twiiter Bootstrap static layout grid.*
18 **Key Arguments**
20 - ``log`` -- logger
21 - ``span`` -- the relative width of the column
22 - ``offset`` -- increase the left margin of the column by this amount
23 - ``htmlId`` -- the id of the column
24 - ``htmlClass`` -- the class of the column
25 - ``pull`` -- left, right, or center
26 - ``onPhone`` -- does this column get displayed on a phone sized screen
27 - ``onTablet`` -- does this column get displayed on a tablet sized screen
28 - ``onDesktop`` -- does this column get displayed on a desktop sized screen
31 **Return**
33 - ``column`` -- the column """
36 if htmlId:
37 htmlId = """id="%(htmlId)s" """ % locals()
38 else:
39 htmlId = ''
40 if not htmlClass:
41 htmlClass = ''
43 phoneClass = ""
44 tabletClass = ""
45 desktopClass = ""
46 if onPhone:
47 if onTablet:
48 if not onDesktop:
49 desktopClass = "hidden-desktop"
50 else:
51 if not onDesktop:
52 phoneClass = "visible-phone"
53 else:
54 tabletClass = "hidden-tablet"
55 else:
56 if onTablet:
57 if not onDesktop:
58 tabletClass = "visible-tablet"
59 else:
60 phoneClass = "hidden-phone"
61 else:
62 desktopClass = "visible-desktop"
64 if pull:
65 pull = "pull-%(pull)s" % locals()
66 else:
67 pull = ""
69 if dataspy is not False:
70 dataspy = """data-spy="affix" data-offset-top="200" """
71 else:
72 dataspy = ""
74 column = """
75 <div %(dataspy)s class="span%(span)s offset%(offset)s %(htmlClass)s %(phoneClass)s %(tabletClass)s %(desktopClass)s %(pull)s" %(htmlId)s>
76 %(content)s
77 </div>
78 """ % locals()
79 return column