Merge photo comments feature #114

Merged
aheathershaw merged 28 commits from feature/4-commenting-on-photos into master 2018-10-05 23:37:26 +01:00
5 changed files with 37 additions and 8 deletions
Showing only changes of commit 3f7badd98a - Show all commits

View File

@ -6,6 +6,7 @@ use App\Facade\Theme;
use App\Facade\UserConfig;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Laravel\Socialite\One\TwitterProvider;
@ -29,6 +30,8 @@ class LoginController extends Controller
use AuthenticatesUsers;
protected $generator;
/**
* Where to redirect users after login / registration.
*
@ -41,9 +44,19 @@ class LoginController extends Controller
*
* @return void
*/
public function __construct()
public function __construct(UrlGenerator $generator)
{
$this->middleware('guest', ['except' => 'logout']);
$this->generator = $generator;
}
public function logout(Request $request)
{
$this->guard()->logout();
$request->session()->invalidate();
return redirect()->back();
}
protected function attemptLogin(Request $request)
@ -88,6 +101,8 @@ class LoginController extends Controller
*/
public function showLoginForm(Request $request)
{
$request->getSession()->put('url.intended', $this->generator->previous(false));
return Theme::render('auth.v2_unified', [
'active_tab' => 'login',
'info' => $request->session()->get('info'),

View File

@ -62,6 +62,10 @@
width: auto;
}
.photo-comment .card-subtitle {
font-size: smaller;
}
.stats-table .icon-col {
font-size: 1.4em;
width: 20%;

View File

@ -29,6 +29,7 @@ return [
'manage_album_link' => 'Manage',
'manage_album_link_2' => 'Manage Album',
'next_button' => 'Next Photo »',
'not_you_logout' => 'Not you? Logout',
'open_album_link' => 'Open Album',
'other_albums_description' => 'You may also be interested in the following albums.',
'other_albums_description_empty' => 'The <b>:album_name</b> album does not contain any photos - however you may also be interested in the following albums.',

View File

@ -1,5 +1,6 @@
@php
$is_reply = isset($reply_comment);
$is_known_user = !is_null(Auth::user())
@endphp
{{-- Show a previous of the comment we're replying to --}}
@ -18,7 +19,7 @@ $is_reply = isset($reply_comment);
<div class="form-group">
<label for="commentor-name">@lang('forms.name_label')</label>
<input type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" id="commentor-name" name="name" value="{{ old('name') }}"/>
<input type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" id="commentor-name" name="name" value="{{ old('name', ($is_known_user ? Auth::user()->name : '')) }}"{{ $is_known_user ? ' readonly="readonly"' : '' }}/>
@if ($errors->has('name'))
<div class="invalid-feedback">
@ -29,13 +30,17 @@ $is_reply = isset($reply_comment);
<div class="form-group">
<label for="commentor-email">@lang('forms.email_label')</label>
<input type="text" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" id="commentor-email" name="email" value="{{ old('email') }}" placeholder="@lang('forms.email_placeholder')"/>
<input type="text" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" id="commentor-email" name="email" value="{{ old('email', ($is_known_user ? Auth::user()->email : '')) }}" placeholder="@lang('forms.email_placeholder')"{{ $is_known_user ? ' readonly="readonly"' : '' }}//>
@if ($errors->has('email'))
<div class="invalid-feedback">
<strong>{{ $errors->first('email') }}</strong>
</div>
@endif
@if ($is_known_user)
<a class="btn btn-link" href="{{ url('/logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">@lang('gallery.not_you_logout')</a>
@endif
</div>
<div class="form-group">
@ -64,7 +69,10 @@ $is_reply = isset($reply_comment);
function initTinyMce(selector)
{
tinymce.init({
selector: selector
selector: selector,
plugins: 'textcolor lists link image',
toolbar1: 'bold italic strikethrough forecolor backcolor | link image | alignleft aligncenter alignright alignjustify | numlist bullist | removeformat',
menubar: false
});
}

View File

@ -4,11 +4,12 @@
<div class="card photo-comment mt-2" data-comment-id="{{ $comment->id }}"@if (!$is_reply) style="margin-left: {{ $comment->depth() * 20 }}px;"@endif>
<div class="card-body">
<h5 class="card-title"><b>{{ $comment->authorDisplayName() }}</b>:</h5>
<h6 class="card-subtitle mb-2 text-muted">{{ date(UserConfig::get('date_format'), strtotime($comment->created_at)) }}</h6>
<p>{!! $comment->textAsHtml() !!}</p>
<img class="img-thumbnail rounded float-left mr-3 mb-2" src="{{ Theme::gravatarUrl($comment->email) }}" alt="{{ $comment->authorDisplayName() }}" title="{{ $comment->authorDisplayName() }}">
<h5 class="card-title mt-1"><b>{{ $comment->authorDisplayName() }}</b></h5>
<h6 class="card-subtitle mb-4 text-muted">{{ date(UserConfig::get('date_format'), strtotime($comment->created_at)) }}</h6>
{!! $comment->textAsHtml() !!}
@if (!$is_reply && $comment->depth() < UserConfig::get('photo_comments_thread_depth'))
@if (!$is_reply && ($comment->depth() < UserConfig::get('photo_comments_thread_depth') - 1))
<a href="{{ $photo->replyToCommentFormUrl($comment->id) }}" v-on:click="replyToComment" class="card-link">@lang('gallery.photo_comments_reply_action')</a>
@endif
</div>