Git Product home page Git Product logo

cfgov-sheer-templates's Introduction

⚠️ THIS REPO IS DEPRECATED (5/18/2018) ⚠️

cfgov-sheer-templates

This is a repository of base templates for consumerfinance.gov pages served by the Sheer engine.

This repo is currently housing templates that bridge the gap between the current WordPress theme (cfpb_nemo) and future sitewide Sheer templates.

The hopeful, eventual end state of this repo is the single source for all HTML, CSS, and JavaScript for sitewide use on consumerfinance.gov.

What's in this repo?

_layouts

Layouts pull together everything needed to display a whole page.

base.html

The base template on which all others are built. Includes:

<html>
    {% import macros %}
    <head>
        <!-- Global meta -->
        <!-- Page-specific meta -->
        <!-- Global styles -->
        {% block additional_styles %}
        <!-- Global head scripts -->
        {% block head_scripts %}
    </head>
    <body>
        <!-- Analytics -->
        {% block body_top %}
        {% block include_header %}
        {% block content %}
        {% block include_footer %}
        {% block body_bottom %}
        <!-- Global body scripts -->
        {% block body_scripts %}
    </body>
</html>

_includes

Includes are template partials and Jinja helpers.

nemo_header.html, nemo_subnav.html, and nemo_footer.html

Included in base.html, these files contain replicas of the current (as of November 2015) consumerfinance.gov header, navigation and footer, adapted to have basic responsiveness.

Styles for these are found in nemo.less and nemo-shim.less.

secondary-navigation.html

This file sets up a left-hand navigation sidebar based on the designs modeled by cfgov-refresh.

See below for further instructions.

macros.html

Stores macros that can be called in templates. Imported into base.html so that it's available everywhere.

How to use these

Coming soon: getting started instructions.

Using sidebar navigation

To activate the sidebar secondary navigation, first create a nav_items variable in a new include file in your project. The recommended naming convention is _vars-<projectname>.html. Each item has three components: the path, an ID for the item, and the link text.

Use this example from the FinEd Resources project to guide you:

{% set nav_items = [
    ('/adult-financial-education/', 'adult-financial-education', 'Adult financial education'),
    ('/youth-financial-education/', 'youth-financial-education', 'Youth financial education'),
    ('/library-resources', 'library-resources', 'Resources for libraries'),
    ('/parents/', 'parents', 'Resources for parents'),
    ('/managing-someone-elses-money/', 'managing-someone-elses-money', 'Guides for managing someone else’s money'),
] -%}

On each page, after extending layout-side-nav.html, set the active_nav_id variable to enable highlighting the current page, and then import the _vars file you just created:

{% set active_nav_id = 'library-resources' -%}
{% import '_vars-libraries.html' as libraries with context %}

You'll also want to grab the latest styles for the navigation component from the cfgov-refresh project

If you'd like to use two-level sidebar navigation, then for each parent nav item that will have children:

  1. Add a fourth element, named <parentitem>.children to the parent item in the nav_items declaration, like so:

    ('/library-resources', 'library-resources', 'Resources for libraries', libraries.children),
  2. Add a line like this, above the nav_items declaration:

    {% set libraries = { 'children': null } if not libraries else libraries %}
  3. Create a _vars-<parentitem>.html file with a children declaration:

    {% set children = [
        ('/library-resources/program-ideas/', 'program-ideas', 'Program ideas'),
        ('/library-resources/librarian-training/', 'librarian-training', 'Librarian training'),
        ('/library-resources/marketing-materials/', 'marketing-materials', 'Marketing materials'),
        ('/library-resources/websites-videos-courses/', 'websites-videos-courses', 'Websites, videos, and courses'),
    ] -%}
  4. Import the new _vars file in the parent and its children, under the import of the main _vars file. Continuing with the Libraries example, the first four lines of our library-resources/index.html file now look like this:

    {% extends 'layout-side-nav.html' %}
    {% set active_nav_id = 'library-resources' %}
    {% import '_vars-libraries.html' as libraries with context %}
    {% import '_vars-resources.html' as vars with context %}

Note: Use of this navigation sidebar requires your project to have the cf-expandables package available.

Getting involved

We welcome your feedback and contributions.

Known issues

  • cfgov-refresh demo banner needs to be made optional

Open source licensing info

  1. TERMS
  2. LICENSE
  3. CFPB Source Code Policy

Credits and references

  1. Jinja2 templating documentation

cfgov-sheer-templates's People

Contributors

anselmbradford avatar contolini avatar himedlooff avatar kimberlymunoz avatar scotchester avatar virginiacc avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cfgov-sheer-templates's Issues

Pulling these templates into a project

What is the best way to get these templates into your project and keep them in sync with the rest of the site?

Possible options:

  • Bower package (I think this is my preferred option.)
  • Git submodule
  • One-off Grunt task

Site navigation missing

I posted about this in an Owning a Home pull request, but wanted to log an issue. The site-wide navigation for Sheer sites appears to be missing.

screen shot 2016-05-24 at 6 54 46 am

Make a check list of sites using these templates

Yesterday we made a list of sites using these templates. We should turn this into a checklist that lives in this repo(?) so that we can make sure all critical sites get updated when these templates change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.