Skip to content

Commit

Permalink
fix on media uploader and list parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Filippo Matteo Riggio committed Sep 14, 2018
1 parent d5ed8fa commit ccfb28b
Show file tree
Hide file tree
Showing 38 changed files with 464 additions and 951 deletions.
13 changes: 1 addition & 12 deletions src/app/Http/Controllers/Admin/Content/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ protected function validator(Request $request, array $data, $id = null)
}


if ( $field->type == 'gallery' ) {
if ( $field->type == 'gallery' && $request->file( $field->name ) ) {
$nbr = count( $request->file( $field->name ) ) - 1;
foreach(range(0, $nbr) as $index) {
$rules[ $field->name . '.' . $index ] = join( '|', $tmp );
Expand All @@ -443,17 +443,6 @@ protected function validator(Request $request, array $data, $id = null)
}
}

$validator = Validator::make($data, $rules);

// if ( $validator->fails() ) {
// echo '<pre>'; print_r($validator->errors() );
// die;
//// return redirect('post/create')
//// ->withErrors($validator)
//// ->withInput();
// }
//
// die;
return Validator::make($data, $rules);
}
}
3 changes: 1 addition & 2 deletions src/app/Http/Controllers/Admin/Media/UploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public function upload( Request $request )
}

if ( $media->id ) {
return response()->json( [ 'status' => 'ok', 'media' => $this->_parseMedia([ $media ]) ]);
// 'id' => $media->id, 'link' => asset($media->url)
return response()->json( [ 'status' => 'ok', 'media' => [ $this->_parseMedia( $media->toArray() ) ] ]);
} else {
return response()->json( [ 'status' => 'ko' ], 400);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public function setLanguage( Request $request, $language )
{
$request->session()->put('currentLanguage', $language);
App::setLocale( $language );
return redirect()->back();

if ( strstr( url()->previous(), 'edit' ) ) {
return redirect('admin');
} else {
return redirect()->back();
}
}
}
4 changes: 3 additions & 1 deletion src/app/Library/ContentListParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ public function getList()
}
if ( count($this->_contentList) > 0 ) {
foreach ( $this->_contentList as $index => $content ) {
$this->_contentList[$index]->categories = $tmp[$content->id];
if ( isset($this->_contentList[$index]) && isset($tmp[$content->id]) ) {
$this->_contentList[$index]->categories = $tmp[$content->id];
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/public/assets/css/factotum/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/public/assets/css/factotum/main.css.map

Large diffs are not rendered by default.

0 comments on commit ccfb28b

Please sign in to comment.