Skip to content

Commit

Permalink
Fix Notice display to renderJSON method and add missing notice view (…
Browse files Browse the repository at this point in the history
…by default Bootstrap theme)
  • Loading branch information
ggallon committed Jan 24, 2015
1 parent e247cbf commit f45c5d5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
11 changes: 11 additions & 0 deletions application/views/notice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php if (isset($notice) && ! empty($notice)) : ?>
<div class="alert alert-<?= $notice['type'] ?> alert-dismissible" id="notice" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<?= $notice['message'] ?>
</div>

<?php else: ?>

<div id="notice"></div>

<?php endif; ?>
4 changes: 2 additions & 2 deletions myth/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ public function renderJSON($json)
if ($this->ajax_notices === true) {
if ( ! empty( $this->themer ) && ! empty( $this->theme ) )
{
$json['fragments']['#notices'] = $this->themer->display( "{$this->theme}:notice", array( 'notice' => $this->message() ) );
$json['fragments']['#notice'] = $this->themer->display( "{$this->theme}:notice", array( 'notice' => $this->message() ) );
}
else if (file_exists(APPPATH .'views/notice.php'))
{
$json['fragments']['#notices'] = $this->load->view_path( "notice", array( 'notice' => $this->message() ), TRUE );
$json['fragments']['#notice'] = $this->load->view_path( "notice", array( 'notice' => $this->message() ), TRUE );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap3/notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

<?php else: ?>

<div id="notices"></div>
<div id="notice"></div>

<?php endif; ?>
7 changes: 6 additions & 1 deletion themes/foundation5/notice.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php if (isset($notice) && ! empty($notice)) : ?>
<div class="alert-box <?= $notice['type'] ?>" data-alert role="alert">
<div class="alert-box <?= $notice['type'] ?>" data-alert id="notice" role="alert">
<?= $notice['message'] ?>
<a href="#" class="close">&times;</a>
</div>

<?php else: ?>

<div id="notice"></div>

<?php endif; ?>

0 comments on commit f45c5d5

Please sign in to comment.