Adding newlines between methods.

This commit is contained in:
mark_story 2009-04-21 09:31:52 -07:00
parent dd01dda0b4
commit 91edcacec2
4 changed files with 32 additions and 2 deletions

View file

@ -53,6 +53,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
'direction' => 'orientation' 'direction' => 'orientation'
) )
); );
/** /**
* Helper function to wrap repetitive simple method templating. * Helper function to wrap repetitive simple method templating.
* *
@ -69,6 +70,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
$options = $this->_parseOptions($options, $callbacks); $options = $this->_parseOptions($options, $callbacks);
return sprintf($template, $this->selection, $options); return sprintf($template, $this->selection, $options);
} }
/** /**
* Create javascript selector for a CSS rule * Create javascript selector for a CSS rule
* *
@ -83,6 +85,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
} }
return $this; return $this;
} }
/** /**
* Add an event to the script cache. Operates on the currently selected elements. * Add an event to the script cache. Operates on the currently selected elements.
* *
@ -109,6 +112,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
} }
return sprintf('%s.bind("%s", %s);', $this->selection, $type, $callback); return sprintf('%s.bind("%s", %s);', $this->selection, $type, $callback);
} }
/** /**
* Create a domReady event. This is a special event in many libraries * Create a domReady event. This is a special event in many libraries
* *
@ -118,6 +122,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
function domReady($functionBody) { function domReady($functionBody) {
return $this->get('document')->event('ready', $functionBody, array('stop' => false)); return $this->get('document')->event('ready', $functionBody, array('stop' => false));
} }
/** /**
* Create an iteration over the current selection result. * Create an iteration over the current selection result.
* *
@ -128,6 +133,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
function each($callback) { function each($callback) {
return $this->selection . '.each(function () {' . $callback . '});'; return $this->selection . '.each(function () {' . $callback . '});';
} }
/** /**
* Trigger an Effect. * Trigger an Effect.
* *
@ -155,6 +161,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
} }
return $this->selection . $effect; return $this->selection . $effect;
} }
/** /**
* Create an $.ajax() call. * Create an $.ajax() call.
* *
@ -179,6 +186,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
$options = $this->_parseOptions($options, $callbacks); $options = $this->_parseOptions($options, $callbacks);
return '$.ajax({' . $options .'});'; return '$.ajax({' . $options .'});';
} }
/** /**
* Create a sortable element. * Create a sortable element.
* *
@ -194,6 +202,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
$template = '%s.sortable({%s});'; $template = '%s.sortable({%s});';
return $this->_methodTemplate('sortable', $template, $options, $callbacks); return $this->_methodTemplate('sortable', $template, $options, $callbacks);
} }
/** /**
* Create a Draggable element * Create a Draggable element
* *
@ -208,6 +217,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
$template = '%s.draggable({%s});'; $template = '%s.draggable({%s});';
return $this->_methodTemplate('drag', $template, $options, $callbacks); return $this->_methodTemplate('drag', $template, $options, $callbacks);
} }
/** /**
* Create a Droppable element * Create a Droppable element
* *
@ -222,6 +232,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
$template = '%s.droppable({%s});'; $template = '%s.droppable({%s});';
return $this->_methodTemplate('drop', $template, $options, $callbacks); return $this->_methodTemplate('drop', $template, $options, $callbacks);
} }
/** /**
* Create a Slider element * Create a Slider element
* *

View file

@ -67,6 +67,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
'step' => 'steps' 'step' => 'steps'
) )
); );
/** /**
* Create javascript selector for a CSS rule * Create javascript selector for a CSS rule
* *
@ -85,6 +86,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
$this->selection = '$$("' . $selector . '")'; $this->selection = '$$("' . $selector . '")';
return $this; return $this;
} }
/** /**
* Add an event to the script cache. Operates on the currently selected elements. * Add an event to the script cache. Operates on the currently selected elements.
* *
@ -112,6 +114,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
$out = $this->selection . ".addEvent(\"{$type}\", $callback);"; $out = $this->selection . ".addEvent(\"{$type}\", $callback);";
return $out; return $out;
} }
/** /**
* Create a domReady event. This is a special event in many libraries * Create a domReady event. This is a special event in many libraries
* *
@ -122,6 +125,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
$this->selection = 'window'; $this->selection = 'window';
return $this->event('domready', $functionBody, array('stop' => false)); return $this->event('domready', $functionBody, array('stop' => false));
} }
/** /**
* Create an iteration over the current selection result. * Create an iteration over the current selection result.
* *
@ -132,6 +136,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
function each($callback) { function each($callback) {
return $this->selection . '.each(function (item, index) {' . $callback . '});'; return $this->selection . '.each(function (item, index) {' . $callback . '});';
} }
/** /**
* Trigger an Effect. * Trigger an Effect.
* *
@ -171,6 +176,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
} }
return $this->selection . '.' . $effect . ';'; return $this->selection . '.' . $effect . ';';
} }
/** /**
* Create an new Request. * Create an new Request.
* *
@ -207,6 +213,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
$options = $this->_parseOptions($options, $callbacks); $options = $this->_parseOptions($options, $callbacks);
return "var jsRequest = new Request$type({{$options}}).send($data);"; return "var jsRequest = new Request$type({{$options}}).send($data);";
} }
/** /**
* Create a sortable element. * Create a sortable element.
* *
@ -222,6 +229,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
$options = $this->_parseOptions($options, $callbacks); $options = $this->_parseOptions($options, $callbacks);
return 'var jsSortable = new Sortables(' . $this->selection . ', {' . $options . '});'; return 'var jsSortable = new Sortables(' . $this->selection . ', {' . $options . '});';
} }
/** /**
* Create a Draggable element. * Create a Draggable element.
* *
@ -237,6 +245,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
$options = $this->_parseOptions($options, $callbacks); $options = $this->_parseOptions($options, $callbacks);
return 'var jsDrag = new Drag(' . $this->selection . ', {' . $options . '});'; return 'var jsDrag = new Drag(' . $this->selection . ', {' . $options . '});';
} }
/** /**
* Create a Droppable element. * Create a Droppable element.
* *
@ -276,6 +285,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
$this->selection = $options['droppables']; $this->selection = $options['droppables'];
return $out; return $out;
} }
/** /**
* Create a slider control * Create a slider control
* *

View file

@ -67,6 +67,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
'value' => 'sliderValue', 'value' => 'sliderValue',
) )
); );
/** /**
* Create javascript selector for a CSS rule * Create javascript selector for a CSS rule
* *
@ -85,6 +86,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
$this->selection = '$$("' . $selector . '")'; $this->selection = '$$("' . $selector . '")';
return $this; return $this;
} }
/** /**
* Add an event to the script cache. Operates on the currently selected elements. * Add an event to the script cache. Operates on the currently selected elements.
* *
@ -112,6 +114,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
$out = $this->selection . ".observe(\"{$type}\", $callback);"; $out = $this->selection . ".observe(\"{$type}\", $callback);";
return $out; return $out;
} }
/** /**
* Create a domReady event. This is a special event in many libraries * Create a domReady event. This is a special event in many libraries
* *
@ -122,6 +125,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
$this->selection = 'document'; $this->selection = 'document';
return $this->event('dom:loaded', $functionBody, array('stop' => false)); return $this->event('dom:loaded', $functionBody, array('stop' => false));
} }
/** /**
* Create an iteration over the current selection result. * Create an iteration over the current selection result.
* *
@ -132,6 +136,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
function each($callback) { function each($callback) {
return $this->selection . '.each(function (item, index) {' . $callback . '});'; return $this->selection . '.each(function (item, index) {' . $callback . '});';
} }
/** /**
* Trigger an Effect. * Trigger an Effect.
* *
@ -176,6 +181,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
} }
return $effect; return $effect;
} }
/** /**
* Create an Ajax or Ajax.Updater call. * Create an Ajax or Ajax.Updater call.
* *
@ -203,6 +209,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
} }
return "var jsRequest = new Ajax$type($url$options);"; return "var jsRequest = new Ajax$type($url$options);";
} }
/** /**
* Create a sortable element. * Create a sortable element.
* *
@ -221,6 +228,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
} }
return 'var jsSortable = Sortable.create(' . $this->selection . $options . ');'; return 'var jsSortable = Sortable.create(' . $this->selection . $options . ');';
} }
/** /**
* Create a Draggable element. * Create a Draggable element.
* *
@ -239,6 +247,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
} }
return 'var jsDrag = new Draggable(' . $this->selection . $options . ');'; return 'var jsDrag = new Draggable(' . $this->selection . $options . ');';
} }
/** /**
* Create a Droppable element. * Create a Droppable element.
* *
@ -257,6 +266,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
} }
return 'Droppables.add(' . $this->selection . $options . ');'; return 'Droppables.add(' . $this->selection . $options . ');';
} }
/** /**
* Creates a slider control widget. * Creates a slider control widget.
* *

View file

@ -272,7 +272,6 @@ class PrototypeEngineHelperTestCase extends CakeTestCase {
)); ));
$expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {axis:"horizontal", onChange:onComplete, onSlide:onChange, sliderValue:4});'; $expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {axis:"horizontal", onChange:onComplete, onSlide:onChange, sliderValue:4});';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
} }
?> ?>