1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-20 03:41:27 +02:00

feat(admin-plugin): update Admin plugin #212 #186

update source workflow
This commit is contained in:
Awilum
2019-08-22 13:28:03 +03:00
parent 84ce56a90e
commit dca4f0f862
2 changed files with 7 additions and 5 deletions

View File

@@ -714,6 +714,9 @@ class EntriesController extends Controller
Arr::delete($entry, 'slug');
Arr::delete($entry, 'modified_at');
// Read Entry
$_entry = $this->entries->read($this->getEntryID($query), true);
// Fieldsets for current entry template
$fieldsets_path = PATH['site'] . '/fieldsets/' . (isset($entry['fieldset']) ? $entry['fieldset'] : 'default') . '.yaml';
$fieldsets = Parser::decode(Filesystem::read($fieldsets_path), 'yaml');
@@ -728,7 +731,8 @@ class EntriesController extends Controller
'i' => count($parts),
'last' => Arr::last($parts),
'id' => $this->getEntryID($query),
'data' => $this->entries->read($this->getEntryID($query), true)['file_data'],
'data' => $_entry['file_data'],
'parser' => $_entry['file_parser'],
'type' => $type,
'menu_item' => 'entries',
'links' => [
@@ -884,14 +888,11 @@ class EntriesController extends Controller
if ($type == 'source') {
// Read entry
$_entry = $this->entries->read($id);
// Data from POST
$data = $request->getParsedBody();
// Update entry
if ($this->entries->update($id, Parser::decode($data['data'], $_entry['file_parser']))) {
if ($this->entries->update($id, Parser::decode($data['data'], $data['parser']))) {
$this->flash->addMessage('success', __('admin_message_entry_changes_saved'));
} else {
$this->flash->addMessage('error', __('admin_message_entry_changes_not_saved'));

View File

@@ -5,6 +5,7 @@
{{ csrf() }}
<input type="hidden" name="action" value="save-form">
<input type="hidden" name="id" value="{{ id }}">
<input type="hidden" name="parser" value="{{ parser }}">
<div class="row">
<div class="col-12">
<div class="form-group">