Skip to content

Commit

Permalink
Converging on 4px for border-radius.
Browse files Browse the repository at this point in the history
Updating debug() to output a tiny bit more HTML so it can be made sexy.
  • Loading branch information
markstory committed Sep 3, 2011
1 parent 1c40a37 commit ca078d9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
41 changes: 30 additions & 11 deletions app/webroot/css/cake.generic.css
Expand Up @@ -209,10 +209,10 @@ table td.actions a {
}
.paging .prev {
border-left: 1px solid #ccc;
border-radius: 5px 0 0 5px;
border-radius: 4px 0 0 4px;
}
.paging .next {
border-radius: 0 5px 5px 0;
border-radius: 0 4px 4px 0;
}
.paging .disabled {
color: #ddd;
Expand Down Expand Up @@ -361,7 +361,7 @@ form .submit input[type=submit]:hover {
/* Form errors */
form .error {
background: #FFDACC;
border-radius: 5px;
border-radius: 4px;
font-weight: normal;
}
form .error-message {
Expand Down Expand Up @@ -500,9 +500,9 @@ input[type=submit],
background-image: linear-gradient(top, #fefefe, #dcdcdc);
color:#333;
border:1px solid #bbb;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
text-decoration: none;
text-shadow: #fff 0px 1px 0px;
min-width: 0;
Expand Down Expand Up @@ -548,12 +548,31 @@ pre {
padding: 15px;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}
.cake-debug-output {
padding: 0;
position: relative;
}
.cake-debug-output > span {
position: absolute;
top: 5px;
right: 5px;
background: rgba(255, 255, 255, 0.3);
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
padding: 5px 6px;
color: #000;
display: block;
float: left;
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.5);
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}
.cake-debug,
.cake-error {
font-size: 120%;
line-height: 140%;
margin-top: 1em;
position: relative;
font-size: 16px;
line-height: 20px;
margin-top: 24px;
clear: both;
}
.cake-error > a {
text-shadow: none;
Expand All @@ -567,7 +586,7 @@ pre {
line-height: 140%;
overflow: auto;
position: relative;
border-radius: 5px;
border-radius: 4px;
}
.cake-stack-trace a {
text-shadow: none;
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Test/Case/BasicsTest.php
Expand Up @@ -677,23 +677,23 @@ public function testDebug() {
$pattern = '/(.+?Test(\/|\\\)Case(\/|\\\)BasicsTest\.php|';
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*this-is-a-test.*/s';
$this->assertPattern($pattern, $result);
$this->assertRegExp($pattern, $result);

ob_start();
debug('<div>this-is-a-test</div>', true);
$result = ob_get_clean();
$pattern = '/(.+?Test(\/|\\\)Case(\/|\\\)BasicsTest\.php|';
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*&lt;div&gt;this-is-a-test&lt;\/div&gt;.*/s';
$this->assertPattern($pattern, $result);
$pattern .= '.*line.*' . (__LINE__ -4) . '.*&lt;div&gt;this-is-a-test&lt;\/div&gt;.*/s';
$this->assertRegExp($pattern, $result);

ob_start();
debug('<div>this-is-a-test</div>', false);
$result = ob_get_clean();
$pattern = '/(.+?Test(\/|\\\)Case(\/|\\\)BasicsTest\.php|';
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*\<div\>this-is-a-test\<\/div\>.*/s';
$this->assertPattern($pattern, $result);
$this->assertRegExp($pattern, $result);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions lib/Cake/basics.php
Expand Up @@ -82,10 +82,12 @@ function debug($var = false, $showHtml = null, $showFrom = true) {
$line = $calledFrom[0]['line'];
}
$html = <<<HTML
<strong>%s</strong> (line <strong>%s</strong>)
<div class="cake-debug-output">
<span><strong>%s</strong> (line <strong>%s</strong>)</span>
<pre class="cake-debug">
%s
</pre>
</div>
HTML;
$text = <<<TEXT
Expand All @@ -104,7 +106,7 @@ function debug($var = false, $showHtml = null, $showFrom = true) {
}
$var = print_r($var, true);
if ($showHtml) {
$var = str_replace(array('<', '>'), array('&lt;', '&gt;'), $var);
$var = htmlentities($var);
}
printf($template, $file, $line, $var);
}
Expand Down

0 comments on commit ca078d9

Please sign in to comment.