Skip to content

Commit 2437350

Browse files
committed
Merge branch '2.x-release/v2.0.3' into 2.x
2 parents df5526d + 7433c76 commit 2437350

File tree

22 files changed

+576
-379
lines changed

22 files changed

+576
-379
lines changed

Http/Controllers/Backend/ContentTypesController.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
<?php namespace VaahCms\Modules\cms\Http\Controllers\Backend;
1+
<?php namespace VaahCms\Modules\Cms\Http\Controllers\Backend;
22

33
use Illuminate\Http\Request;
44
use Illuminate\Routing\Controller;
55
use VaahCms\Modules\Cms\Models\Content;
66
use VaahCms\Modules\Cms\Models\FieldType;
7-
use VaahCms\Modules\cms\Models\ContentType;
7+
use VaahCms\Modules\Cms\Models\ContentType;
8+
use WebReinvent\VaahCms\Models\TaxonomyType;
89

910

1011
class ContentTypesController extends Controller
@@ -47,9 +48,21 @@ public function getAssets(Request $request)
4748
$data['empty_item'][$column] = null;
4849
}
4950

51+
$data['empty_item']['content_statuses'] = [
52+
'draft',
53+
'published',
54+
'protected',
55+
];
56+
5057
$data['field_types'] = FieldType::select('id', 'name', 'slug', 'meta')
5158
->get();
5259

60+
$data['content_relations'] = vh_content_relations();
61+
62+
$data['taxonomy_types'] = TaxonomyType::whereNotNull('is_active')
63+
->whereNull('parent_id')->with(['children'])
64+
->select('id', 'name', 'slug')->get();
65+
5366
$data['non_repeatable_fields'] = Content::getNonRepeatableFields();
5467

5568
$data['actions'] = [];

Http/Controllers/Backend/ContentsController.php

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public function deleteItem(Request $request,$content_slug,$id)
237237
}
238238
}
239239
//----------------------------------------------------------
240-
public function itemAction(Request $request,$id,$action)
240+
public function itemAction(Request $request,$content_type_slug,$id,$action)
241241
{
242242
try{
243243
return Content::itemAction($request,$id,$action);
@@ -254,6 +254,40 @@ public function itemAction(Request $request,$id,$action)
254254
}
255255
}
256256
//----------------------------------------------------------
257+
public function getRelationsInTree(Request $request)
258+
{
259+
$input = $request->all();
260+
261+
$list = [];
262+
263+
$relation = vh_content_relations_by_name($input['type']);
264+
265+
if(!isset($relation['display_column']) || !$relation['display_column']){
266+
$relation['display_column'] = 'name';
267+
}
268+
269+
$url = null;
270+
271+
if($relation && isset($relation['namespace'])){
272+
273+
$relation['filter_id'] = $input['filter_id'];
274+
275+
$list = Content::getListByVariables($relation);
276+
277+
if(isset($relation['add_url']) && $relation['add_url']){
278+
$url = $relation['add_url'];
279+
}
280+
}
281+
282+
283+
$response['success'] = true;
284+
$response['data']['list'] = $list;
285+
$response['data']['display_column'] = $relation['display_column'];
286+
$response['data']['add_url'] = $url;
287+
288+
return $response;
289+
}
290+
//----------------------------------------------------------
257291

258292

259293
}

Libraries/CmsSeeder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,14 @@ public static function createSampleField($theme_slug, $file_path, $content_type_
267267

268268
$content_type = ContentType::where('slug', $content_type_slug)
269269
->with(['groups.fields.type'])
270-
->first()->toArray();
270+
->first();
271271

272272
if(!$content_type)
273273
{
274274
return false;
275275
}
276276

277+
$content_type = $content_type->toArray();
277278

278279
foreach($list as $item)
279280
{

Models/Content.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,15 @@ public static function itemAction($request, $id, $type): array
364364
{
365365
switch($type)
366366
{
367-
case 'activate':
367+
case 'published':
368368
self::where('id', $id)
369369
->withTrashed()
370-
->update(['status' => 1]);
370+
->update(['status' => 'published']);
371371
break;
372-
case 'deactivate':
372+
case 'draft':
373373
self::where('id', $id)
374374
->withTrashed()
375-
->update(['status' => null]);
375+
->update(['status' => 'draft']);
376376
break;
377377
case 'trash':
378378
self::find($id)->delete();

Models/ContentBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ public static function getListByVariables($var)
13301330
$list->where($var['filter_by'],$var['filter_id']);
13311331
}
13321332

1333-
$list = $list->get();
1333+
$list = $list->select('id','id as key', $var['display_column'].' as label')->get();
13341334

13351335
return $list;
13361336

Models/ContentType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getContentStatusesAttribute($value)
100100
{
101101
return json_decode($value);
102102
}
103-
return null;
103+
return [];
104104
}
105105
//-------------------------------------------------
106106
public function setMetaAttribute($value)

Models/ContentTypeBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function getContentStatusesAttribute($value)
9999
{
100100
return json_decode($value);
101101
}
102-
return null;
102+
return [];
103103
}
104104
//-------------------------------------------------
105105
public function setMetaAttribute($value)

Models/FormGroup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static function syncWithFormFields(FormGroup $group, $fields_array)
224224

225225
if($stored_field){
226226

227-
if($stored_field->meta && isset($stored_field->meta->type)
227+
if(isset($field['id']) && $stored_field->meta && isset($stored_field->meta->type)
228228
&& $field['meta']['type'] != $stored_field->meta->type){
229229
$content_form_fields = ContentFormField::with(['contentFormRelations'])
230230
->where('vh_cms_form_field_id', $field['id'])->get();

Resources/assets/build/index.js

Lines changed: 445 additions & 316 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Resources/assets/build/vanilla-picker-NKbIFE8h.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)