town6.homepage_widgets

Classes

RowWidget

RowWidgetWide

ColumnWidget

TitleWidget

AutoplayVideoWidget

RandomVideosWidget

IconLinksWidget

TextWidget

LinksWidget

NewsWidget

EventCard

EventsWidget

PartnerWidget

ServicesWidget

ContactsAndAlbumsWidget

DirectoriesWidget

FocusWidget

TestimonialsWidget

TestimonialSliderWidget

JobsWidget

RSSItem

The elements inside <item>

RSSChannel

The elements inside <channel>

Functions

parsed_rss(→ RSSChannel)

Module Contents

class town6.homepage_widgets.RowWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="row">
            <div class="grid-container">
                <div class="grid-x grid-padding-x {@class}">
                    <xsl:apply-templates select="node()"/>
                </div>
            </div>
        </xsl:template>
    """
class town6.homepage_widgets.RowWidgetWide[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="row-wide">
            <div class="grid-container full {@bgcolor}">
                <div class="grid-x {@class}">
                    <xsl:apply-templates select="node()"/>
                </div>
            </div>
        </xsl:template>
    """
class town6.homepage_widgets.ColumnWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="column">
            <div class="small-12 medium-{@span} cell">
                <xsl:apply-templates select="node()"/>
            </div>
        </xsl:template>
    """
class town6.homepage_widgets.TitleWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="title">
            <h3 class="{@class}">
                <xsl:apply-templates select="node()"/>
            </h3>
        </xsl:template>
    """
class town6.homepage_widgets.AutoplayVideoWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="autoplay_video">
            <div metal:use-macro="layout.macros.autoplay_video"
             tal:define="max_height '{@max-height}'; link_mp4 '{@link_mp4}';
             link_mp4_low_res '{@link_mp4_low_res}';
             link_webm '{@link_webm}';
              link_webm_low_res '{@link_webm_low_res}'; text '{@text}'
             "
            />
        </xsl:template>
    """
class town6.homepage_widgets.RandomVideosWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="random_videos">
            <div id="random-video">
                <xsl:apply-templates select="node()" />
            </div>
        </xsl:template>
    """
class town6.homepage_widgets.IconLinksWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="icon_link">
            <div metal:use-macro="layout.macros.icon_link"
            tal:define="
                title '{@title}'; invert '{@invert}'; icon '{@icon}';
                text '{@text}'; link '{@link}';
            "
            />
        </xsl:template>
    """
class town6.homepage_widgets.TextWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="text">
            <p class="homepage-text">
                <xsl:apply-templates select="node()"/>
            </p>
        </xsl:template>
    """
class town6.homepage_widgets.LinksWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="links">
            <ul class="panel-links">
                <xsl:for-each select="link">
                <li>
                    <a>
                        <xsl:attribute name="href">
                            <xsl:value-of select="@url" />
                        </xsl:attribute>

                        <xsl:value-of select="node()" />
                    </a>

                    <xsl:if test="@description">
                        <small>
                            <xsl:value-of select="@description" />
                        </small>
                    </xsl:if>
                </li>
                </xsl:for-each>
            </ul>
        </xsl:template>
    """
class town6.homepage_widgets.NewsWidget[source]

Bases: onegov.org.homepage_widgets.NewsWidget

news_limit = 3[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="news">
            <div metal:use-macro="layout.macros.newslist"
                tal:define="heading 'h5'; show_all_news_link True;
                hide_date False"
            />
        </xsl:template>
    """
class town6.homepage_widgets.EventCard[source]

Bases: NamedTuple

text: str[source]
url: str[source]
subtitle: str[source]
image_url: str | None[source]
location: str | None[source]
lead: str[source]
class town6.homepage_widgets.EventsWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="events">
            <metal:block use-macro="layout.macros['event-cards']"
            tal:define="with_lead True" />
        </xsl:template>
    """
get_variables(layout: onegov.town6.layout.DefaultLayout) onegov.core.types.RenderData[source]
class town6.homepage_widgets.PartnerWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="partners">
            <xsl:variable name="apos">'</xsl:variable>
            <xsl:variable name="show_title">
                <xsl:choose>
                     <xsl:when test="@hide-title">
                        <xsl:value-of
                        select="'False'" />
                    </xsl:when>
                     <xsl:otherwise>
                        <xsl:value-of select="'True'" />
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <metal:block use-macro="layout.macros['partner-cards']">
            <xsl:attribute name="tal:define">
            <xsl:value-of
            select="concat(
                'title ',
                $apos,
                @title,
                $apos,
                '; ',
                'show_title ',
                $show_title,
                ';')" />
          </xsl:attribute>
            </metal:block>
        </xsl:template>
    """
get_variables(layout: onegov.town6.layout.DefaultLayout) onegov.core.types.RenderData[source]
class town6.homepage_widgets.ServicesWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="services">
            <div class="services-panel">
                <ul class="panel-links callout">
                    <li tal:repeat="link services_panel.links">
                        <tal:b content="structure link(layout)" />
                    </li>
                    <xsl:for-each select="link">
                        <li tal:define="icon '{@icon}'">
                            <a tal:attributes="
                                class ('h5 fa fa-' + icon) if icon
                                      else 'generic h5'
                                ">
                                <xsl:attribute name="href">
                                    <xsl:value-of select="@url" />
                                </xsl:attribute>
                                <xsl:value-of select="node()" />
                            </a>
                        </li>
                    </xsl:for-each>
                </ul>
            </div>
        </xsl:template>
    """
get_variables(layout: onegov.town6.layout.DefaultLayout) onegov.core.types.RenderData[source]
class town6.homepage_widgets.ContactsAndAlbumsWidget[source]
template = Multiline-String[source]
Show Value
"""
           <xsl:template match="contacts_and_albums">
              <div class="contacts-albums-panel">
                <metal:block use-macro="layout.macros['panel-links']"
                   tal:define="panel contacts_and_albums_panel;
                   classes ['more-list']"
                />
              </div>
           </xsl:template>
       """
get_variables(layout: onegov.town6.layout.DefaultLayout) onegov.core.types.RenderData[source]
class town6.homepage_widgets.DirectoriesWidget[source]

Bases: onegov.org.homepage_widgets.DirectoriesWidget

template = Multiline-String[source]
Show Value
"""
        <xsl:template match="directories">
            <metal:block use-macro="layout.macros['directories-list']" />
        </xsl:template>
    """
class town6.homepage_widgets.FocusWidget[source]
template = Multiline-String[source]
Show Value
"""
    <xsl:template match="focus">
        <a href="{@focus-url}" class="focus-link">
            <div class="focus-widget card" data-aos="fade">
                <xsl:if test="@text-on-image = 'True'">
                    <xsl:attribute name="class">focus-widget card only-title
                    </xsl:attribute>
                </xsl:if>
                <xsl:variable name="apos">'</xsl:variable>
                <xsl:variable name="image_src">
                    <xsl:choose>
                            <xsl:when test="@image-src">
                            <xsl:value-of
                            select="concat($apos, @image-src, $apos)" />
                        </xsl:when>
                            <xsl:otherwise>
                            <xsl:value-of select="'None'" />
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>
                <metal:block use-macro="layout.macros['focus-panel']"
                tal:define="image_src '{@image-src}'; title '{@title}';
                 text_on_image '{@text-on-image}'; lead '{@lead}';"
                />
                <xsl:choose>
                    <xsl:when test="@text-on-image">
                        <xsl:if test="text">
                            <div class="card-section">
                                <xsl:for-each select="text">
                                    <p class="homepage-text">
                                        <xsl:apply-templates select="node()"/>
                                    </p>
                                </xsl:for-each>
                            </div>
                        </xsl:if>
                    </xsl:when>
                    <xsl:otherwise>
                    <div class="card-section">
                        <h5>
                            <xsl:choose>
                                <xsl:when test="@title">
                                    <xsl:value-of select="@title" />
                                </xsl:when>
                                <xsl:otherwise>
                                    <metal:block
                                    use-macro="layout.macros['focus-title']" />
                                </xsl:otherwise>
                            </xsl:choose>
                        </h5>
                        <xsl:choose>
                            <xsl:when test="@lead">
                                <p><b>
                                    <xsl:value-of select="@lead" />
                                </b></p>
                            </xsl:when>
                            <xsl:otherwise> </xsl:otherwise>
                        </xsl:choose>
                        <xsl:for-each select="text">
                            <p class="homepage-text">
                                <xsl:apply-templates select="node()"/>
                            </p>
                        </xsl:for-each>
                    </div>
                    </xsl:otherwise>
                </xsl:choose>
            </div>
        </a>
    </xsl:template>
    """
get_variables(layout: onegov.town6.layout.DefaultLayout) onegov.core.types.RenderData[source]
class town6.homepage_widgets.TestimonialsWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="testimonial">
            <div metal:use-macro="layout.macros.testimonial"
             tal:define="description '{@description}'; quote '{@quote}';
             image '{@image}';
             "
            />
        </xsl:template>
    """
class town6.homepage_widgets.TestimonialSliderWidget[source]
template = Multiline-String[source]
Show Value
"""
        <xsl:template match="testimonial_slider">
            <div metal:use-macro="layout.macros.testimonial_slider"
             tal:define="color '{@color}';
             description_1 '{@description_1}';
             quote_1 '{@quote_1}'; image_1 '{@image_1}';
             description_2 '{@description_2}';
             quote_2 '{@quote_2}'; image_2 '{@image_2}';
             description_3 '{@description_3}';
             quote_3 '{@quote_3}'; image_3 '{@image_3}';
             "
            />
        </xsl:template>
    """
class town6.homepage_widgets.JobsWidget[source]
template = Multiline-String[source]
Show Value
"""
    <xsl:template match="jobs">
        <div metal:use-macro="layout.macros['jobs-cards']"
        tal:define="jobs_card_title '{@jobs_card_title}';
        rss_feed '{@rss_feed}';
        "
        />
    </xsl:template>
    """
get_variables(layout: onegov.town6.layout.DefaultLayout) onegov.core.types.RenderData[source]
class town6.homepage_widgets.RSSItem[source]

Bases: NamedTuple

The elements inside <item>

title: str[source]
description: str[source]
guid: str[source]
pubDate: datetime.datetime | None[source]
class town6.homepage_widgets.RSSChannel[source]

Bases: NamedTuple

The elements inside <channel>

title: str[source]
description: str[source]
language: str[source]
copyright: str[source]
items: Iterator[RSSItem][source]
town6.homepage_widgets.parsed_rss(rss: bytes) RSSChannel[source]