1
0

Attempt to fix #3, support for a sidebar

This commit is contained in:
Fredrik Erlandsson 2012-01-09 16:06:41 +01:00
parent 13b0419c32
commit 9499b7bf3d
4 changed files with 53 additions and 19 deletions

View File

@ -46,6 +46,10 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
module::clear_var("th_pear4gallery3", "show_logo");
module::set_var("th_pear4gallery3", "hide_logo", FALSE);
endif;
if (module::get_var("th_pear4gallery3", "show_sidebar")):
module::clear_var("th_pear4gallery3", "show_sidebar");
module::set_var("th_pear4gallery3", "sidebar_view", "toggle");
endif;
}
protected function get_edit_form_admin() {
@ -99,9 +103,10 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
$group->checkbox("show_breadcrumbs")
->label(t("Show breadcrumbs for navigation."))
->checked(module::get_var("th_pear4gallery3", "show_breadcrumbs"));
$group->checkbox("show_sidebar")
->label(t("Show Sidebar"))
->checked(module::get_var("th_pear4gallery3", "show_sidebar"));
$group->dropdown("sidebar_view")
->label(t("Show Sidebar mode"))
->options(array("hidden" => t("Hidden (Default)"), "static" => t("Always visible"), "toggle" => t("Toggleable")))
->selected(module::get_var("th_pear4gallery3", "sidebar_view"));
$group->input("ga_code")
->label(t("<a href=\"http://www.google.com/analytics/\">Google analytics</a> code."))
->value(module::get_var("th_pear4gallery3", "ga_code"));
@ -189,6 +194,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
module::clear_var("th_pear4gallery3", "background");
module::clear_var("th_pear4gallery3", "show_breadcrumbs");
module::clear_var("th_pear4gallery3", "show_sidebar");
module::clear_var("th_pear4gallery3", "sidebar_view");
module::clear_var("th_pear4gallery3", "ga_code");
}
@ -274,7 +280,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
$this->save_item_state("show_guest_menu",$form->edit_theme_adv_main->show_guest_menu->value, TRUE);
$this->save_item_state("background", $form->edit_theme_adv_main->background->value != "black", $form->edit_theme_adv_main->background->value);
$this->save_item_state("show_breadcrumbs",$form->edit_theme_adv_main->show_breadcrumbs->value, TRUE);
$this->save_item_state("show_sidebar",$form->edit_theme_adv_main->show_sidebar->value, TRUE);
$this->save_item_state("sidebar_view",$form->edit_theme_adv_main->sidebar_view->value != "hidden", $form->edit_theme_adv_main->sidebar_view->value);
$this->save_item_state("ga_code", $form->edit_theme_adv_main->ga_code->value, $form->edit_theme_adv_main->ga_code->value);
// * Advanced Options - Photo page ***************************************

View File

@ -50,16 +50,6 @@ function getCookie(c_name) {
}
return "";
}
function toggleSidebar() {
if ($('#sidebar').length === 0) { return; }
if ($('#sidebar').is(':visible')) {
$('#sidebar').hide('slide', { direction: 'right'}, 1000);
$('#mosaicGridContainer').animate( { width: '+=220' }, 1000, function () { mosaicResize(); });
} else {
$('#sidebar').show('slide', { direction: 'right'}, 1000);
$('#mosaicGridContainer').animate( { width: '-=220' }, 1000, function () { mosaicResize(); });
}
}
function mosaicResize() {
if ($('#mosaicGridContainer').length === 0) {
@ -101,8 +91,8 @@ function mosaicResize() {
myHeight += 18;
}
/*Sidebar*/
if ($('#sidebar').is(':visible')) { myWidth = myWidth - 220; }
$('#sidebar').css('height', (myHeight + 53) + "px");
if ($('#sidebarContainer').is(':visible')) { myWidth = myWidth - $('#sidebarContainer').width(); }
$('#sidebarContainer').css('height', (myHeight + 53) + "px");
if (!mosaicView) {
$('#mosaicGridContainer').css({'height': (myHeight + 33) + "px", 'width': myWidth + "px"});
} else {
@ -585,3 +575,37 @@ function preFetch() {
}
}
function toggleSidebar() {
if ($('#sidebar').length === 0) { return; }
if ($('#sidebar').is(':visible')) {
$('#sidebar').hide('slide', { direction: 'right'}, 1000);
$('#mosaicGridContainer').animate( { width: '+=220' }, 1000, function () { mosaicResize(); });
} else {
$('#sidebar').show('slide', { direction: 'right'}, 1000);
$('#mosaicGridContainer').animate( { width: '-=220' }, 1000, function () { mosaicResize(); });
}
}
function sidebarInit(mode) {
switch (mode) {
case 'toggle':
$('#sidebarContainer').width(5);
$('#sidebarContainer').hover(function () {
$('#sidebarContainer').animate( { width: '225' }, 500);
//$('#sidebar').show('slide', { direction: 'right'}, 1000);
$('#mosaicGridContainer').animate( { width: '-=225' }, 500, function () { mosaicResize(); }); },
function () {
$('#sidebarContainer').animate( { width: '5' }, 500);
//$('#sidebar').hide('slide', { direction: 'right'}, 1000);
$('#mosaicGridContainer').animate( { width: '+=225' }, 500, function () { mosaicResize(); });
});
break;
case 'static':
break;
//case 'hidden':
default:
$('#sidebarContainer').hide();
break;
}
}

View File

@ -1,6 +1,6 @@
name = ".Pear Theme"
description = "A theme with the intention to mimic Apples mobile me gallery."
version = 2.7.1
version = 2.7.2
author = "Fredrik Erlandsson <fredrik.e@gmail.com>"
site = 1
admin = 0

View File

@ -2,6 +2,7 @@
<? /* Placeholder for infromation in mosaic view. */ ?>
<script type="text/javascript">
$(function() {
sidebarInit('<?=module::get_var("th_pear4gallery3", "sidebar_view")?>');
bodyLoad( "<?=module::get_var("th_pear4gallery3", "mainmenu_view")?>",
"<?=module::get_var("th_pear4gallery3", "background")?>");
});
@ -97,13 +98,16 @@ endif;
<? endif; ?>
<? endif; ?>
</div>
<? if (module::get_var("th_pear4gallery3", "show_sidebar")): ?>
<? if (module::get_var("th_pear4gallery3", "sidebar_view") != ''): ?>
</td><td>
<div id="sidebar" class="sidebar" style="width: 220px;">
<div id="sidebarContainer">
<div id="sidebarBorder" style="background-color: darkGrey; width: 5px; height: 100%; position: absolute;"></div>
<div id="sidebar" class="sidebar" style="width: 220px; position: aboslute; padding-left: 5px;">
<? if ($theme->page_subtype != "login"): ?>
<?= new View("sidebar.html") ?>
<? endif ?>
</div>
</div>
<? endif ?>
</td></tr></table>
<div id="pearFlowPadd" class="imageflow" style="display: none;"></div>