Skip to content

Commit d714590

Browse files
author
Anton
authored
Merge pull request #16 from bluzphp/develop
Migrated to new skeleton
2 parents 1201b5c + 4c215bd commit d714590

File tree

7 files changed

+49
-44
lines changed

7 files changed

+49
-44
lines changed

application/modules/test/views/backbone.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ echo $this->scriptBlock('require(["test/backbone"]);');
3131
<!-- Template -->
3232
<script type="text/template" id="item-template">
3333
<div class="view">
34-
<label class="btn btn-xs btn-light"><%- name %></label>
34+
<label class="btn btn-light"><%- name %></label>
3535
<a class="destroy btn btn-xs btn-danger confirm"><span class="fa fa-times text-light"></span></a>
3636
</div>
3737
<input class="edit form-control" type="text" value="<%- name %>"/>

application/modules/test/views/crud-read.phtml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<?php endforeach; ?>
88
</dl>
99

10-
<a href="<?= $this->url('test', 'update', ['id' => $row->id]) ?>" class="btn dialog" data-ajax-method="GET">Edit</a>
11-
<a href="<?= $this->url('test', 'delete', ['id' => $row->id]) ?>" class="btn btn-danger ajax confirm"
12-
data-ajax-method="DELETE">Delete</a>
10+
<a href="<?= $this->url('test', 'update', ['id' => $row->id]) ?>" class="btn"
11+
data-aajax-dialog data-ajax-method="GET">Edit</a>
12+
<a href="<?= $this->url('test', 'delete', ['id' => $row->id]) ?>" class="btn btn-danger"
13+
data-confirm data-ajax data-ajax-method="DELETE">Delete</a>

application/modules/test/views/crud.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php $uid = uniqid('form_', false); ?>
2-
<form id="<?= $uid ?>" action="<?= $this->url('test', 'crud') ?>" class="form-horizontal ajax" method="<?= $method ?>">
2+
<form id="<?= $uid ?>" action="<?= $this->url('test', 'crud') ?>" class="form-horizontal"
3+
data-ajax method="<?= $method ?>">
34
<input type="hidden" name="id" value="<?= $row->id ?>"/>
45
<div class="modal-header">
56
<h3 class="modal-title">Test Table</h3>

application/modules/test/views/grid-sql.phtml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ if (!$grid) {
2323
<a href="<?= $grid->filter('id', 'ne', 42, false) ?>">AND without user with Id = 42</a> <br/>
2424
</p>
2525
<div class="input-group">
26-
<a href="<?= $this->url('test', 'crud') ?>" class="btn btn-primary pull-left dialog"
27-
data-ajax-method="get">Create</a>
26+
<a href="<?= $this->url('test', 'crud') ?>" class="btn btn-primary pull-left"
27+
data-ajax-dialog data-ajax-method="get">Create</a>
2828
</div>
2929
<hr/>
3030
<?= $this->partial('grid/total.phtml', ['grid' => $grid]) ?>
@@ -46,12 +46,12 @@ if (!$grid) {
4646
<td><?= $row['name'] ?></td>
4747
<td><?= $row['status'] ?></td>
4848
<td class="controls">
49-
<a href="<?= $this->url('test', 'crud', ['id' => $row['id']]) ?>" class="btn btn-xs btn-primary dialog"
50-
data-ajax-method="get">
49+
<a href="<?= $this->url('test', 'crud', ['id' => $row['id']]) ?>" class="btn btn-primary"
50+
data-ajax-dialog data-ajax-method="get">
5151
<i class="fa fa-pencil"></i>
5252
</a>
53-
<a href="<?= $this->url('test', 'crud', ['id' => $row['id']]) ?>" class="confirm btn btn-xs btn-danger ajax"
54-
data-ajax-method="delete">
53+
<a href="<?= $this->url('test', 'crud', ['id' => $row['id']]) ?>" class="btn btn-danger"
54+
data-confirm data-ajax data-ajax-method="delete">
5555
<i class="fa fa-times"></i>
5656
</a>
5757
</td>

application/modules/test/views/index.phtml

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,22 @@ $this->headScript($this->baseUrl('js/test/config.js'));
9797
<?= $this->ahref(
9898
'GET Record by ID:10',
9999
'test/rest/10',
100-
['class' => 'ajax btn btn-secondary', 'data-ajax-method' => 'GET']
100+
['class' => 'btn btn-secondary', 'data-ajax', 'data-ajax-method' => 'GET']
101101
); ?>
102102
<?= $this->ahref(
103103
'HEAD Record by ID:10',
104104
'test/rest/10',
105-
['class' => 'ajax btn btn-secondary', 'data-ajax-method' => 'HEAD']
105+
['class' => 'btn btn-secondary', 'data-ajax', 'data-ajax-method' => 'HEAD']
106106
); ?>
107107
<?= $this->ahref(
108108
'GET 10 Records',
109109
['test', 'rest'],
110-
['class' => 'ajax btn btn-secondary', 'data-ajax-method' => 'GET', 'id' => 'rest-get']
110+
['class' => 'btn btn-secondary', 'data-ajax', 'data-ajax-method' => 'GET', 'id' => 'rest-get']
111111
); ?>
112112
<?= $this->ahref(
113113
'HEAD 10 Records',
114114
['test', 'rest'],
115-
['class' => 'ajax btn btn-secondary', 'data-ajax-method' => 'HEAD']
115+
['class' => 'btn btn-secondary', 'data-ajax', 'data-ajax-method' => 'HEAD']
116116
); ?>
117117
</div>
118118
<hr/>
@@ -121,7 +121,8 @@ $this->headScript($this->baseUrl('js/test/config.js'));
121121
'<span class="badge badge-dark">1</span> POST Create Record',
122122
['test', 'rest'],
123123
[
124-
'class' => 'ajax btn btn-primary',
124+
'class' => 'btn btn-primary',
125+
'data-ajax',
125126
'data-ajax-method' => 'POST',
126127
'data-name' => 'Name',
127128
'data-email' => '[email protected]'
@@ -130,17 +131,17 @@ $this->headScript($this->baseUrl('js/test/config.js'));
130131
<?= $this->ahref(
131132
'<span class="badge badge-dark">2</span> GET Record',
132133
'/test/rest/10',
133-
['class' => 'ajax btn btn-success', 'data-ajax-method' => 'GET']
134+
['class' => 'btn btn-success', 'data-ajax', 'data-ajax-method' => 'GET']
134135
); ?>
135136
<?= $this->ahref(
136137
'<span class="badge badge-dark">3</span> PUT Edit Record',
137138
'/test/rest/10',
138-
['class' => 'ajax btn btn-warning', 'data-ajax-method' => 'PUT', 'data-name' => 'New Name']
139+
['class' => 'btn btn-warning', 'data-ajax', 'data-ajax-method' => 'PUT', 'data-name' => 'New Name']
139140
); ?>
140141
<?= $this->ahref(
141142
'<span class="badge badge-dark">4</span> DELETE Record',
142143
'/test/rest/10',
143-
['class' => 'ajax btn btn-danger', 'data-ajax-method' => 'DELETE']
144+
['class' => 'btn btn-danger', 'data-ajax', 'data-ajax-method' => 'DELETE']
144145
); ?>
145146
</div>
146147
<hr/>
@@ -180,24 +181,26 @@ $this->headScript($this->baseUrl('js/test/config.js'));
180181
<hr/>
181182
<p>You can send AJAX calls over <code>GET</code>, <code>POST</code>, <code>PUT</code> or <code>DELETE</code> HTTPs' methods</p>
182183
<div class="alert alert-secondary d-flex justify-content-between">
183-
<pre class="align-self-center mb-0"><code>&lt;a href="test/ajax" class="ajax" data-ajax-method="get"&gt;GET&lt;/a&gt</code></pre>
184-
<?= $this->ahref('GET', ['test', 'ajax'], ['class' => 'ajax btn btn-success w-25', 'data-ajax-method' => 'GET']); ?>
184+
<pre class="align-self-center mb-0"><code>&lt;a href="test/ajax" data-ajax data-ajax-method="get"&gt;GET&lt;/a&gt</code></pre>
185+
<?= $this->ahref('GET', ['test', 'ajax'], ['class' => 'btn btn-success w-25', 'data-ajax', 'data-ajax-method' => 'GET']); ?>
185186
</div>
186187
<div class="alert alert-secondary d-flex justify-content-between">
187-
<pre class="align-self-center mb-0"><code>&lt;a href="test/ajax" class="ajax" data-ajax-method="post"&gt;POST&lt;/a&gt</code></pre>
188-
<?= $this->ahref('POST', ['test', 'ajax'], ['class' => 'ajax btn btn-primary w-25', 'data-ajax-method' => 'POST']); ?>
188+
<pre class="align-self-center mb-0"><code>&lt;a href="test/ajax" data-ajax data-ajax-method="post"&gt;POST&lt;/a&gt</code></pre>
189+
<?= $this->ahref('POST', ['test', 'ajax'], ['class' => 'btn btn-primary w-25', 'data-ajax', 'data-ajax-method' => 'POST']); ?>
189190
</div>
190191
<div class="alert alert-secondary d-flex justify-content-between">
191-
<pre class="align-self-center mb-0"><code>&lt;a href="test/ajax" class="ajax" data-ajax-method="put"&gt;PUT&lt;/a&gt</code></pre>
192-
<?= $this->ahref('PUT', ['test', 'ajax'], ['class' => 'ajax btn btn-warning w-25', 'data-ajax-method' => 'PUT']); ?>
192+
<pre class="align-self-center mb-0"><code>&lt;a href="test/ajax" data-ajax data-ajax-method="put"&gt;PUT&lt;/a&gt</code></pre>
193+
<?= $this->ahref('PUT', ['test', 'ajax'], ['class' => 'btn btn-warning w-25', 'data-ajax', 'data-ajax-method' => 'PUT']); ?>
193194
</div>
194195
<div class="alert alert-secondary d-flex justify-content-between">
195-
<pre class="align-self-center mb-0"><code>&lt;a href="test/ajax" class="ajax" data-ajax-method="delete"&gt;DELETE&lt;/a&gt</code></pre>
196-
<?= $this->ahref('DELETE', ['test', 'ajax'], ['class' => 'ajax btn btn-danger w-25', 'data-ajax-method' => 'DELETE']); ?>
196+
<pre class="align-self-center mb-0"><code>&lt;a href="test/ajax" data-ajax data-ajax-method="delete"&gt;DELETE&lt;/a&gt</code></pre>
197+
<?= $this->ahref('DELETE', ['test', 'ajax'], ['class' => 'btn btn-danger w-25', 'data-ajax', 'data-ajax-method' => 'DELETE']); ?>
197198
</div>
198199
<hr/>
199200
<div class="btn-group">
200-
<a href="<?= $this->url('test', 'ajax') ?>" id="ajax-callback" class="btn btn-light ajax">AJAX call with trigger</a>
201+
<a href="<?= $this->url('test', 'ajax') ?>" id="ajax-callback" class="btn btn-light" data-ajax>
202+
AJAX call with trigger
203+
</a>
201204
</div>
202205
<hr/>
203206
<p>Example of JavaScript:</p>
@@ -236,30 +239,32 @@ $this->headScript($this->baseUrl('js/test/config.js'));
236239
<?= $this->ahref(
237240
'Ajax + Messages',
238241
['test', 'ajax'],
239-
['class' => 'ajax btn btn-light', 'data-messages' => true]
242+
['class' => 'btn btn-light', 'data-ajax', 'data-messages' => true]
240243
); ?>
241244
<?= $this->ahref(
242245
'Ajax + Confirm',
243246
['test', 'ajax'],
244-
['class' => 'ajax confirm btn btn-warning']
247+
['class' => 'btn btn-warning', 'data-ajax', 'data-confirm']
245248
); ?>
246249
<?= $this->ahref(
247250
'Load HTML',
248251
['test', 'ajax-html'],
249-
['class' => 'load btn btn-light', 'data-ajax-target' => '#load']
252+
['class' => 'btn btn-light', 'data-ajax-load', 'data-ajax-target' => '#load']
250253
); ?>
251254
<?= $this->ahref(
252255
'Load + Confirm',
253256
['test', 'ajax-html'],
254-
['class' => 'load confirm btn btn-warning', 'data-ajax-target' => '#load', 'data-confirm' => 'Are you wand to load data from server?']
257+
['class' => 'btn btn-warning', 'data-ajax-load', 'data-ajax-target' => '#load', 'data-confirm' => 'Are you wand to load data from server?']
255258
); ?>
256259
<div>
257-
<select class="form-control load" name="formName" data-ajax-source="/test/ajax-form"
258-
data-ajax-target="#load">
259-
<option value="">Select Form</option>
260-
<option value="first-form">First</option>
261-
<option value="second-form">Second</option>
262-
</select>
260+
<select class="form-control" name="formName"
261+
data-ajax-load
262+
data-ajax-source="/test/ajax-form"
263+
data-ajax-target="#load">
264+
<option value="">Select Form</option>
265+
<option value="first-form">First</option>
266+
<option value="second-form">Second</option>
267+
</select>
263268
</div>
264269
</div>
265270
<hr/>
@@ -270,9 +275,9 @@ $this->headScript($this->baseUrl('js/test/config.js'));
270275
<h3>Access denied</h3>
271276
<p class="text-muted">If you try to load forbidden pages, system would send notice to you</p>
272277
<div class="d-flex justify-content-around">
273-
<a href="<?= $this->url('test', 'denied') ?>" class="btn btn-danger bluz-tooltip ajax" data-toggle="tooltip"
278+
<a href="<?= $this->url('test', 'denied') ?>" class="btn btn-danger" data-toggle="tooltip" data-ajax
274279
title="Return error message">Denied page, AJAX call</a>
275-
<a href="<?= $this->url('test', 'denied') ?>" class="btn btn-danger bluz-tooltip dialog" data-toggle="tooltip"
280+
<a href="<?= $this->url('test', 'denied') ?>" class="btn btn-danger" data-toggle="tooltip" data-ajax
276281
title="Return error dialog">Denied page, AJAX dialog</a>
277282
</div>
278283
<hr/>

data/seeds/TestSeeder.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public function run()
2828

2929
$this->insert('test', $data);
3030

31-
3231
$auth = [
3332
[
3433
'userId' => 2,
@@ -43,6 +42,5 @@ public function run()
4342
]
4443
];
4544
$this->insert('auth', $auth);
46-
4745
}
4846
}

public/js/test/react.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ define(
233233
{this.props.status}
234234
</td>
235235
<td>
236-
<button type="button" className="btn btn-light btn-xs" onClick={this.handleClickEdit}>
236+
<button type="button" className="btn btn-light" onClick={this.handleClickEdit}>
237237
<span className="glyphicon glyphicon-pencil" aria-hidden="true"></span>
238238
</button>
239239
&nbsp;
240-
<button type="button" className="btn btn-danger btn-xs" onClick={this.handleClickDelete}>
240+
<button type="button" className="btn btn-danger" onClick={this.handleClickDelete}>
241241
<span className="glyphicon glyphicon-trash" aria-hidden="true"></span>
242242
</button>
243243
</td>

0 commit comments

Comments
 (0)