Added an option for hiding the sidebar on Pages, as per forum request.
This commit is contained in:
parent
48f631ac75
commit
8ae32f4d84
|
@ -25,6 +25,7 @@ class Admin_Pages_Controller extends Admin_Controller {
|
||||||
$view->content = new View("admin_pages.html");
|
$view->content = new View("admin_pages.html");
|
||||||
$query = ORM::factory("static_page");
|
$query = ORM::factory("static_page");
|
||||||
$view->content->pages = $query->order_by("name", "ASC")->find_all();
|
$view->content->pages = $query->order_by("name", "ASC")->find_all();
|
||||||
|
$view->content->form = $this->get_prefs_form();
|
||||||
print $view;
|
print $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,4 +240,32 @@ class Admin_Pages_Controller extends Admin_Controller {
|
||||||
// Generate a form for editing an existing page. Reuse the overwrite form for as it's basically the same thing.
|
// Generate a form for editing an existing page. Reuse the overwrite form for as it's basically the same thing.
|
||||||
return ($this->get_overwrite_page_form($existing_page->id, $existing_page->name, $existing_page->title, $existing_page->html_code, $existing_page->display_menu));
|
return ($this->get_overwrite_page_form($existing_page->id, $existing_page->name, $existing_page->title, $existing_page->html_code, $existing_page->display_menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function get_prefs_form() {
|
||||||
|
// Generate a form for global preferences.
|
||||||
|
$form = new Forge("admin/pages/saveprefs", "", "post",
|
||||||
|
array("id" => "g-pages-admin-form"));
|
||||||
|
|
||||||
|
$pages_group = $form->group("preferences")->label(t("Settings"));
|
||||||
|
$pages_group->checkbox("display_sidebar")
|
||||||
|
->label(t("Display sidebar on Pages?"))
|
||||||
|
->checked(module::get_var("pages", "show_sidebar"));
|
||||||
|
$pages_group->submit("save_prefs")
|
||||||
|
->value(t("Save"));
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveprefs() {
|
||||||
|
// Save a preferences to the database.
|
||||||
|
|
||||||
|
access::verify_csrf();
|
||||||
|
|
||||||
|
// Save form variables.
|
||||||
|
module::set_var("pages", "show_sidebar", Input::instance()->post("display_sidebar"));
|
||||||
|
|
||||||
|
// Display message and load main pages admin screen.
|
||||||
|
message::success(t("Your settings have been saved."));
|
||||||
|
url::redirect("admin/pages");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<div class="g-block">
|
<div class="g-block">
|
||||||
<h1> <?= t("Manage pages") ?> </h1>
|
<h1> <?= t("Manage pages") ?> </h1>
|
||||||
|
<?= $form; ?>
|
||||||
<div class="g-block-content">
|
<div class="g-block-content">
|
||||||
<table id="g-page-admin">
|
<table id="g-page-admin">
|
||||||
<caption>
|
<caption>
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<? if (module::get_var("pages", "show_sidebar")) : ?>
|
||||||
|
<style type="text/css">
|
||||||
|
#g-sidebar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#g-content {
|
||||||
|
width: 950px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<? endif ?>
|
||||||
<div class="g-page-block">
|
<div class="g-page-block">
|
||||||
<h1> <?= $title ?> </h1>
|
<h1> <?= $title ?> </h1>
|
||||||
<div class="g-page-block-content">
|
<div class="g-page-block-content">
|
||||||
|
|
|
@ -25,6 +25,7 @@ class Admin_Pages_Controller extends Admin_Controller {
|
||||||
$view->content = new View("admin_pages.html");
|
$view->content = new View("admin_pages.html");
|
||||||
$query = ORM::factory("static_page");
|
$query = ORM::factory("static_page");
|
||||||
$view->content->pages = $query->order_by("name", "ASC")->find_all();
|
$view->content->pages = $query->order_by("name", "ASC")->find_all();
|
||||||
|
$view->content->form = $this->get_prefs_form();
|
||||||
print $view;
|
print $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,4 +240,32 @@ class Admin_Pages_Controller extends Admin_Controller {
|
||||||
// Generate a form for editing an existing page. Reuse the overwrite form for as it's basically the same thing.
|
// Generate a form for editing an existing page. Reuse the overwrite form for as it's basically the same thing.
|
||||||
return ($this->get_overwrite_page_form($existing_page->id, $existing_page->name, $existing_page->title, $existing_page->html_code, $existing_page->display_menu));
|
return ($this->get_overwrite_page_form($existing_page->id, $existing_page->name, $existing_page->title, $existing_page->html_code, $existing_page->display_menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function get_prefs_form() {
|
||||||
|
// Generate a form for global preferences.
|
||||||
|
$form = new Forge("admin/pages/saveprefs", "", "post",
|
||||||
|
array("id" => "g-pages-admin-form"));
|
||||||
|
|
||||||
|
$pages_group = $form->group("preferences")->label(t("Settings"));
|
||||||
|
$pages_group->checkbox("display_sidebar")
|
||||||
|
->label(t("Display sidebar on Pages?"))
|
||||||
|
->checked(module::get_var("pages", "show_sidebar"));
|
||||||
|
$pages_group->submit("save_prefs")
|
||||||
|
->value(t("Save"));
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveprefs() {
|
||||||
|
// Save a preferences to the database.
|
||||||
|
|
||||||
|
access::verify_csrf();
|
||||||
|
|
||||||
|
// Save form variables.
|
||||||
|
module::set_var("pages", "show_sidebar", Input::instance()->post("display_sidebar"));
|
||||||
|
|
||||||
|
// Display message and load main pages admin screen.
|
||||||
|
message::success(t("Your settings have been saved."));
|
||||||
|
url::redirect("admin/pages");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<div class="g-block">
|
<div class="g-block">
|
||||||
<h1> <?= t("Manage pages") ?> </h1>
|
<h1> <?= t("Manage pages") ?> </h1>
|
||||||
|
<?= $form; ?>
|
||||||
<div class="g-block-content">
|
<div class="g-block-content">
|
||||||
<table id="g-page-admin">
|
<table id="g-page-admin">
|
||||||
<caption>
|
<caption>
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<? if (module::get_var("pages", "show_sidebar")) : ?>
|
||||||
|
<style type="text/css">
|
||||||
|
#g-sidebar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#g-content {
|
||||||
|
width: 950px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<? endif ?>
|
||||||
<div class="g-page-block">
|
<div class="g-page-block">
|
||||||
<h1> <?= $title ?> </h1>
|
<h1> <?= $title ?> </h1>
|
||||||
<div class="g-page-block-content">
|
<div class="g-page-block-content">
|
||||||
|
|
Reference in New Issue
Block a user