Permalink
Browse files

updated examples for 0.4, don't assume jQuery can be reached through $

  • Loading branch information...
jvinet committed Feb 24, 2010
1 parent c52c8e8 commit 5227a26791e43d7713215d9cbd513c65f2500659
Showing with 15 additions and 7 deletions.
  1. +1 −0 examples/ex3.html
  2. +1 −0 examples/ex4.html
  3. +11 −6 examples/ex5.html
  4. +2 −1 src/jive.js
View
@@ -7,6 +7,7 @@
<script type="text/javascript">
MainController = function() {
this.go = function(req, res) {
+ req.title = req.title || 'mr.'; // default
if(req.title == 'custom') {
res.title = req.cust_title;
} else {
View
@@ -7,6 +7,7 @@
<script type="text/javascript">
MainController = function() {
this.go = function(req, res) {
+ req.title = req.title || 'mr.'; // default
if(req.title == 'custom') {
res.title = req.cust_title;
} else {
View
@@ -6,28 +6,33 @@
<!-- models -->
<script type="text/javascript">
+ // extend the parent Jive_Model class
PersonModel = function(){
- }
- PersonModel.prototype = new Jive.Model();
+ // call the parent constructor
+ Jive_Model.call(this);
+ }.mixin(Jive_Model);
</script>
<!-- controllers -->
<script type="text/javascript">
MainController = function() {
+ Jive_Controller.call(this);
+
this.index = function(req, res) {
}
- }
- MainController.prototype = new Jive.Controller();
+ }.mixin(Jive_Controller);
PersonController = function(){
+ Jive_Controller.call(this);
self.m = new PersonModel();
this.save = function(req, res, $trig) {
+ // $trig is a jQuery object containing the element that triggered
+ // this action
if(!self.m.validate($trig)) return;
alert("You passed");
}
- }
- PersonController.prototype = new Jive.Controller();
+ }.mixin(Jive_Controller);
// set the (initial) default controller to use if none specified
Jive.controller = 'Main';
View
@@ -145,7 +145,8 @@
* We operate on the "run" attribute (not W3C-compliant) which is
* our internal action designator.
************************************************************************/
- $(function(){
+ jQuery(function(){
+ var $ = jQuery;
var run = function(){ $(this).blur(); return Jive.run($(this).attr('run'), {}, $(this)) };
$('a[run]').live('click', function(){ return run.call(this) });
// for some reason, live() doesn't work on this selector but livequery() does...

0 comments on commit 5227a26

Please sign in to comment.