Ejemplo n.º 1
0
def display_courses():
    '''Configure and display the courses list page.'''
    department = check_unit(Departments.read_unit('cs'))
    courses = check_unit(Courses.read_units())
    return display_content(
        breadcrumbs=get_breadcrumbs('academics', 'courses'),
        image=Images.read_tagged_unit('courses'),
        title='Courses & Materials',
        tabList=create_course_tab_list(courses, department),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 2
0
def display_research():
    '''Configure and display the research overview page.'''
    department = check_unit(Departments.read_unit('cs'))
    return display_content(
        breadcrumbs=get_breadcrumbs('research'),
        image=Images.read_tagged_unit('research'),
        title='Research',
        primary=department.get('research'),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 3
0
def display_honors():
    '''Display information on the honors program.'''
    department = check_unit(Departments.read_unit('cs'))
    return display_content(
        breadcrumbs=get_breadcrumbs('academics', 'honors'),
        image=Images.read_tagged_unit('academics.honors'),
        title='Graduating with Honors',
        primary=department.get('honors'),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 4
0
def display_news_article(name):
    '''This routine displays a single news article.'''
    article = check_unit(News.read_unit(name))
    return display_content(
        breadcrumbs=get_breadcrumbs('news', name),
        title=article.get('title'),
        subtitle=article.get('date').strftime('%B %d, %Y'),
        primary='<p>' + article.get('content') + '</p>',
        current=get_name('news', name),
        editable=True,
        editableUrl=url_for('web.update_news_article', name=name)
    )
Ejemplo n.º 5
0
def display_program(name=None):
    '''Configure and display a program page.'''
    program = check_unit(Programs.read_unit(name))
    return display_content(
        breadcrumbs=get_breadcrumbs('academics', program.get('name')),
        image=Images.read_tagged_unit(name),
        title=program.get('title'),
        primary=program.get('majorDescription'),
        tabList=create_program_tab_list(program),
        editable=True,
        editableUrl=url_for('web.update_program', name=name)
    )
Ejemplo n.º 6
0
def display_resource(name):
    '''This routine displays a given resource. It is not password protected
    because all resources are visible to all visitors.
    '''
    resource = check_unit(Resources.read_unit(name))
    return display_content(
        breadcrumbs=get_breadcrumbs('resources', name),
        title=resource.get('title'),
        primary=resource.get('content'),
        tabList=create_resource_tab_list(resource),
        editable=True,
        editableUrl=url_for('web.update_resource', name=name)
    )
Ejemplo n.º 7
0
def display_document(name):
    '''This routine displays a given document. It is not password protected
    because all documents are visible to all visitors.
    '''
    document = check_unit(Documents.read_unit(name))
    return display_content(
        breadcrumbs=get_breadcrumbs('documents', name),
        title=document.get('title'),
        primary=document.get('content'),
        primaryListHr=False,
        editable=True,
        editableUrl=url_for('web.update_document', name=name)
    )
Ejemplo n.º 8
0
def display_about():
    '''Configure and display the about page, with an appropriate image and the
    department long description.
    '''
    department = check_unit(Departments.read_unit('cs'))
    return display_content(
        breadcrumbs=get_breadcrumbs('about'),
        image=Images.read_tagged_unit('about'),
        title='About Us',
        primary=department.get('longDescription'),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 9
0
def display_image(name):
    '''This routine displays a given image. We included only to support
    generally unused breadcrumb trails. It is password protected at the
    moment to ensure that users access raw images as part of actual pages.
    '''
    image = check_unit(Images.read_unit(name))
    return display_content(
        breadcrumbs=get_breadcrumbs('images', name),
        title=image.get('name'),
        primary='<img src="/static/images/' + image.get('filename') + '">',
        primaryListHr=False,
        editable=True,
        editableUrl=url_for('web.update_image', name=name)
    )
Ejemplo n.º 10
0
def display_index():
    '''Configure and display the main index page, with an appropriate image,
    the department short description and a list of current news articles.
    '''
    department = check_unit(Departments.read_unit('cs'))
    return display_content(
        image=Images.read_tagged_unit('departments.cs'),
        title=department.get('title'),
        subtitle=department.get('tagline'),
        primary=department.get('shortDescription'),
        sideTitle='Computing News',
        sideList=create_brief_news_list(News.read_units(limit=2 + TechNews.TECH_NEWS_LIMIT)),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 11
0
def display_scholarship(name):
    '''This routine displays a given scholarship.'''
    scholarship = check_unit(Scholarships.read_unit(name))
    # Add scholarship details in side bar if they exist.
    sideContent = create_scholarship_side(scholarship)
    sideTitle = None
    if sideContent:
        sideTitle = 'Details'
    return display_content(
        breadcrumbs=get_breadcrumbs('scholarships', name),
        title=scholarship.get('title'),
        primary=create_scholarship_content(scholarship),
        sideTitle=sideTitle,
        sideContent=sideContent,
        primaryListHr=False,
        editable=True,
        editableUrl=url_for('web.update_scholarship', name=name)
    )