Skip to content

Commit c0a3d24

Browse files
committed
Merge branch 'master' into dev
2 parents 7b645ce + 42d55ac commit c0a3d24

20 files changed

+479
-528
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<a name="1.3.0"></a>
2+
# [1.3.0](https://github.com/flextype-plugins/admin) (2020-08-25)
3+
4+
### Features
5+
6+
* **core** update code base for new Flextype 0.9.11
7+
18
<a name="1.2.0"></a>
29
# [1.2.0](https://github.com/flextype-plugins/admin) (2020-08-19)
310

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![preview](https://github.com/flextype-plugins/admin/raw/dev/preview.png)
44

55
<p align="center">
6-
<a href="https://github.com/flextype-plugins/admin/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype-plugins/admin.svg?label=version&color=black"></a> <a href="https://github.com/flextype-plugins/admin"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=black" alt="License"></a> <a href="https://github.com/flextype-plugins/admin"><img src="https://img.shields.io/github/downloads/flextype-plugins/admin/total.svg?color=black" alt="Total downloads"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/Flextype-0.9.10-green.svg?color=black" alt="Flextype"></a> <a href="https://crowdin.com/project/flextype-plugin-admin"><img src="https://d322cqt584bo4o.cloudfront.net/flextype-plugin-admin/localized.svg?color=black" alt="Crowdin"></a> <a href="https://scrutinizer-ci.com/g/flextype-plugins/admin?branch=dev&color=black"><img src="https://img.shields.io/scrutinizer/g/flextype-plugins/admin.svg?branch=dev&color=black" alt="Quality Score"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&colorB=728ADA&label=Discord%20Chat" alt="Discord"></a>
6+
<a href="https://github.com/flextype-plugins/admin/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype-plugins/admin.svg?label=version&color=black"></a> <a href="https://github.com/flextype-plugins/admin"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=black" alt="License"></a> <a href="https://github.com/flextype-plugins/admin"><img src="https://img.shields.io/github/downloads/flextype-plugins/admin/total.svg?color=black" alt="Total downloads"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/Flextype-0.9.11-green.svg?color=black" alt="Flextype"></a> <a href="https://crowdin.com/project/flextype-plugin-admin"><img src="https://d322cqt584bo4o.cloudfront.net/flextype-plugin-admin/localized.svg?color=black" alt="Crowdin"></a> <a href="https://scrutinizer-ci.com/g/flextype-plugins/admin?branch=dev&color=black"><img src="https://img.shields.io/scrutinizer/g/flextype-plugins/admin.svg?branch=dev&color=black" alt="Quality Score"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&colorB=728ADA&label=Discord%20Chat" alt="Discord"></a>
77
</p>
88

99
Admin Panel plugin for Flextype.
@@ -14,7 +14,7 @@ The following dependencies need to be installed for Form Admin Plugin.
1414

1515
| Item | Version | Download |
1616
|---|---|---|
17-
| [flextype](https://github.com/flextype/flextype) | 0.9.10 | [download](https://github.com/flextype/flextype/releases) |
17+
| [flextype](https://github.com/flextype/flextype) | 0.9.11 | [download](https://github.com/flextype/flextype/releases) |
1818
| [twig](https://github.com/flextype-plugins/twig) | >=1.0.0 | [download](https://github.com/flextype-plugins/twig/releases) |
1919
| [form](https://github.com/flextype-plugins/form) | >=1.0.0 | [download](https://github.com/flextype-plugins/form/releases) |
2020
| [form-admin](https://github.com/flextype-plugins/form-admin) | >=1.0.0 | [download](https://github.com/flextype-plugins/form-admin/releases) |

app/Controllers/ApiAccessController.php

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@
1818

1919
class ApiAccessController
2020
{
21-
/**
22-
* Flextype Application
23-
*/
24-
protected $flextype;
2521

2622
/**
2723
* __construct
2824
*/
29-
public function __construct($flextype)
25+
public function __construct()
3026
{
31-
$this->flextype = $flextype;
27+
3228
}
3329

3430
/**
@@ -50,26 +46,26 @@ public function index(Request $request, Response $response) : Response
5046
}
5147
}
5248

53-
return $this->flextype->container('twig')->render(
49+
return flextype('twig')->render(
5450
$response,
5551
'plugins/admin/templates/system/api/access/index.html',
5652
[
5753
'menu_item' => 'api',
5854
'tokens' => $tokens,
5955
'links' => [
6056
'api' => [
61-
'link' => $this->flextype->container('router')->pathFor('admin.api.index'),
57+
'link' => flextype('router')->pathFor('admin.api.index'),
6258
'title' => __('admin_api'),
6359
],
6460
'api_Access' => [
65-
'link' => $this->flextype->container('router')->pathFor('admin.api_access.index'),
61+
'link' => flextype('router')->pathFor('admin.api_access.index'),
6662
'title' => __('admin_access'),
6763
'active' => true
6864
],
6965
],
7066
'buttons' => [
7167
'api_access_add' => [
72-
'link' => $this->flextype->container('router')->pathFor('admin.api_access.add'),
68+
'link' => flextype('router')->pathFor('admin.api_access.add'),
7369
'title' => __('admin_create_new_token')
7470
],
7571
],
@@ -85,22 +81,22 @@ public function index(Request $request, Response $response) : Response
8581
*/
8682
public function add(Request $request, Response $response) : Response
8783
{
88-
return $this->flextype->container('twig')->render(
84+
return flextype('twig')->render(
8985
$response,
9086
'plugins/admin/templates/system/api/access/add.html',
9187
[
9288
'menu_item' => 'api',
9389
'links' => [
9490
'api' => [
95-
'link' => $this->flextype->container('router')->pathFor('admin.api.index'),
91+
'link' => flextype('router')->pathFor('admin.api.index'),
9692
'title' => __('admin_api'),
9793
],
9894
'api_access' => [
99-
'link' => $this->flextype->container('router')->pathFor('admin.api_access.index'),
95+
'link' => flextype('router')->pathFor('admin.api_access.index'),
10096
'title' => __('admin_access')
10197
],
10298
'api_access_add' => [
103-
'link' => $this->flextype->container('router')->pathFor('admin.api_access.add'),
99+
'link' => flextype('router')->pathFor('admin.api_access.add'),
104100
'title' => __('admin_create_new_token'),
105101
'active' => true
106102
],
@@ -134,12 +130,12 @@ public function addProcess(Request $request, Response $response) : Response
134130
$uuid = Uuid::uuid4()->toString();
135131

136132
// Get time
137-
$time = date($this->flextype->container('registry')->get('flextype.settings.date_format'), time());
133+
$time = date(flextype('registry')->get('flextype.settings.date_format'), time());
138134

139135
// Create API Token account
140136
if (Filesystem::write(
141137
$api_token_file_path,
142-
$this->flextype->container('yaml')->encode([
138+
flextype('yaml')->encode([
143139
'title' => $post_data['title'],
144140
'icon' => $post_data['icon'],
145141
'limit_calls' => (int) $post_data['limit_calls'],
@@ -152,18 +148,18 @@ public function addProcess(Request $request, Response $response) : Response
152148
'updated_at' => $time,
153149
])
154150
)) {
155-
$this->flextype->container('flash')->addMessage('success', __('admin_message_access_api_token_created'));
151+
flextype('flash')->addMessage('success', __('admin_message_access_api_token_created'));
156152
} else {
157-
$this->flextype->container('flash')->addMessage('error', __('admin_message_access_api_token_was_not_created1'));
153+
flextype('flash')->addMessage('error', __('admin_message_access_api_token_was_not_created1'));
158154
}
159155
} else {
160-
$this->flextype->container('flash')->addMessage('error', __('admin_message_access_api_token_was_not_created2'));
156+
flextype('flash')->addMessage('error', __('admin_message_access_api_token_was_not_created2'));
161157
}
162158

163159
if (isset($post_data['create-and-edit'])) {
164-
return $response->withRedirect($this->flextype->container('router')->pathFor('admin.api_access.edit') . '?token=' . $api_token);
160+
return $response->withRedirect(flextype('router')->pathFor('admin.api_access.edit') . '?token=' . $api_token);
165161
} else {
166-
return $response->withRedirect($this->flextype->container('router')->pathFor('admin.api_access.index'));
162+
return $response->withRedirect(flextype('router')->pathFor('admin.api_access.index'));
167163
}
168164
}
169165

@@ -176,9 +172,9 @@ public function addProcess(Request $request, Response $response) : Response
176172
public function edit(Request $request, Response $response) : Response
177173
{
178174
$token = $request->getQueryParams()['token'];
179-
$token_data = $this->flextype->container('yaml')->decode(Filesystem::read(PATH['project'] . '/tokens' . '/access/' . $token . '/token.yaml'));
175+
$token_data = flextype('yaml')->decode(Filesystem::read(PATH['project'] . '/tokens' . '/access/' . $token . '/token.yaml'));
180176

181-
return $this->flextype->container('twig')->render(
177+
return flextype('twig')->render(
182178
$response,
183179
'plugins/admin/templates/system/api/access/edit.html',
184180
[
@@ -187,15 +183,15 @@ public function edit(Request $request, Response $response) : Response
187183
'token_data' => $token_data,
188184
'links' => [
189185
'api' => [
190-
'link' => $this->flextype->container('router')->pathFor('admin.api.index'),
186+
'link' => flextype('router')->pathFor('admin.api.index'),
191187
'title' => __('admin_api')
192188
],
193189
'api_access' => [
194-
'link' => $this->flextype->container('router')->pathFor('admin.api_access.index'),
190+
'link' => flextype('router')->pathFor('admin.api_access.index'),
195191
'title' => __('admin_access')
196192
],
197193
'api_tokens_edit' => [
198-
'link' => $this->flextype->container('router')->pathFor('admin.api_access.edit'),
194+
'link' => flextype('router')->pathFor('admin.api_access.edit'),
199195
'title' => __('admin_edit_token'),
200196
'active' => true
201197
],
@@ -222,7 +218,7 @@ public function editProcess(Request $request, Response $response) : Response
222218
if (Filesystem::has($api_token_file_path)) {
223219
if (Filesystem::write(
224220
$api_token_file_path,
225-
$this->flextype->container('yaml')->encode([
221+
flextype('yaml')->encode([
226222
'title' => $post_data['title'],
227223
'icon' => $post_data['icon'],
228224
'limit_calls' => (int) $post_data['limit_calls'],
@@ -232,16 +228,16 @@ public function editProcess(Request $request, Response $response) : Response
232228
'created_by' => $post_data['created_by'],
233229
'created_at' => $post_data['created_at'],
234230
'updated_by' => Session::get('uuid'),
235-
'updated_at' => date($this->flextype->container('registry')->get('flextype.settings.date_format'), time()),
231+
'updated_at' => date(flextype('registry')->get('flextype.settings.date_format'), time()),
236232
])
237233
)) {
238-
$this->flextype->container('flash')->addMessage('success', __('admin_message_access_api_token_updated'));
234+
flextype('flash')->addMessage('success', __('admin_message_access_api_token_updated'));
239235
}
240236
} else {
241-
$this->flextype->container('flash')->addMessage('error', __('admin_message_access_api_token_was_not_updated'));
237+
flextype('flash')->addMessage('error', __('admin_message_access_api_token_was_not_updated'));
242238
}
243239

244-
return $response->withRedirect($this->flextype->container('router')->pathFor('admin.api_access.index'));
240+
return $response->withRedirect(flextype('router')->pathFor('admin.api_access.index'));
245241
}
246242

247243
/**
@@ -258,11 +254,11 @@ public function deleteProcess(Request $request, Response $response) : Response
258254
$api_token_dir_path = PATH['project'] . '/tokens' . '/access/' . $post_data['token'];
259255

260256
if (Filesystem::deleteDir($api_token_dir_path)) {
261-
$this->flextype->container('flash')->addMessage('success', __('admin_message_access_api_token_deleted'));
257+
flextype('flash')->addMessage('success', __('admin_message_access_api_token_deleted'));
262258
} else {
263-
$this->flextype->container('flash')->addMessage('error', __('admin_message_access_api_token_was_not_deleted'));
259+
flextype('flash')->addMessage('error', __('admin_message_access_api_token_was_not_deleted'));
264260
}
265261

266-
return $response->withRedirect($this->flextype->container('router')->pathFor('admin.api_access.index'));
262+
return $response->withRedirect(flextype('router')->pathFor('admin.api_access.index'));
267263
}
268264
}

app/Controllers/ApiController.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,12 @@
1818

1919
class ApiController
2020
{
21-
/**
22-
* Flextype Application
23-
*/
24-
protected $flextype;
25-
2621
/**
2722
* __construct
2823
*/
29-
public function __construct($flextype)
24+
public function __construct()
3025
{
31-
$this->flextype = $flextype;
26+
3227
}
3328

3429
/**
@@ -39,7 +34,7 @@ public function __construct($flextype)
3934
*/
4035
public function index(Request $request, Response $response) : Response
4136
{
42-
return $this->flextype->container('twig')->render(
37+
return flextype('twig')->render(
4338
$response,
4439
'plugins/admin/templates/system/api/index.html',
4540
[
@@ -72,7 +67,7 @@ public function index(Request $request, Response $response) : Response
7267
],
7368
'links' => [
7469
'api' => [
75-
'link' => $this->flextype->container('router')->pathFor('admin.api.index'),
70+
'link' => flextype('router')->pathFor('admin.api.index'),
7671
'title' => __('admin_api'),
7772
'active' => true,
7873
],

0 commit comments

Comments
 (0)