Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Partial Revert "Adding optional param to remove colon on methods. All…

…ows use inside"

This reverts commit b29e130.
  • Loading branch information...
commit 912f6589d556f391daaa768dcd11ab34682ee0c0 1 parent e990c5b
@markstory markstory authored
View
34 cake/libs/view/helpers/js.php
@@ -254,23 +254,18 @@ function __construct() {
* Create an alert message in Javascript
*
* @param string $message Message you want to alter.
- * @param boolean $colon Whether you want a colon or not.
* @access public
- * @return string Completed alert() call.
+ * @return string completed alert()
**/
- function alert($message, $colon = true) {
- $out = 'alert("' . $this->escape($message) . '")';
- if ($colon) {
- $out .= ';';
- }
- return $out;
+ function alert($message) {
+ return 'alert("' . $this->escape($message) . '");';
}
/**
* Redirects to a URL
*
* @param mixed $url
* @param array $options
- * @return string
+ * @return string completed redirect in javascript
**/
function redirect($url = null) {
return 'window.location = "' . Router::url($url) . '";';
@@ -279,16 +274,11 @@ function redirect($url = null) {
* Create a confirm() message
*
* @param string $message Message you want confirmed.
- * @param boolean $colon Whether you want a colon or not.
* @access public
- * @return string Completed confirm() call
+ * @return string completed confirm()
**/
- function confirm($message, $colon = true) {
- $out = 'confirm("' . $this->escape($message) . '")';
- if ($colon) {
- $out .= ';';
- }
- return $out;
+ function confirm($message) {
+ return 'confirm("' . $this->escape($message) . '");';
}
/**
* Create a prompt() Javascript function
@@ -296,14 +286,10 @@ function confirm($message, $colon = true) {
* @param string $message Message you want to prompt.
* @param string $default Default message
* @access public
- * @return string completed prompt() call
+ * @return string completed prompt()
**/
- function prompt($message, $default = '', $colon = true) {
- $out = 'prompt("' . $this->escape($message) . '", "' . $this->escape($default) . '")';
- if ($colon) {
- $out .= ';';
- }
- return $out;
+ function prompt($message, $default = '') {
+ return 'prompt("' . $this->escape($message) . '", "' . $this->escape($default) . '");';
}
/**
* Generates a JavaScript object in JavaScript Object Notation (JSON)
View
16 cake/tests/cases/libs/view/helpers/js.test.php
@@ -302,10 +302,6 @@ function testPrompt() {
$expected = 'prompt("Hey, hey you", "hi!");';
$this->assertEqual($result, $expected);
- $result = $this->JsEngine->prompt('Hey, hey you', 'hi!', false);
- $expected = 'prompt("Hey, hey you", "hi!")';
- $this->assertEqual($result, $expected);
-
$result = $this->JsEngine->prompt('"Hey"', '"hi"');
$expected = 'prompt("\"Hey\"", "\"hi\"");';
$this->assertEqual($result, $expected);
@@ -322,11 +318,7 @@ function testAlert() {
$result = $this->JsEngine->alert('"Hey"');
$expected = 'alert("\"Hey\"");';
- $this->assertEqual($result, $expected);
-
- $result = $this->JsEngine->alert('Hey there', false);
- $expected = 'alert("Hey there")';
- $this->assertEqual($result, $expected);
+ $this->assertEqual($result, $expected);
}
/**
* test confirm generation
@@ -340,11 +332,7 @@ function testConfirm() {
$result = $this->JsEngine->confirm('"Are you sure?"');
$expected = 'confirm("\"Are you sure?\"");';
- $this->assertEqual($result, $expected);
-
- $result = $this->JsEngine->confirm('"Are you sure?"', false);
- $expected = 'confirm("\"Are you sure?\"")';
- $this->assertEqual($result, $expected);
+ $this->assertEqual($result, $expected);
}
/**
* test Redirect
Please sign in to comment.
Something went wrong with that request. Please try again.