"""Support module for page layout inside `Home' web application.
"""
from Apps import page
app = page.Layout()
def page_navibar_tabs():
"""Returns application main pages.
The application main pages are organized as tabs in the
application navigation bar. There is one tab for each main page
inside the application.
"""
names = ['Erratas', 'Articles', 'Events']
attrs = []
for i in names:
attrs.append({'href': '/centos-web/?p=' + i.lower()})
if 'p' in app.qs.keys():
focus = app.qs['p'][0].lower()
else:
focus = names[0].lower()
return app.navibar_app(names, attrs, focus)
def page_content():
"""Returns page content.
The page content is determined from the query string, specifically
from the value of `p' variable.
"""
if 'p' in app.qs.keys():
p = app.qs['p'][0].lower()
else:
p = 'erratas'
if p == 'erratas':
output = app.tag_h1({'class': 'title'}, [12, 1], 'Erratas' )
output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
output += app.tag_p({}, [12, 1], 'This is a paragraph in the sense of improvement. '*30 )
output += app.tag_h2({'class': 'title'}, [12, 1], 'For A Better OS' )
output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
output += app.admonition('Caution', '', app.tag_p({}, [16, 1], 'This is a paragraph. '*5))
output += app.tag_p({}, [12, 1], 'This is a paragraph. '*30 )
elif p == 'articles':
output = app.tag_h1({'class': 'title'}, [12, 1], 'Articles' )
elif p == 'events':
output = app.tag_h1({'class': 'title'}, [12, 1], 'Events' )
else:
output = app.tag_p('', [12, 1], 'Page Empty.')
return app.content(output)
def main():
"""Returns final output."""
# Define page name. This value is used as reference to determine
# which application to load and what tab in the navigation bar to
# focus on.
app.name = 'Home'
# Define page title. This value is dislayed on the browser's title
# bar. Notice that we concatenated the page class default value
# here.
app.title += ' :: Home'
# Define page header. This is the information displayed
# between the page top and the page content.
app.header = app.logo()
app.header += app.ads_google()
app.header += app.navibar_top()
app.header += app.lastreleases()
app.header += app.appslinks()
app.header += page_navibar_tabs()
# Define page body. This is the information displayed between the
# page header and page footer.
app.body = page_content()
# Define page footer. This is the information displayed between
# the page bottom and the page content, the last information
# displayed in the page.
app.footer = app.credits()
# Define page final layout.
html = app.page()
return html