Skip to content

Commit

Permalink
Hidden edit and delete from none original post members
Browse files Browse the repository at this point in the history
  • Loading branch information
WillTheDeveloper committed Mar 12, 2022
1 parent 8a03f5c commit ba2e62a
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions resources/views/communitypost.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class="group flex items-center px-3 py-2 text-sm font-medium text-gray-600 round
<p class="line-clamp-2 text-sm text-gray-600">{{$p->body}}</p>
</div>--}}

@if($p->user_id == auth()->id())
<span x-show="menu" x-cloak class="relative z-0 inline-flex shadow-sm rounded-md">
<button x-on:click="content=false; edit=true; menu=false" type="button" class="relative inline-flex items-center px-4 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500">Edit</button>
<form method="post" action="{{ route('community.comment.delete', $p->id) }}">
Expand All @@ -255,18 +256,20 @@ class="group flex items-center px-3 py-2 text-sm font-medium text-gray-600 round
</form>
</span>

<div x-show="edit" x-cloak>
<form method="post" action="{{ route('community.comment.update', $p->id) }}">
@csrf
<div>
<label for="comment" class="block text-sm font-medium text-gray-700">Edit your comment</label>
<div class="mt-1">
<textarea rows="4" name="comment" id="comment" class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md">{{$p->comment}}</textarea>

<div x-show="edit" x-cloak>
<form method="post" action="{{ route('community.comment.update', $p->id) }}">
@csrf
<div>
<label for="comment" class="block text-sm font-medium text-gray-700">Edit your comment</label>
<div class="mt-1">
<textarea rows="4" name="comment" id="comment" class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md">{{$p->comment}}</textarea>
</div>
</div>
</div>
<button type="submit" class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Update</button>
</form>
</div>
<button type="submit" class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Update</button>
</form>
</div>
@endif
</li>
@endforeach

Expand Down

0 comments on commit ba2e62a

Please sign in to comment.