Giter Site home page Giter Site logo

audreymaniez / wai-statements Goto Github PK

View Code? Open in Web Editor NEW

This project forked from w3c/wai-statements

0.0 1.0 0.0 452 KB

Accessibility Statements

Home Page: https://w3c.github.io/wai-statements/planning/statements/

Ruby 6.05% JavaScript 31.15% HTML 61.81% CSS 0.99%

wai-statements's Introduction

wai-statements

Accessibility Statement generator tool pages are a part of the WAI website and therefore makes use of the wai-website-theme as dependency. Both make use of Jekyll static site generator to create the pages.


Installation and local development

Installation as part of the WAI website

This site is build with Jekyll, follow Jekyll's installation guide first.

Then clone this repository:

git clone https://github.com/w3c/wai-statements.git

If you have installed ruby and jekyll, cd into the project and install dependencies defined inside the Gemfile:

bundle install

Now you can start development with:

bundle exec jekyll serve

Installation as stand-alone

To use the accessibility statement generator tool as a stand-alone to include into your own site you need to build the site once with Jekyll, see "Installation as part of the WAI website".

Build the site:

bundle exec jekyll build

The complete site is build inside the _site folder and the generated files you need will be:

  • HTML: planning/statements/generator/index.html

    You will need all contents of <div id="accstatement"> and link to required css and javascript below. The rest is all WAI website material.

  • CSS: content-images/wai-statements/generator.css

  • JS: content-images/wai-statements/generator.js

  • WAI theme assets: assets/css/style.css and assets/scripts/main.js

    This is required for the expanding and toggling of sections and information.

For now you need to strip and modify all files manually to make it includeable into your own project.

TODO for stand alone version

  • Add standalone version page generator/standalone.html

Customizing the generator tool

Add, remove and update content

The generator tool is setup in such a way that content is seperated from function. In this way, adding and removing form or preview content is easy to do. Addition is only required inside the generator.html file.

Editing the statement create form

The create statement contents are wrapped inside <section class="page create">. Just simply add or remove the html markup to edit the form.

There is one extra functionality available to dynamically add extra line to grouped form input; add-line. To use this there are several practical examples inside the form. Required for add-line to work is this basic setup:

<fieldset class="group">
    <legend>An add-line input group</legend>

    <!--
        OPTIONAL: Pre defined lines
        class line is optional and will determine the count start
    -->
    <div class="field line">
        <label for="some_addline_item_1">Some addline item 1</label>
        <input type="text" id="some_addline_item_1" name="an_addline_grouping_name" />
    </div>

    <!--
        REQUIRED: A prototype declared
        class proto required
        [n] = placeholder for the line count
    -->
    <div class="field proto">
        <label for="some_addline_item_[n]">Some addline item [n]</label>
        <input type="text" id="some_addline_item_[n]" name="an_addline_grouping_name" />
    </div>

    <!--
        REQUIRED: An add-line button
        To add the proto to the fieldset as line
    -->
    <button type="button" class="add-line">
        Add another line
    </button>
</fieldset>

Editing the statement preview

The preview statement contents are wrapped inside <section class="page preview">. Just simply add or remove the html markup to edit the form.

Same as with editing the statement create form, just add or remove html markup to edit the statement preview.

To print the form data into the statement preview there is some additional functionality available:

  • Printing formdata with data-print attribute:

    Example print usage:

    <!--
        Single input data
        data-print          REQUIRED    input id to print
        data-printdefault   OPTIONAL    defaultvalue if data is missing or empty
        data-printfilter    OPTIONAL    Output transformation; one of [lowercase, capitalize]
    -->
    <span data-print="forminput_id" data-printdefault="MY_FORM_DATA" data-printfilter="lowercase, capitalize"></span>
    
    <!--
        Print as url
        The data entered will also be outputted into the href
        and can be prefixed like “mailto:” for example.
    -->
    <a href="URL_PREFIX" data-print="some_url_data"></a>
    
    <!--
        Print Grouped data:
        UL or OL
        Grouped data is stored under the group name
        defined as name on input elements
        Filters added are applied for each data item inside the group
    -->
    <ul data-print="some_grouped_data"></ul>
  • Conditionally show sections with data-if attribute:

    To make the statement preview show sections based on filled form inputs / groups, you can wrap contents with a conditional element and / or include a condition to an element like:

    <!-- Wrapped inside condition -->
    <div data-if="required_data_id">
        <!-- Content will be visible based on available data -->
    </div>
    
    <!-- Or part of section -->
    <div>
        <!-- Other content … -->
        <p data-if="some_data">
            This text will be shown if some_data is present.
        </p>
    </div>
    
    <!-- Depending on multiple data sources -->
    <div data-if="this_data, that_data">
        <!-- Stays hidden until one of data sources is present -->
    </div>

Exceptions

Currently custom handled statement parts are:

  • Conformance meaning data (Updates to hidden input #accstmnt_conformance_meaning)
  • Limitations section (Still reading directly from DOM)

When changes are required here edits on generator.js are necessary.

Internationalization

Currently this application does not support easy translation. For now you need to duplicate the generator.html file and rename both something like generator_en.html and generator_fr.html. Then just edit the contents manually.

Contents for the create page (form) are wrapped in <section class="page create">, preview inside <section class="page preview">.

wai-statements's People

Contributors

nitedog avatar rvantonisse avatar yatil avatar shawna-slh avatar notabene avatar

Watchers

Audrey Maniez avatar

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.