Merge photo comments feature #114
@ -42,6 +42,44 @@ class PhotoCommentController extends Controller
|
||||
|
||||
$request->session()->flash('success', trans_choice('admin.bulk_comments_deleted', $commentsActioned, ['number' => $commentsActioned]));
|
||||
}
|
||||
else if ($request->has('bulk_approve'))
|
||||
{
|
||||
/** @var PhotoComment $comment */
|
||||
foreach ($comments as $comment)
|
||||
{
|
||||
// Mark as approved
|
||||
$comment->approved_at = new \DateTime();
|
||||
$comment->approved_user_id = $this->getUser()->id;
|
||||
|
||||
// The comment may have already been rejected - remove the data if so
|
||||
$comment->rejected_at = null;
|
||||
$comment->rejected_user_id = null;
|
||||
|
||||
$comment->save();
|
||||
$commentsActioned++;
|
||||
}
|
||||
|
||||
$request->session()->flash('success', trans_choice('admin.bulk_comments_approved', $commentsActioned, ['number' => $commentsActioned]));
|
||||
}
|
||||
else if ($request->has('bulk_reject'))
|
||||
{
|
||||
/** @var PhotoComment $comment */
|
||||
foreach ($comments as $comment)
|
||||
{
|
||||
// Mark as rejected
|
||||
$comment->rejected_at = new \DateTime();
|
||||
$comment->rejected_user_id = $this->getUser()->id;
|
||||
|
||||
// The comment may have already been approved - remove the data if so
|
||||
$comment->approved_at = null;
|
||||
$comment->approved_user_id = null;
|
||||
|
||||
$comment->save();
|
||||
$commentsActioned++;
|
||||
}
|
||||
|
||||
$request->session()->flash('success', trans_choice('admin.bulk_comments_approved', $commentsActioned, ['number' => $commentsActioned]));
|
||||
}
|
||||
|
||||
return redirect(route('comments.index'));
|
||||
}
|
||||
@ -80,6 +118,34 @@ class PhotoCommentController extends Controller
|
||||
'comment_ids' => $commentIDs
|
||||
]);
|
||||
}
|
||||
else if ($request->has('bulk_approve'))
|
||||
{
|
||||
if (count($commentIDs) == 1)
|
||||
{
|
||||
// Single comment selected - redirect to the single approve page
|
||||
return redirect(route('comments.approve', ['id' => $commentIDs[0]]));
|
||||
}
|
||||
|
||||
// Show the view to confirm the approval
|
||||
return Theme::render('admin.bulk_approve_comments', [
|
||||
'comment_count' => count($commentIDs),
|
||||
'comment_ids' => $commentIDs
|
||||
]);
|
||||
}
|
||||
else if ($request->has('bulk_reject'))
|
||||
{
|
||||
if (count($commentIDs) == 1)
|
||||
{
|
||||
// Single comment selected - redirect to the single reject page
|
||||
return redirect(route('comments.reject', ['id' => $commentIDs[0]]));
|
||||
}
|
||||
|
||||
// Show the view to confirm the rejection
|
||||
return Theme::render('admin.bulk_reject_comments', [
|
||||
'comment_count' => count($commentIDs),
|
||||
'comment_ids' => $commentIDs
|
||||
]);
|
||||
}
|
||||
|
||||
// Unrecognised action - simply redirect back to the index page
|
||||
return redirect(route('comments.index'));
|
||||
|
@ -61,6 +61,9 @@ return [
|
||||
'anonymous_users' => 'Anonymous (not logged in)',
|
||||
'approve_comment' => 'Approve comment by :author_name',
|
||||
'approve_comment_confirm' => 'Are you sure you want to approve this comment by ":author_name"?',
|
||||
'approve_comments' => 'Approve :number comments',
|
||||
'approve_comments_confirm' => 'Are you sure you want to approve these :number comments?',
|
||||
'bulk_comments_approved' => ':number comment was approved successfully.|:number comments were approved successfully.',
|
||||
'bulk_comments_deleted' => ':number comment was deleted successfully.|:number comments were deleted successfully.',
|
||||
'bulk_photos_changed' => ':number photo was updated successfully.|:number photos were updated successfully.',
|
||||
'cannot_delete_own_user_account' => 'It is not possible to delete your own user account. Please ask another administrator to delete it for you.',
|
||||
@ -163,7 +166,7 @@ return [
|
||||
'list_albums_title' => 'Albums',
|
||||
'list_comments_intro' => 'Comments are messages left on your photos by visitors and users.',
|
||||
'list_comments_status' => [
|
||||
'all' => '- All -',
|
||||
'all' => '(All comments)',
|
||||
'approved' => 'Approved',
|
||||
'pending' => 'Pending moderation',
|
||||
'rejected' => 'Rejected',
|
||||
@ -233,6 +236,8 @@ return [
|
||||
'redirects_text' => 'To access this album using different addresses, you can use redirects. This is useful when you have moved the album to a different parent and the old address no longer works.',
|
||||
'reject_comment' => 'Reject comment by :author_name',
|
||||
'reject_comment_confirm' => 'Are you sure you want to reject this comment by ":author_name"?',
|
||||
'reject_comments' => 'Reject :number comments',
|
||||
'reject_comments_confirm' => 'Are you sure you want to reject these :number comments?',
|
||||
'replace_image_message' => 'If your photo isn\'t quite perfect, don\'t worry - just upload a new image using the field below and we\'ll replace it.',
|
||||
'replace_image_title' => 'Replace photo',
|
||||
'save_changes_heading' => 'Save changes',
|
||||
|
@ -11,6 +11,7 @@ return [
|
||||
'album_view_label' => 'View as:',
|
||||
'apply_action' => 'Apply',
|
||||
'approve_action' => 'Approve',
|
||||
'approve_selected_action' => 'Approve selected',
|
||||
'bulk_edit_photos_label' => 'Bulk edit selected photos:',
|
||||
'bulk_edit_photos_placeholder' => 'Select an action',
|
||||
'cancel_action' => 'Cancel',
|
||||
@ -50,6 +51,7 @@ return [
|
||||
'realname_label' => 'Your name:',
|
||||
'register_action' => 'Create account',
|
||||
'reject_action' => 'Reject',
|
||||
'reject_selected_action' => 'Reject selected',
|
||||
'remember_me_label' => 'Remember me',
|
||||
'remove_action' => 'Remove',
|
||||
'review_photo_comment_action' => 'Approve/reject comment',
|
||||
|
@ -27,6 +27,7 @@ return [
|
||||
'labels' => 'Labels',
|
||||
'metadata_upgrade' => 'Update Photo Metadata',
|
||||
'reject_comment' => 'Reject comment',
|
||||
'reject_comments' => 'Reject comments',
|
||||
'settings' => 'Settings',
|
||||
'storage' => 'Storage',
|
||||
'users' => 'Users'
|
||||
|
@ -0,0 +1,37 @@
|
||||
@extends(Theme::viewName('layout'))
|
||||
@section('title', trans('admin.approve_comments', ['number' => $comment_count]))
|
||||
|
||||
@section('breadcrumb')
|
||||
<li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('comments.index') }}">@lang('navigation.breadcrumb.comments')</a></li>
|
||||
<li class="breadcrumb-item active">@lang('navigation.breadcrumb.approve_comments')</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 ml-md-auto mr-md-auto">
|
||||
<div class="card bg-info">
|
||||
<div class="card-header text-white">@yield('title')</div>
|
||||
<div class="card-body bg-light">
|
||||
<p>@lang('admin.approve_comments_confirm', ['number' => $comment_count])</p>
|
||||
|
||||
<div class="text-right">
|
||||
<form action="{{ route('comments.applyBulkAction') }}" method="post">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="bulk_approve" value="1" />
|
||||
@foreach ($comment_ids as $comment_id)
|
||||
<input type="hidden" name="comment_ids[]" value="{{ $comment_id }}" />
|
||||
@endforeach
|
||||
|
||||
<a href="{{ route('comments.index') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
|
||||
<button type="submit" class="btn btn-info"><i class="fa fa-fw fa-trash"></i> @lang('forms.approve_action')</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -0,0 +1,37 @@
|
||||
@extends(Theme::viewName('layout'))
|
||||
@section('title', trans('admin.reject_comments', ['number' => $comment_count]))
|
||||
|
||||
@section('breadcrumb')
|
||||
<li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('comments.index') }}">@lang('navigation.breadcrumb.comments')</a></li>
|
||||
<li class="breadcrumb-item active">@lang('navigation.breadcrumb.reject_comments')</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 ml-md-auto mr-md-auto">
|
||||
<div class="card bg-info">
|
||||
<div class="card-header text-white">@yield('title')</div>
|
||||
<div class="card-body bg-light">
|
||||
<p>@lang('admin.reject_comments_confirm', ['number' => $comment_count])</p>
|
||||
|
||||
<div class="text-right">
|
||||
<form action="{{ route('comments.applyBulkAction') }}" method="post">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="bulk_reject" value="1" />
|
||||
@foreach ($comment_ids as $comment_id)
|
||||
<input type="hidden" name="comment_ids[]" value="{{ $comment_id }}" />
|
||||
@endforeach
|
||||
|
||||
<a href="{{ route('comments.index') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
|
||||
<button type="submit" class="btn btn-info"><i class="fa fa-fw fa-trash"></i> @lang('forms.reject_action')</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -83,7 +83,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="btn-group mb-4" role="group">
|
||||
<div class="btn-toolbar mb-4" role="group">
|
||||
<div class="btn-group mr-2">
|
||||
<button type="submit" name="bulk_approve" class="btn btn-outline-info">@lang('forms.approve_selected_action')</button>
|
||||
<button type="submit" name="bulk_reject" class="btn btn-outline-info">@lang('forms.reject_selected_action')</button>
|
||||
</div>
|
||||
<button type="submit" name="bulk_delete" class="btn btn-danger">@lang('forms.delete_selected_action')</button>
|
||||
</div>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user