Skip to content

Commit

Permalink
Merge pull request #19 from bluzphp/develop
Browse files Browse the repository at this point in the history
Changed rules for JS handlers
  • Loading branch information
Anton authored Nov 6, 2017
2 parents 9975a1f + 14d3aaf commit 2739031
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 27 deletions.
4 changes: 2 additions & 2 deletions application/modules/contact-us/views/crud.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
?>
<?php $uid = uniqid('form_', false); ?>
<form id="<?= $uid ?>" action="<?= $this->url('contact-us', 'crud') ?>" class="form-horizontal ajax"
method="<?= $method ?>">
<form id="<?= $uid ?>" action="<?= $this->url('contact-us', 'crud') ?>" class="form-horizontal"
data-ajax method="<?= $method ?>">
<input type="hidden" name="id" value="<?= $row->id ?>"/>
<input type="hidden" name="_method" value="<?= $method ?>"/>
<div class="modal-content">
Expand Down
39 changes: 21 additions & 18 deletions application/modules/contact-us/views/grid.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
<div class="clearfix" data-spy="grid" data-grid="<?= $grid->getUid() ?>">
<nav class="navbar navbar-light bg-light justify-content-between">
<div>
<a href="<?= $grid->filter('markRead', 'eq', '', true) ?>" class="btn btn-secondary navbar-btn ajax <?= (
<a href="<?= $grid->filter('markRead', 'eq', '', true) ?>" class="btn btn-secondary navbar-btn <?= (
$grid->getFilter('markRead', 'eq') === null && $grid->getFilter('markRead', 'ne') === null ? 'btn-info' : ''
) ?>">all</a>
<a href="<?= $grid->filter('markRead', 'ne', 1) ?>" class="btn btn-secondary navbar-btn ajax <?= (
) ?>" data-ajax>all</a>
<a href="<?= $grid->filter('markRead', 'ne', 1) ?>" class="btn btn-secondary navbar-btn <?= (
$grid->getFilter('markRead', 'ne') ? 'btn-info' : ''
) ?>">Unread</a>
<a href="<?= $grid->filter('markRead', 'eq', 1) ?>" class="btn btn-secondary navbar-btn ajax <?= (
) ?>" data-ajax>Unread</a>
<a href="<?= $grid->filter('markRead', 'eq', 1) ?>" class="btn btn-secondary navbar-btn <?= (
$grid->getFilter('markRead', 'eq') ? 'btn-info' : ''
) ?>">Read</a>
) ?>" data-ajax>Read</a>
</div>
<form action="<?= $this->url('contact-us', 'grid') ?>" class="form-inline filter-form">
<form action="<?= $this->url('contact-us', 'grid') ?>" class="form-inline filter-form" data-ajax>
<div class="input-group">
<?php echo
$this->partial(
Expand Down Expand Up @@ -56,48 +56,51 @@
<th><a href="<?= $grid->order('name') ?: '#' ?>"><?= __('Name') ?></a></th>
<th><a href="<?= $grid->order('email') ?: '#' ?>"><?= __('Email') ?></a></th>
<th width="130px"><a href="<?= $grid->order('subject') ?: '#' ?>"><?= __('Subject') ?></a></th>
<th><a href="<?= $grid->order('markRead') ?: '#' ?>"><?= __('Readed') ?></a></th>
<th><a href="<?= $grid->order('markRead') ?: '#' ?>"><?= __('Read') ?></a></th>
<th><a href="<?= $grid->order('markAnswered') ?: '#' ?>"><?= __('Answered') ?></a></th>
<th><a href="<?= $grid->order('created') ?>"><?= __('Created') ?></a></th>
<th width="180px"></th>
</tr>
</thead>
<tbody>
<?php foreach ($grid->getData() as $row) : ?>
<tr data-id="<?= $row['id'] ?>" class="<?= ($row['markRead'] == 0) ? 'bold' : '' ?>">
<tr data-id="<?= $row['id'] ?>" class="<?= ($row['markRead'] === 0) ? 'bold' : '' ?>">
<td><?= $row['id'] ?></td>
<td><?= $row['userId']
? $this->ahref(esc($row['name']), ['users', 'profile', ['id' => $row['userId']]])
: esc($row['name']) ?></td>
<td><a href="mailto:<?= $row['email'] ?>"><?= $row['email'] ?></a></td>
<td>
<a id="subject" href="<?= $this->url('contact-us', 'read', ['id' => $row['id']]) ?>" class="dialog"
data-ajax-method="get" data-modal-style="width:700px;">
<a id="subject" href="<?= $this->url('contact-us', 'read', ['id' => $row['id']]) ?>"
data-ajax-dialog data-ajax-method="get" data-modal-style="width:700px;">
<?= esc($row['subject']) ?>
</a>
</td>
<td>
<a id="read" href="<?= $this->url('contact-us', 'read', ['id' => $row['id']]) ?>" class="btn btn-xs ajax">
<a id="read" href="<?= $this->url('contact-us', 'read', ['id' => $row['id']]) ?>" class="btn"
data-ajax>
<i class="fa <?= ($row['markRead']) ? 'fa-check-square-o' : 'fa-square-o' ?>"></i>
</a>
</td>
<td>
<a id="answer" href="<?= $this->url('contact-us', 'answer', ['id' => $row['id']]) ?>" class="btn btn-xs ajax">
<a id="answer" href="<?= $this->url('contact-us', 'answer', ['id' => $row['id']]) ?>" class="btn"
data-ajax>
<i class="fa <?= ($row['markAnswered']) ? 'fa-check-square-o' : 'fa-square-o' ?>"></i>
</a>
</td>
<td><?= $row['created'] ?></td>
<td class="controls">
<a href="<?= $this->url('contact-us', 'reply', ['id' => $row['id']]) ?>"
class="btn btn-secondary btn-xs dialog reply" data-ajax-method="get" data-modal-style="width:700px;">
class="btn btn-secondary btn-xs reply"
data-ajax-dialog data-ajax-method="get" data-modal-style="width:700px;">
<i class="fa fa-share"></i>
</a>
<a href="<?= $this->url('contact-us', 'crud', ['id' => $row['id']]) ?>" class="btn btn-primary btn-xs dialog"
data-ajax-method="get" data-modal-style="width:700px">
<a href="<?= $this->url('contact-us', 'crud', ['id' => $row['id']]) ?>" class="btn btn-primary"
data-ajax-dialog data-ajax-method="get" data-modal-style="width:700px">
<i class="fa fa-pencil"></i>
</a>
<a href="<?= $this->url('contact-us', 'crud', ['id' => $row['id']]) ?>"
class="confirm btn btn-xs btn-danger ajax" data-ajax-method="delete">
<a href="<?= $this->url('contact-us', 'crud', ['id' => $row['id']]) ?>" class="btn btn-danger"
data-confirm data-ajax data-ajax-method="delete">
<i class="fa fa-trash-o"></i>
</a>
</td>
Expand Down
2 changes: 1 addition & 1 deletion application/modules/contact-us/views/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
?>
<?php $uid = uniqid('form_', false); ?>
<form id="<?= $uid ?>" class="form-horizontal ajax" method="post" action="<?= $this->url('contact-us', 'index') ?>"
<form id="<?= $uid ?>" class="form-horizontal" data-ajax method="post" action="<?= $this->url('contact-us', 'index') ?>"
enctype="application/x-www-form-urlencoded">
<div class="modal-header">
<h3 class="modal-title"><?= __('Contact us') ?></h3>
Expand Down
10 changes: 5 additions & 5 deletions application/modules/contact-us/views/read.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
</div>
<div class="modal-footer">
<div class="controls pull-left">
<a href="<?= $this->url('contact-us', 'reply', ['id' => $row['id']]) ?>" class="btn btn-primary btn-xs dialog"
data-ajax-method="get" data-modal-style="width:700px;">
<a href="<?= $this->url('contact-us', 'reply', ['id' => $row['id']]) ?>" class="btn btn-primary"
data-ajax-dialog data-ajax-method="get" data-modal-style="width:700px;">
<i class="fa fa-share"></i>
</a>
<a href="<?= $this->url('contact-us', 'crud', ['id' => $row['id']]) ?>" class="confirm btn btn-xs btn-danger ajax"
data-ajax-method="delete">
<a href="<?= $this->url('contact-us', 'crud', ['id' => $row['id']]) ?>" class="btn btn-danger"
data-confirm data-ajax data-ajax-method="delete">
<i class="fa fa-trash-o"></i>
</a>
</div>
<form action="<?= $this->url('contact-us', 'grid') ?>" class="ajax" method="get">
<form action="<?= $this->url('contact-us', 'grid') ?>" data-ajax method="get">
<button type="submit" class="btn btn-default"><?= __('Close') ?></button>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion application/modules/contact-us/views/reply.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @var \Bluz\View\View $this
*/
?>
<form class="form-horizontal ajax" method="post" action="<?= $this->url('contact-us', 'reply') ?>"
<form class="form-horizontal" method="post" action="<?= $this->url('contact-us', 'reply') ?>" data-ajax
enctype="application/x-www-form-urlencoded">
<div class="modal-header">
<h4 class="modal-title"><?= __('Reply') ?></h4>
Expand Down

0 comments on commit 2739031

Please sign in to comment.