Giter Club home page Giter Club logo

moj_slotpicker's Introduction

MOJ Slot Picker

A Web user interface for selecting 3 time slots in order of preference.

Demo

The interface consists of:

  • a calendar for selecting available days
  • an optional date 'slider' for touch screens
  • a list of slots for the selected day
  • a list of chosen slots in order of preference

When a slot is selected the corresponding hidden option element is selected.

Dependencies

How to use

Install as a Bower package

bower install moj.slot-picker

or

git clone https://github.com/ministryofjustice/slot-picker

or

Download the latest version as a ZIP and use the dist folder.

Note for Ruby on Rails Asset Pipelines

For Asset Pipeline users, include the CSS files with the .ap suffix as these use the image-url helper for file image assets.

Also, assuming you have installed the package in vendor/assets, add the following line to config/application.rb to make sure the slot picker assets are served.

config.assets.paths << "#{Rails.root}/vendor/assets/moj.slot-picker/dist/stylesheets"

Lastly, make sure *.png is included in config.assets.precompile.

Mark-up

The Slot Picker expects source dates to be provided in the form of option elements with values as the slot data.

<option value="2014-03-17-1400-1600">Monday, 17 March - 2:00pm</option>

The slot data is in the format YYYY-MM-DD-HHMM-HHMM, where the former time is the start of the slot and the latter time is the end.

Re-create the classname structure and templates as shown in /dist/index.html.

Options

Options are applied via data-* attributes.

Name Default Description
option-limit 3 The amount of slots to populate
single-unavailable-msg true Use one message for all days do not contain any slot times (defined by .SlotPicker-day--unavailable

Non-MOJ projects

MOJ projects use a JavaScript module structure based on Heisenburg.js which automatically initialises the module.

For non-MOJ projects you'll need to manually trigger the init method to initialise any instances of .SlotPicker.

<script src="javascripts/moj.slot-picker.js"></script>
<script>moj.Modules.SlotPicker.init();</script>

This can be seen in the demo.

Build

Prior to running the build process you will need NodeJS resources

npm install

Build JavaScript and CSS from source files.

make

For development you can also watch source files for changes and automatically lint, concatenate and copy them.

make watch

Tests

Tests can be run either through the command line:

make test

or rendered in a browser by viewing SpecRunner.html (at the root of a Web server).

moj_slotpicker's People

Contributors

matharden avatar dwhenry avatar benbarnett avatar

Watchers

Ben Lovell avatar Matt Lucht avatar James Cloos avatar  avatar

Forkers

uk-gov-mirror

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.