github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

andykent / polypage

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 126
    • 8
  • Source
  • Commits
  • Network (8)
  • Issues (4)
  • Downloads (8)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • master ✓
    • refactor
  • Tags (8)
    • polypage_0_8_3
    • polypage_0_8_2
    • polypage_0_8_1
    • polypage_0_8_0
    • polypage_0_7_0
    • polypage_0_6_0
    • polypage_0_5_1
    • polypage_0_5_0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A jQuery plugin to ease the development of dynamic html wireframes with state. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Provide hooks for custom show/hide animations via base:{ show:func, 
hide:func } Closes #2 
andykent (author)
Sun Apr 19 14:46:56 -0700 2009
commit  40cb93fa13146b4eef496845e2a92276167b0a52
tree    319f05719e5483cbb78e9191dea614f19d0643d0
parent  5d799d33645316a1d781c5171b7f4acf1059effe
polypage /
name age
history
message
file .gitignore Sat Mar 07 06:54:40 -0800 2009 started to add some long overdue specs [andykent]
file changelog.txt Sun Apr 19 14:46:56 -0700 2009 Provide hooks for custom show/hide animations v... [andykent]
file index.html Tue Apr 14 15:21:19 -0700 2009 split extensions out into seperate files to mak... [andykent]
directory lib/ Sun Apr 19 14:46:56 -0700 2009 Provide hooks for custom show/hide animations v... [andykent]
file readme.markdown Tue Apr 14 14:54:15 -0700 2009 minor doc updates [andykent]
directory skins/ Sat Mar 07 16:14:39 -0800 2009 The nav bar is now 100% independent of the poly... [andykent]
directory spec/ Tue Apr 14 15:21:19 -0700 2009 split extensions out into seperate files to mak... [andykent]
readme.markdown

PolyPage

Polypage was designed to ease the process of showing multiple page states in html mock-ups. By simply adding class names to a document you can imply state and conditional view logic.

BASIC USAGE

Initialise PolyPage...

$(document).ready(function() {
    $('body').polypage();
});

Use stateful class names in your html...

<li class="pp_admin">pp_admin</li>
<li class="pp_not_logged_in other_test_class">pp_not_logged_in</li>
<li class="test_class pp_logged_in_or_admin other_test_class">pp_logged_in_or_admin</li>
<li class="pp_logged_in_and_admin">pp_logged_in_and_admin</li>
<li class="pp_not_logged_in_and_not_admin">pp_not_logged_in_and_not_admin</li>

Use special href attributes to trigger state changes if required...

<a href="#pp_toggle_logged_in">Log In Toggle</a>
<a href="#pp_set_logged_in_true">Log In</a>
<a href="#pp_set_logged_in_false">Log Out</a>

Use special form actions to trigger state changes if required...

<form action="#pp_toggle_logged_in" method="get">
  <input type="submit" value="Log in"/>
</form>

API

PolyPage makes extensive use of custom events and triggering/binding to these is the recommended way of interacting with page states programatically. Here are some examples (which assume you have bound polypage to the 'body')...

Toggle the logged in state...

$('body').trigger('pp_toggleState', 'logged_in');

Set the logged in state...

$('body').trigger('pp_setState', { logged_in:true });

Set the logged in state...

$('body').trigger('pp_setState', { logged_in:true });

Listen for state changes...

$('body').bind('pp_stateChange', function(e, state) { 
  alert("state "+ state.name + " changed to " + state.value); 
});

See the specs for some more examples.

ADVANCED USAGE

Under the hood PolyPage is logically separated into a core library and several extensions. The currently implemented extensions are...

  • Base: the core event system and bare essentials to get polypage working
  • GUI: the nav bar for pre-built GUI interactions
  • Events: some default event handlers for taking care of polypage formatted click and submit events automagically
  • Cookies: cookie support for maintaining state across pages
  • Keyboard: Keyboard shortcuts for toggling states via "ALT + first_letter_of_state_name"

Full documentation for all of the extensions will be coming soon but for now you can see the source code for available options.

Some usage examples

Starting PolyPage without cookie support or Event helpers...

$('body').polypage({ cookie:false, events:false });

Starting PolyPage with a 2 day cookie expiry a 'ux' prefix and no Event helpers...

$('body').polypage({ cookie:{ expires:2 }, base:{ prefix:'ux' }, events:false });

Roll your own PolyPage! if you want to completely customise PolyPage then you can break away from using the polypage() function and initialize the individual components yourself...

$(el).ppBase(opts);
$(el).ppEvents(opts);
$(el).ppGUI(opts);
$(el).ppCookie(opts);
$(el).ppKeyboard(opts);

MORE INFO

For an example open the index.html file in a web browser.

If you would prefer be using MooTools instead of jQuery then for the moment you really should checkout cheeaun's fork http://github.com/cheeaun/polypage which contains lots of MooTools goodness.

CONTRIBUTERS

  • Andy Kent andy.kent@me.com (http://adkent.com)
  • Natalie Downe nat@natbat.net (http://notes.natbat.net)
  • Phil Oye philoye@philoye.com (http://philoye.com)
  • Lim Chee Aun cheeaun@gmail.com (http://cheeaun.com)
  • Yoan Blanc yoan@dosimple.ch (http://yoan.dosimple.ch/)
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server