toggler in default setup theme

This commit is contained in:
Shish 2012-03-10 02:04:15 +00:00
parent e5f4b5ffa1
commit b5bca91bee
2 changed files with 11 additions and 39 deletions

View file

@ -87,7 +87,17 @@ class SetupTheme extends Themelet {
}
protected function sb_to_html(SetupBlock $block) {
return "<div class='setupblock'><b>{$block->header}</b><br>{$block->body}</div>\n";
$h = $block->header;
$b = $block->body;
$i = preg_replace('/[^a-zA-Z0-9]/', '_', $h) . "-setup";
$html = "
<div class='setupblock brr'>
<b class='shm-toggler' data-toggle-id='$i'>$h</b>
<br><div id='$i'>$b</div>
</div>
<!-- cancel border -->
";
return $html;
}
}
?>

View file

@ -1,38 +0,0 @@
<?php
/**
* A customised version of the Setup theme
*/
class CustomSetupTheme extends SetupTheme {
protected function sb_to_html(SetupBlock $block) {
$h = $block->header;
$b = $block->body;
$i = preg_replace('/[^a-zA-Z0-9]/', '_', $h) . "-setup";
$html = "
<script type='text/javascript'><!--
$(document).ready(function() {
$(\"#$i-toggle\").click(function() {
$(\"#$i\").slideToggle(\"slow\", function() {
if($(\"#$i\").is(\":hidden\")) {
$.cookie(\"$i-hidden\", 'true', {path: '/'});
}
else {
$.cookie(\"$i-hidden\", 'false', {path: '/'});
}
});
});
if($.cookie(\"$i-hidden\") == 'true') {
$(\"#$i\").hide();
}
});
//--></script>
<div class='setupblock brr'>
<b id='$i-toggle'>$h</b>
<br><div id='$i'>$b</div>
</div>
<!-- cancel border -->
";
return $html;
}
}
?>