This commit is contained in:
Marcin Kurczewski 2013-10-12 22:37:18 +02:00
parent 6e7791e94b
commit 21f4669a98
12 changed files with 176 additions and 186 deletions

View file

@ -136,6 +136,8 @@ a:hover i[class*='icon-'] {
padding: 10px;
border-style: solid;
border-width: 1px;
max-width: 500px;
margin: 0 auto;
}
.alert-error {

View file

@ -26,6 +26,7 @@ class Bootstrap
$this->config->chibi->baseUrl = 'http://' . rtrim($_SERVER['HTTP_HOST'], '/') . '/';
session_start();
$this->context->handleExceptions = false;
$this->context->title = $this->config->main->title;
$this->context->stylesheets =
[
@ -63,6 +64,8 @@ class Bootstrap
$this->context->transport->errorMessage = rtrim($e->getMessage(), '.') . '.';
$this->context->transport->exception = $e;
$this->context->transport->success = false;
if (!$this->context->handleExceptions)
$this->context->viewName = 'error-simple';
(new \Chibi\View())->renderFile($this->context->layoutName);
}
catch (Exception $e)

View file

@ -12,6 +12,7 @@ class AuthController
*/
public function loginAction()
{
$this->context->handleExceptions = true;
$this->context->stylesheets []= 'auth.css';
$this->context->subTitle = 'authentication form';
@ -62,6 +63,7 @@ class AuthController
*/
public function registerAction()
{
$this->context->handleExceptions = true;
$this->context->stylesheets []= 'auth.css';
$this->context->subTitle = 'registration form';

View file

@ -8,6 +8,6 @@ class CommentController
{
$this->context->activeSection = 'comments';
$this->context->subTitle = 'comments';
throw new Exception('Not implemented');
throw new SimpleException('Not implemented');
}
}

View file

@ -7,7 +7,7 @@ class UserController
public function listAction()
{
$this->context->subTitle = 'users';
throw new Exception('Not implemented');
throw new SimpleException('Not implemented');
}
/**
@ -17,6 +17,6 @@ class UserController
public function viewAction($name)
{
$this->context->subTitle = $name;
throw new Exception('Not implemented');
throw new SimpleException('Not implemented');
}
}

View file

@ -4,7 +4,3 @@
<p>However, you still need to be approved by admin.</p>
<?php endif ?>
<?php endif ?>
<?php if (isset($this->context->transport->errorMessage)): ?>
<p class="alert alert-error"><?php echo $this->context->transport->errorMessage ?></p>
<?php endif ?>

View file

@ -0,0 +1 @@
<p class="alert alert-error">Error: <?php echo $this->context->transport->errorMessage ?><br><a href="javascript:history.go(-1)">Go back</a></p>

View file

@ -1,6 +1,4 @@
<?php if (!empty($this->context->transport->errorMessage)): ?>
<p class="alert alert-error"><?php echo $this->context->transport->errorMessage ?></p>
<?php elseif (empty($this->context->transport->posts)): ?>
<?php if (empty($this->context->transport->posts)): ?>
<p class="alert alert-warning">No posts to show.</p>
<?php else: ?>
<div class="posts paginator-content">

View file

@ -1,7 +1,5 @@
<?php if ($this->context->transport->success === true): ?>
<p>Post created!</p>
<?php elseif (isset($this->context->transport->errorMessage)): ?>
<p class="alert alert-error"><?php echo $this->context->transport->errorMessage ?></p>
<?php else: ?>
<div id="sidebar">

View file

@ -1,7 +1,3 @@
<?php if (!empty($this->context->transport->errorMessage)): ?>
<p class="alert alert-error"><?php echo $this->context->transport->errorMessage ?></p>
<?php else: ?>
<div id="sidebar">
<nav>
<div class="left">
@ -179,5 +175,3 @@
<?php endif ?>
</div>
</div>
<?php endif ?>

View file

@ -1,6 +1,3 @@
<?php if (isset($this->context->transport->errorMessage)): ?>
<p class="alert alert-error"><?php echo $this->context->transport->errorMessage ?></p>
<?php else: ?>
<ul>
<?php foreach ($this->context->transport->tagDistribution as $tagName => $count): ?>
<li>
@ -10,4 +7,3 @@
</li>
<?php endforeach ?>
</ul>
<?php endif ?>