Skip to content

Instantly share code, notes, and snippets.

@bangpound
Created June 28, 2016 19:01
Show Gist options
  • Save bangpound/cb397a3d5da557daba6113e27dec9d23 to your computer and use it in GitHub Desktop.
Save bangpound/cb397a3d5da557daba6113e27dec9d23 to your computer and use it in GitHub Desktop.

CAF Badges

This module supports badging.

Configuration

Visit /admin/config/services/cafbadges to configure the site's connection to the City of Learning API.

From this page, you can select the badges that will be listed on the site.

Group badges

On this project, skill badges have multiple achievement levels and are grouped by skill. The data for these groupings are not available in the City of Learning API, so we have a way to identify badge groups and provide content about them.

groups:
  - name: Photography
    blurb: |
             Photography is a technical skill that architects, planners, and designers use to communicate their ideas to
             others. For this badge, you will need to select your best photos from your project.
    description: |
                   Photography is a technical skill that architects, planners, and designers use to communicate their
                   ideas to others. This Skill Badge is awarded to Makers that use photos to document their process,
                   thinking, and for presenting ideas. To earn a Photography - Level 1 Skill Badge you need to upload
                   photos to your design project, in any step of the design process, to document your work. Photos must
                   include details that help other Makers understand your project and/or environment.
    badges:
      - id: 3306
        name: 'Photography I'
      - id: 3308
        name: 'Photography II'
      - id: 3309
        name: 'Photography III'

This is a YAML sequence of mappings. YAML is a human readable data format. A sequence is a collection of values. A map is a collection of keys and values.

  • groups is the key the sequence of group maps. Each value in the groups collection is a map whose first key is prefixed with - to indicate the start of a new value in the sequence.
  • Each group is a map with name, blurb, description, and badges as keys.
  • name, blurb, and description are always strings. If a string is very long, you can input it in different ways to make it more readable.
  • badges is a sequence of badge maps. Each badge has an id and name. The id value refers to the badge ID from City of Learning API.

More documentation about YAML is available at http://symfony.com/doc/current/components/yaml/yaml_format.html. A tool for linting (validating) your YAML is http://www.yamllint.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment