How to use the coderedcms.models.wagtailsettings_models.LayoutSettings.for_site function in coderedcms

To help you get started, we’ve selected a few coderedcms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coderedcorp / coderedcms / coderedcms / models / page_models.py View on Github external
def get_struct_org_logo(self):
        """
        Gets logo for structured data using a fallback.
        """
        if self.struct_org_logo:
            return self.struct_org_logo
        else:
            layout_settings = LayoutSettings.for_site(self.get_site())
            if layout_settings.logo:
                return layout_settings.logo
        return None
github coderedcorp / coderedcms / coderedcms / templatetags / coderedcms_tags.py View on Github external
# Prepend the site's root URL except for when MEDIA_URL already
    # looks like a full URL.
    protocol = re.compile(r'^(\w[\w\.\-\+]*:)*//')

    if protocol.match(settings.MEDIA_URL):
        base_url = ''
    else:
        base_url = context['request'].site.root_url

    if page:
        if page.og_image:
            return base_url + page.og_image.get_rendition('original').url
        elif page.cover_image:
            return base_url + page.cover_image.get_rendition('original').url
    if LayoutSettings.for_site(context['request'].site).logo:
        layout_settings = LayoutSettings.for_site(context['request'].site)
        return base_url + layout_settings.logo.get_rendition('original').url
    return None
github coderedcorp / coderedcms / coderedcms / templatetags / coderedcms_tags.py View on Github external
# Fixes #240 https://github.com/coderedcorp/coderedcms/issues/240
    # Prepend the site's root URL except for when MEDIA_URL already
    # looks like a full URL.
    protocol = re.compile(r'^(\w[\w\.\-\+]*:)*//')

    if protocol.match(settings.MEDIA_URL):
        base_url = ''
    else:
        base_url = context['request'].site.root_url

    if page:
        if page.og_image:
            return base_url + page.og_image.get_rendition('original').url
        elif page.cover_image:
            return base_url + page.cover_image.get_rendition('original').url
    if LayoutSettings.for_site(context['request'].site).logo:
        layout_settings = LayoutSettings.for_site(context['request'].site)
        return base_url + layout_settings.logo.get_rendition('original').url
    return None
github coderedcorp / coderedcms / coderedcms / templatetags / coderedcms_tags.py View on Github external
def get_navbar_css(context):
    layout = LayoutSettings.for_site(context['request'].site)
    fixed = "fixed-top" if layout.navbar_fixed else ""
    return " ".join([
        fixed,
        layout.navbar_collapse_mode,
        layout.navbar_color_scheme,
        layout.navbar_format,
        layout.navbar_class
    ])