even better columns: CSS

This commit is contained in:
Shish 2012-02-12 09:51:25 +00:00
parent 830105193d
commit a2459da61b
2 changed files with 18 additions and 20 deletions

View File

@ -15,8 +15,6 @@ class SetupTheme extends Themelet {
public function display_page(Page $page, SetupPanel $panel) { public function display_page(Page $page, SetupPanel $panel) {
global $user; global $user;
$setupblock_html1 = "";
$setupblock_html2 = "";
usort($panel->blocks, "blockcmp"); usort($panel->blocks, "blockcmp");
@ -24,29 +22,16 @@ class SetupTheme extends Themelet {
* Try and keep the two columns even; count the line breaks in * Try and keep the two columns even; count the line breaks in
* each an calculate where a block would work best * each an calculate where a block would work best
*/ */
$len1 = 0; $setupblock_html = "";
$len2 = 0;
foreach($panel->blocks as $block) { foreach($panel->blocks as $block) {
if($block instanceof SetupBlock) { $html = $this->sb_to_html($block);
$html = $this->sb_to_html($block); $setupblock_html .= $this->sb_to_html($block);
$len = count(explode("<br>", $html))+1;
if($len1 <= $len2) {
$setupblock_html1 .= $this->sb_to_html($block);
$len1 += $len;
}
else {
$setupblock_html2 .= $this->sb_to_html($block);
$len2 += $len;
}
}
} }
$table = " $table = "
".make_form(make_link("setup/save"))." ".make_form(make_link("setup/save"))."
<table style='max-width: 1000px;'> <div class='setupblocks'>$setupblock_html</div>
<tr><td width='50%'>$setupblock_html1</td><td>$setupblock_html2</td></tr> <input type='submit' value='Save Settings'>
<tr><td colspan='2'><input type='submit' value='Save Settings'></td></tr>
</table>
</form> </form>
"; ";

View File

@ -200,6 +200,18 @@ UL {
padding: 8px 4px 8px 4px; padding: 8px 4px 8px 4px;
} }
.setupblocks {
column-width: 400px;
-moz-column-width: 400px;
-webkit-column-width: 400px;
max-width: 1200px;
margin: auto;
}
.setupblocks .rr {
column-break-inside: avoid;
-moz-column-break-inside: avoid;
-webkit-column-break-inside: avoid;
}
.setupblock { .setupblock {
text-align: center; text-align: center;
width: 100%; width: 100%;
@ -207,6 +219,7 @@ UL {
.setupblock TEXTAREA { .setupblock TEXTAREA {
width: 100%; width: 100%;
font-size: 0.75em; font-size: 0.75em;
resize: vertical;
} }
.helpable { .helpable {