Last active
August 29, 2015 14:11
-
-
Save foxdonut/0632cf71fea5b8087c4b to your computer and use it in GitHub Desktop.
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
{ | |
"name": "rave-wire-example", | |
"version": "0.0.0", | |
"description": "wire example", | |
"main": "app/run.js", | |
"authors": [ | |
"foxdonut <[email protected]>" | |
], | |
"moduleType": [ | |
"amd" | |
], | |
"license": "MIT", | |
"ignore": [ | |
"**/.*", | |
"node_modules", | |
"bower_components", | |
"test", | |
"tests" | |
], | |
"dependencies": { | |
"wire": "~0.10.9", | |
"jquery": "~2.1.1", | |
"rivets": "~0.7.1", | |
"rave": "~0.4.5", | |
"rave-wire": "~0.2.0" | |
} | |
} |
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
<!DOCTYPE HTML> | |
<html data-rave-meta="bower.json" data-debug> | |
<head> | |
<title>Two selects</title> | |
</head> | |
<body> | |
<div id="meal-select"> | |
<div>Meal:</div> | |
<select class="meal"> | |
<option value=""></option> | |
<option value="breakfast">Breakfast</option> | |
<option value="lunch">Lunch</option> | |
<option value="dinner">Dinner</option> | |
</select> | |
</div> | |
<div id="menu-select"> | |
<div>Menu choice:</div> | |
<select class="menu"> | |
<option value=""></option> | |
<option data-rv-each-option="menuOptions" value="{{option.value}}"> | |
{{option.label}} | |
</option> | |
</select> | |
</div> | |
</body> | |
<script src="bower_components/rave/rave.js"></script> | |
</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
define(["./config/rivets-config"], function() { | |
return { | |
$plugins: [ "wire/dom", "wire/on" ], | |
model: { module: "app/model" }, | |
getMenuOptions: { module: "app/get-menu-options" }, | |
mealSelect: { $ref: "dom!meal-select" }, | |
menuSelect: { $ref: "dom!menu-select" }, | |
getSelectedValue: { module: "app/get-selected-value" }, | |
onChange: { | |
compose: "getSelectedValue | getMenuOptions | model.update" | |
}, | |
controller: { | |
literal: { name: "controller" }, | |
on: { | |
mealSelect: { "change:select": "onChange" } | |
} | |
}, | |
rivets: { | |
module: "rivets", | |
ready: { | |
bind: [ | |
{ $ref: "menuSelect" }, | |
{ $ref: "model" } | |
] | |
} | |
} | |
}; | |
}); |
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
define(["wire", "./main"], function(wire, main) { | |
wire(main); | |
}); |
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
. | |
|-- app | |
| |-- config | |
| | `-- rivets-config.js | |
| |-- get-menu-options.js | |
| |-- get-selected-value.js | |
| |-- main.js | |
| |-- model.js | |
| `-- run.js | |
|-- bower.json | |
|-- index.html | |
`-- package.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment