Skip to content
Permalink
Browse files

Adding newlines between methods.

  • Loading branch information...
markstory committed Apr 21, 2009
1 parent dd01dda commit 91edcacec2d3d582cb5536adf8a76491aa428ce0
@@ -53,6 +53,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
'direction' => 'orientation'
)
);
/**
* Helper function to wrap repetitive simple method templating.
*
@@ -69,6 +70,7 @@ function _methodTemplate($method, $template, $options, $callbacks) {
$options = $this->_parseOptions($options, $callbacks);
return sprintf($template, $this->selection, $options);
}
/**
* Create javascript selector for a CSS rule
*
@@ -83,6 +85,7 @@ function get($selector) {
}
return $this;
}
/**
* Add an event to the script cache. Operates on the currently selected elements.
*
@@ -109,6 +112,7 @@ function event($type, $callback, $options = array()) {
}
return sprintf('%s.bind("%s", %s);', $this->selection, $type, $callback);
}
/**
* Create a domReady event. This is a special event in many libraries
*
@@ -118,6 +122,7 @@ function event($type, $callback, $options = array()) {
function domReady($functionBody) {
return $this->get('document')->event('ready', $functionBody, array('stop' => false));
}
/**
* Create an iteration over the current selection result.
*
@@ -128,6 +133,7 @@ function domReady($functionBody) {
function each($callback) {
return $this->selection . '.each(function () {' . $callback . '});';
}
/**
* Trigger an Effect.
*
@@ -155,6 +161,7 @@ function effect($name, $options = array()) {
}
return $this->selection . $effect;
}
/**
* Create an $.ajax() call.
*
@@ -179,6 +186,7 @@ function request($url, $options = array()) {
$options = $this->_parseOptions($options, $callbacks);
return '$.ajax({' . $options .'});';
}
/**
* Create a sortable element.
*
@@ -194,6 +202,7 @@ function sortable($options = array()) {
$template = '%s.sortable({%s});';
return $this->_methodTemplate('sortable', $template, $options, $callbacks);
}
/**
* Create a Draggable element
*
@@ -208,6 +217,7 @@ function drag($options = array()) {
$template = '%s.draggable({%s});';
return $this->_methodTemplate('drag', $template, $options, $callbacks);
}
/**
* Create a Droppable element
*
@@ -222,6 +232,7 @@ function drop($options = array()) {
$template = '%s.droppable({%s});';
return $this->_methodTemplate('drop', $template, $options, $callbacks);
}
/**
* Create a Slider element
*
@@ -67,6 +67,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
'step' => 'steps'
)
);
/**
* Create javascript selector for a CSS rule
*
@@ -85,6 +86,7 @@ function get($selector) {
$this->selection = '$$("' . $selector . '")';
return $this;
}
/**
* Add an event to the script cache. Operates on the currently selected elements.
*
@@ -112,6 +114,7 @@ function event($type, $callback, $options = array()) {
$out = $this->selection . ".addEvent(\"{$type}\", $callback);";
return $out;
}
/**
* Create a domReady event. This is a special event in many libraries
*
@@ -122,6 +125,7 @@ function domReady($functionBody) {
$this->selection = 'window';
return $this->event('domready', $functionBody, array('stop' => false));
}
/**
* Create an iteration over the current selection result.
*
@@ -132,6 +136,7 @@ function domReady($functionBody) {
function each($callback) {
return $this->selection . '.each(function (item, index) {' . $callback . '});';
}
/**
* Trigger an Effect.
*
@@ -171,6 +176,7 @@ function effect($name, $options = array()) {
}
return $this->selection . '.' . $effect . ';';
}
/**
* Create an new Request.
*
@@ -207,6 +213,7 @@ function request($url, $options = array()) {
$options = $this->_parseOptions($options, $callbacks);
return "var jsRequest = new Request$type({{$options}}).send($data);";
}
/**
* Create a sortable element.
*
@@ -222,6 +229,7 @@ function sortable($options = array()) {
$options = $this->_parseOptions($options, $callbacks);
return 'var jsSortable = new Sortables(' . $this->selection . ', {' . $options . '});';
}
/**
* Create a Draggable element.
*
@@ -237,6 +245,7 @@ function drag($options = array()) {
$options = $this->_parseOptions($options, $callbacks);
return 'var jsDrag = new Drag(' . $this->selection . ', {' . $options . '});';
}
/**
* Create a Droppable element.
*
@@ -276,6 +285,7 @@ function drop($options = array()) {
$this->selection = $options['droppables'];
return $out;
}
/**
* Create a slider control
*
@@ -67,6 +67,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
'value' => 'sliderValue',
)
);
/**
* Create javascript selector for a CSS rule
*
@@ -85,6 +86,7 @@ function get($selector) {
$this->selection = '$$("' . $selector . '")';
return $this;
}
/**
* Add an event to the script cache. Operates on the currently selected elements.
*
@@ -112,6 +114,7 @@ function event($type, $callback, $options = array()) {
$out = $this->selection . ".observe(\"{$type}\", $callback);";
return $out;
}
/**
* Create a domReady event. This is a special event in many libraries
*
@@ -122,6 +125,7 @@ function domReady($functionBody) {
$this->selection = 'document';
return $this->event('dom:loaded', $functionBody, array('stop' => false));
}
/**
* Create an iteration over the current selection result.
*
@@ -132,6 +136,7 @@ function domReady($functionBody) {
function each($callback) {
return $this->selection . '.each(function (item, index) {' . $callback . '});';
}
/**
* Trigger an Effect.
*
@@ -176,6 +181,7 @@ function effect($name, $options = array()) {
}
return $effect;
}
/**
* Create an Ajax or Ajax.Updater call.
*
@@ -203,6 +209,7 @@ function request($url, $options = array()) {
}
return "var jsRequest = new Ajax$type($url$options);";
}
/**
* Create a sortable element.
*
@@ -221,6 +228,7 @@ function sortable($options = array()) {
}
return 'var jsSortable = Sortable.create(' . $this->selection . $options . ');';
}
/**
* Create a Draggable element.
*
@@ -239,6 +247,7 @@ function drag($options = array()) {
}
return 'var jsDrag = new Draggable(' . $this->selection . $options . ');';
}
/**
* Create a Droppable element.
*
@@ -257,6 +266,7 @@ function drop($options = array()) {
}
return 'Droppables.add(' . $this->selection . $options . ');';
}
/**
* Creates a slider control widget.
*
@@ -283,7 +293,7 @@ function slider($options = array()) {
}
$out = 'var jsSlider = new Control.Slider(' . $this->selection . ', ' . $slider . $optionString . ');';
$this->selection = $slider;
return $out;
return $out;
}
}
?>
@@ -272,7 +272,6 @@ function testSlider() {
));
$expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {axis:"horizontal", onChange:onComplete, onSlide:onChange, sliderValue:4});';
$this->assertEqual($result, $expected);
}
}
?>

0 comments on commit 91edcac

Please sign in to comment.
You can’t perform that action at this time.