-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a demonstration. Added custom function to display an element.
- Loading branch information
1 parent
2169a2c
commit 47e1b0e
Showing
4 changed files
with
211 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<html> | ||
<head> | ||
<title>GearsInMotion v0.2 demo</title> | ||
|
||
<!--CSS file (default YUI Sam Skin) --> | ||
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.3.1/build/datatable/assets/skins/sam/datatable.css" /> | ||
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.1/build/container/assets/skins/sam/container.css" /> | ||
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.1/build/reset/reset-min.css" /> | ||
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.1/build/fonts/fonts-min.css" /> | ||
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.1/build/grids/grids-min.css" /> | ||
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.0/build/button/assets/button.css"> | ||
|
||
<!-- YUI Dependencies --> | ||
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/yahoo-dom-event/yahoo-dom-event.js"></script> | ||
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/element/element-beta-min.js"></script> | ||
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/datasource/datasource-beta-min.js"></script> | ||
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/dragdrop/dragdrop-min.js"></script> | ||
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/container/container-min.js"></script> | ||
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/button/button-beta-min.js"></script> | ||
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/menu/menu-min.js"></script> | ||
<script type="text/javascript" src="http://yui.yahooapis.com/2.3.1/build/datatable/datatable-beta-min.js"></script> | ||
|
||
<!-- Google gears --> | ||
<script type="text/javascript" src="lib/gears_init.js"></script> | ||
|
||
<!-- GearsInMotion --> | ||
<link rel="stylesheet" type="text/css" href="css/gearsinmotion.css"/> | ||
<script type="text/javascript" src="js/helpers.js"></script> | ||
<script type="text/javascript" src="js/gearsinmotion.js"></script> | ||
<script type="text/javascript" src="js/sql.js"></script> | ||
<script type="text/javascript" src="js/gim_datatable_by_sql.js"></script> | ||
|
||
<!-- THE DEMO IS IN THIS FILE : --> | ||
<script type="text/javascript" src="js/demo.js"></script> | ||
|
||
<script> | ||
if (!window.google || !google.gears) { | ||
window.location.href = "http://gears.google.com/?action=install&return="+window.location.href; | ||
} | ||
</script> | ||
|
||
</head> | ||
<body style="background-color: #eee; overflow: hidden;" class="yui-skin-sam"> | ||
<button id="showGIM" onclick="GIM.toggle();">show GIM</button> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
var struct = [ | ||
|
||
{ | ||
name: "countries", | ||
fields: { | ||
id: "int", | ||
name: "varchar(255)", | ||
supporters: "int" | ||
}, | ||
elements: [ | ||
{id: 1, name: "France", supporters: 64102000}, | ||
{id: 2, name: "South Africa", supporters: 47850700}, | ||
{id: 3, name: "Argentina", supporters: 39921833}, | ||
{id: 4, name: "England", supporters: 49138831} | ||
] | ||
}, | ||
{ | ||
name: "clubs", | ||
fields: { | ||
id: "int", | ||
name: "varchar(255)", | ||
country_id: "int" | ||
}, | ||
elements: [ | ||
{id: 1, name: "Sale", country_id: 4}, | ||
{id: 2, name: "Natal Sharks", country_id: 2}, | ||
{id: 3, name: "Toulouse", country_id: 1}, | ||
{id: 4, name: "Hindu Club", country_id: 3}, | ||
{id: 5, name: "Stade Francais", country_id: 1}, | ||
{id: 6, name: "Newcastle", country_id: 4}, | ||
{id: 7, name: "Blue Bulls", country_id: 2} | ||
] | ||
}, | ||
{ | ||
name: "players", | ||
fields: { | ||
id: "int", | ||
name: "varchar(255)", | ||
picture: "varchar(255)", | ||
country_id: "int" | ||
}, | ||
elements: [ | ||
{id: 1, name: "Sebastien Chabal", country_id: 1, picture: "http://www.lequipe.fr/Rugby/RugbyImage848.jpg"}, | ||
{id: 2, name: "Lionel Beauxis", country_id: 1, picture: "http://www.lequipe.fr/Rugby/RugbyImage4000000000004631.jpg"}, | ||
{id: 3, name: "Frederic Michalak", country_id: 1, picture: "http://www.lequipe.fr/Rugby/RugbyImage3548.jpg"}, | ||
{id: 4, name: "Nicolas Fernandez Miranda", country_id: 3, picture: "http://www.lequipe.fr/Rugby/RugbyImage1456.jpg"}, | ||
{id: 5, name: "Jonny Wilkinson", country_id: 4, picture: "http://www.lequipe.fr/Rugby/RugbyImage956.jpg"}, | ||
{id: 6, name: "Bryan Habana", country_id: 2, picture: "http://www.lequipe.fr/Rugby/RugbyImage6000000000004667.jpg"} | ||
], | ||
buildElementDom: function(elmt) { | ||
var div = cn('div'); | ||
div.appendChild(cn('p',null,null,elmt.name)); | ||
div.appendChild(cn('img',{src: elmt.picture})); | ||
return div; | ||
} | ||
}, | ||
{ | ||
name: "clubs_players", | ||
fields: { | ||
player_id: "int", | ||
club_id: "int" | ||
}, | ||
elements: [ | ||
{player_id: 1, club_id: 1}, | ||
{player_id: 2, club_id: 5}, | ||
{player_id: 3, club_id: 2}, | ||
{player_id: 4, club_id: 4}, | ||
{player_id: 5, club_id: 6}, | ||
{player_id: 6, club_id: 7} | ||
] | ||
} | ||
]; | ||
|
||
YAHOO.util.Event.addListener(window, "load", function() { | ||
GIM.init('rugbyDB'); | ||
// Populate the database | ||
GIM.populateDatabase(struct); | ||
// Reopent the demoDb (updates the table list and the liaisons) | ||
GIM.chooseDb('rugbyDB'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters