generator-folklore 3.0.21 → 3.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlockResource.php +22 -3
- package/lib/generators/laravel-panneau/templates/app/Models/Block.php +1 -1
- package/lib/generators/laravel-panneau/templates/app/Models/Page.php +5 -0
- package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlockResource.php +19 -2
- package/lib/generators/laravel-panneau/templates/resources/assets/js/components/Panneau.jsx +6 -6
- package/lib/generators/laravel-panneau/templates/resources/assets/styles/panneau.scss +2 -0
- package/package.json +2 -2
@@ -6,6 +6,8 @@ use Illuminate\Http\Resources\Json\JsonResource;
|
|
6
6
|
use Folklore\Contracts\Resources\HasBlocks;
|
7
7
|
use Folklore\Http\Resources\LocalizedResource;
|
8
8
|
use App\Contracts\Resources\Blocks\Text as TextBlock;
|
9
|
+
use App\Contracts\Resources\Blocks\ImageBlock as ImageBlock;
|
10
|
+
use Folklore\Http\Resources\MediaResource;
|
9
11
|
|
10
12
|
class BlockResource extends JsonResource
|
11
13
|
{
|
@@ -18,7 +20,6 @@ class BlockResource extends JsonResource
|
|
18
20
|
public function toArray($request)
|
19
21
|
{
|
20
22
|
$type = $this->type();
|
21
|
-
$locale = $request->locale();
|
22
23
|
return [
|
23
24
|
'id' => $this->id(),
|
24
25
|
'type' => $type,
|
@@ -27,9 +28,27 @@ class BlockResource extends JsonResource
|
|
27
28
|
return !is_null($blocks) ? new BlocksCollection($blocks) : [];
|
28
29
|
}),
|
29
30
|
|
30
|
-
$this->mergeWhen($this->resource instanceof TextBlock, function ()
|
31
|
+
$this->mergeWhen($this->resource instanceof TextBlock, function () {
|
31
32
|
return [
|
32
|
-
'
|
33
|
+
'title' => new LocalizedResource(function ($locale) {
|
34
|
+
return $this->title($locale);
|
35
|
+
}),
|
36
|
+
'body' => new LocalizedResource(function ($locale) {
|
37
|
+
return $this->body($locale);
|
38
|
+
}),
|
39
|
+
];
|
40
|
+
}),
|
41
|
+
|
42
|
+
$this->mergeWhen($this->resource instanceof ImageBlock, function () {
|
43
|
+
$image = $this->image();
|
44
|
+
return [
|
45
|
+
'image' => !empty($image) ? new MediaResource($image) : null,
|
46
|
+
'caption' => new LocalizedResource(function ($locale) {
|
47
|
+
return $this->caption($locale);
|
48
|
+
}),
|
49
|
+
'credits' => new LocalizedResource(function ($locale) {
|
50
|
+
return $this->credits($locale);
|
51
|
+
}),
|
33
52
|
];
|
34
53
|
}),
|
35
54
|
];
|
package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlockResource.php
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
namespace App\Panneau\Http\Resources;
|
4
4
|
|
5
5
|
use Illuminate\Http\Resources\Json\JsonResource;
|
6
|
-
use
|
6
|
+
use Folklore\Contracts\Resources\HasBlocks;
|
7
7
|
use Folklore\Http\Resources\LocalizedResource;
|
8
8
|
use App\Contracts\Resources\Blocks\Text as TextBlock;
|
9
|
+
use App\Contracts\Resources\Blocks\Image as ImageBlock;
|
10
|
+
use Folklore\Http\Resources\MediaResource;
|
9
11
|
|
10
12
|
class BlockResource extends JsonResource
|
11
13
|
{
|
@@ -18,7 +20,6 @@ class BlockResource extends JsonResource
|
|
18
20
|
public function toArray($request)
|
19
21
|
{
|
20
22
|
$type = $this->type();
|
21
|
-
|
22
23
|
return [
|
23
24
|
'id' => $this->id(),
|
24
25
|
'type' => $type,
|
@@ -29,11 +30,27 @@ class BlockResource extends JsonResource
|
|
29
30
|
|
30
31
|
$this->mergeWhen($this->resource instanceof TextBlock, function () {
|
31
32
|
return [
|
33
|
+
'title' => new LocalizedResource(function ($locale) {
|
34
|
+
return $this->title($locale);
|
35
|
+
}),
|
32
36
|
'body' => new LocalizedResource(function ($locale) {
|
33
37
|
return $this->body($locale);
|
34
38
|
}),
|
35
39
|
];
|
36
40
|
}),
|
41
|
+
|
42
|
+
$this->mergeWhen($this->resource instanceof ImageBlock, function () {
|
43
|
+
$image = $this->image();
|
44
|
+
return [
|
45
|
+
'image' => !empty($image) ? new MediaResource($image) : null,
|
46
|
+
'caption' => new LocalizedResource(function ($locale) {
|
47
|
+
return $this->caption($locale);
|
48
|
+
}),
|
49
|
+
'credits' => new LocalizedResource(function ($locale) {
|
50
|
+
return $this->credits($locale);
|
51
|
+
}),
|
52
|
+
];
|
53
|
+
}),
|
37
54
|
];
|
38
55
|
}
|
39
56
|
}
|
@@ -1,12 +1,13 @@
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import Panneau from '@panneau/app';
|
4
1
|
import { getCSRFHeaders } from '@folklore/fetch';
|
5
|
-
|
2
|
+
import Panneau from '@panneau/app';
|
6
3
|
import { FIELDS_NAMESPACE } from '@panneau/core/contexts';
|
7
|
-
import
|
4
|
+
import PropTypes from 'prop-types';
|
5
|
+
import React, { useState, useEffect } from 'react';
|
6
|
+
|
8
7
|
import * as AppPropTypes from '../lib/PropTypes';
|
9
8
|
|
9
|
+
import * as fieldsComponents from './panneau/fields';
|
10
|
+
|
10
11
|
import '../../styles/panneau.scss';
|
11
12
|
|
12
13
|
const propTypes = {
|
@@ -26,7 +27,6 @@ const defaultProps = {
|
|
26
27
|
const PanneauContainer = ({ definition, user, baseUrl, uploadEndpoint, statusCode }) => {
|
27
28
|
const { routes = {} } = definition;
|
28
29
|
const isAuthorized = statusCode !== 401 && statusCode !== 403;
|
29
|
-
|
30
30
|
const [localeLoaded, setLocaleLoaded] = useState(false);
|
31
31
|
|
32
32
|
useEffect(() => {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "generator-folklore",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.22",
|
4
4
|
"description": "Yeoman generator for projects at Folklore",
|
5
5
|
"keywords": [
|
6
6
|
"yeoman-generator"
|
@@ -40,5 +40,5 @@
|
|
40
40
|
"yeoman-generator": "^5.7.0",
|
41
41
|
"yeoman-remote": "^1.0.1"
|
42
42
|
},
|
43
|
-
"gitHead": "
|
43
|
+
"gitHead": "299c4d804aaa15455627b5ae353d3936da9fd692"
|
44
44
|
}
|