Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lanhktc committed Oct 19, 2019
2 parents 4bec7d3 + fb3c5d3 commit dbc2273
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 31 deletions.
57 changes: 32 additions & 25 deletions app/Admin/Controllers/Modules/Cms/CmsContentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function index()
'id' => $row['id'],
'image' => sc_image_render($row->getThumb(), '50px', '50px'),
'title' => $row['title'],
'category_id' => $row['category_id'] ? ($row->category() ? $row->category()['title'] : '') : 'ROOT',
'category_id' => $row['category_id'] ? ($row->category ? $row->category['title'] : '') : 'ROOT',

'status' => $row['status'] ? '<span class="label label-success">ON</span>' : '<span class="label label-danger">OFF</span>',
'sort' => $row['sort'],
Expand All @@ -97,19 +97,25 @@ public function index()

$data['listTh'] = $listTh;
$data['dataTr'] = $dataTr;
$data['pagination'] = $dataTmp->appends(request()->except(['_token', '_pjax']))->links('admin.component.pagination');
$data['result_items'] = trans('Modules/Cms/Content.admin.result_item', ['item_from' => $dataTmp->firstItem(), 'item_to' => $dataTmp->lastItem(), 'item_total' => $dataTmp->total()]);
//menu_left
$data['pagination'] = $dataTmp
->appends(request()->except(['_token', '_pjax']))
->links('admin.component.pagination');
$data['result_items'] = trans('Modules/Cms/Content.admin.result_item',
[
'item_from' => $dataTmp->firstItem(),
'item_to' => $dataTmp->lastItem(),
'item_total' => $dataTmp->total()
]
);
//menu_left
$data['menu_left'] = '<div class="pull-left">
<button type="button" class="btn btn-default grid-select-all"><i class="fa fa-square-o"></i></button> &nbsp;
<a class="btn btn-flat btn-danger grid-trash" title="Delete"><i class="fa fa-trash-o"></i><span class="hidden-xs"> ' . trans('admin.delete') . '</span></a> &nbsp;
<a class="btn btn-flat btn-primary grid-refresh" title="Refresh"><i class="fa fa-refresh"></i><span class="hidden-xs"> ' . trans('admin.refresh') . '</span></a> &nbsp;</div>
';
//=menu_left
//=menu_left

//menu_right
//menu_right
$data['menu_right'] = '
<div class="btn-group pull-right" style="margin-right: 10px">
<a href="' . route('admin_cms_content.create') . '" class="btn btn-success btn-flat" title="New" id="button_create_new">
Expand All @@ -118,9 +124,9 @@ public function index()
</div>
';
//=menu_right
//=menu_right

//menu_sort
//menu_sort

$optionSort = '';
foreach ($arrSort as $key => $status) {
Expand All @@ -147,10 +153,9 @@ public function index()
$.pjax({url: url, container: '#pjax-container'})
});";

//=menu_sort

//menu_search
//=menu_sort

//menu_search
$data['menu_search'] = '
<form action="' . route('admin_cms_content.index') . '" id="button_search">
<div onclick="$(this).submit();" class="btn-group pull-right">
Expand All @@ -164,18 +169,18 @@ public function index()
</div>
</div>
</form>';
//=menu_search
//=menu_search

$data['url_delete_item'] = route('admin_cms_content.delete');

return view('admin.screen.list')
->with($data);
}

/**
* Form create new order in admin
* @return [type] [description]
*/
/**
* Form create new order in admin
* @return [type] [description]
*/
public function create()
{
$data = [
Expand All @@ -193,10 +198,10 @@ public function create()
->with($data);
}

/**
* Post create new order in admin
* @return [type] [description]
*/
/**
* Post create new order in admin
* @return [type] [description]
*/
public function postCreate()
{
$data = request()->all();
Expand All @@ -205,7 +210,8 @@ public function postCreate()
'category_id' => 'required',
'descriptions.*.title' => 'required|string|max:100',
], [
'descriptions.*.title.required' => trans('validation.required', ['attribute' => trans('Modules/Cms/Content.title')]),
'descriptions.*.title.required' => trans('validation.required',
['attribute' => trans('Modules/Cms/Content.title')]),
]);

if ($validator->fails()) {
Expand Down Expand Up @@ -235,7 +241,8 @@ public function postCreate()
}
CmsContentDescription::insert($dataDes);

return redirect()->route('admin_cms_content.index')->with('success', trans('Modules/Cms/Content.admin.create_success'));
return redirect()->route('admin_cms_content.index')
->with('success', trans('Modules/Cms/Content.admin.create_success'));

}

Expand All @@ -256,7 +263,7 @@ public function edit($id)
'languages' => $this->languages,
'content' => $content,
'categories' => (new CmsCategory)->getTreeCategories(),
'url_action' => route('admin_cms_content.edit', ['id' => $category['id']]),
'url_action' => route('admin_cms_content.edit', ['id' => $content['id']]),
];
return view('admin.screen.cms_content')
->with($data);
Expand Down
13 changes: 7 additions & 6 deletions app/Modules/Cms/Models/CmsCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,17 @@ public function getCategoriesFull($sortBy = null, $sortOrder = 'asc')
return $listFullCategory;
}

/*
Get thumb
*/
/*
Get thumb
*/
public function getThumb()
{
return sc_image_get_path_thumb($this->image);
}

/*
Get image
*/
/*
Get image
*/
public function getImage()
{
return sc_image_get_path($this->image);
Expand Down Expand Up @@ -278,6 +278,7 @@ public function installExtension()
$table->tinyInteger('sort')->default(0);
$table->tinyInteger('status')->default(0);
});

} catch (\Exception $e) {
$return = ['error' => 1, 'msg' => $e->getMessage()];
}
Expand Down

0 comments on commit dbc2273

Please sign in to comment.