+
Skip to content

nla/pavo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

PAVO Widgets

Beware: This is currently just a placeholder. This project does not exist yet in a usable form.

Assorted JavaScript widgets for rich digital collection delivery.

Usage

TODO

Widget Reference

  • Books
  • Audio
  • Misc
  • contactus — simple feedback form
  • toolbar — a bar of buttons

Anatomy of a PAVO Widget

A typical widget consists of five files plus any additional static assets.

widgets/helloworld/
    README.md
    config.json
    _helloworld.erb
    helloworld.css
    helloworld.js
    images/
        background.png

Documentation (README)

Each widget should have a README file with short description of it's purpose and the configuration options it supports.

HelloWorld Widget
=================

Displays a friendly greeting.

## Options

- message: the text to display

Configuration (JSON)

{
    "js": [
        "widgets/helloworld/helloworld.js"
    ]
}

Templates (ERB + JST)

Use ERB syntax like <%= foo %> for server-side templating and JST syntax like ${foo} for the client-side. It's normal to mix both in the same file.

<link rel="stylesheet" type="text/css" href="<%= app_path %>widgets/helloworld/helloworld.css"/>
<div class="pavo-widget helloworld" id="helloworld">
  <div class="saying-hi-to-the-world"></div>
  
  <div id="helloworld_message_template"><!--
    <p>${message}</p>
  --></div>
</div>

Stylesheets (CSS)

All widgets must have a top-level class of .pavo-widget.

.pavo-widget.helloworld p {
    text-decoration: blink;
}

Behaviour (JavaScript)

require([], function() {
  PAVO.widgets.helloworld = function (wid) {
    // Variables
    var rootel = "#" + wid;

    // Events
    function addListeners() {
    }

    // Methods

    // Initialisation
    function init() {
      addListeners();
      $(".saying-hi-to-the-world", rootel).html(PAVO.templates.render("helloworld_message_template", {
 message: "Hello world"
      }));
    }
    init();
  }

  PAVO.widgets.informLoaded("helloworld");
});

Dependencies

Core dependencies:

For audio widgets:

License

TODO

About

Assorted JavaScript widgets for digital collection delivery.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载