/
home
/
sjslayjy
/
public_html
/
theweavenest
/
resources
/
views
/
Admin
/
Upload File
HOME
@extends('admin/layout') @section('page_title', 'Posts') @section('size_select', 'active') @section('container') @if(session()->has('message')) <div class="sufee-alert alert with-close alert-success alert-dismissible fade show"> {{ session('message') }} <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> @endif <h1 class="mb10">Blog</h1> <a href="{{ url('admin/posts/manage_posts') }}"> <button type="button" class="btn btn-success"> Add Blog </button> </a> <div class="row m-t-30"> <div class="col-md-12"> <!-- DATA TABLE--> <div class="table-responsive m-b-40"> <table class="table table-borderless table-data3"> <thead> <tr> <th>Title</th> <th>Content</th> <th>Image</th> <th>Action</th> </tr> </thead> <tbody> @foreach($posts as $post) <tr> <td>{{ $post->title }}</td> <td> <span id="descriptionShort">{{ substr($post->description, 0, 100) }}</span> <span id="descriptionFull" style="display: none;">{{ $post->description }}</span> <button id="toggleButton" onclick="toggleDescription()">More</button> </td> <td> <img src="{{ asset('storage/media/category/' . $post->image) }}" alt="Image" width="100"> </td> <td> <a href="{{ url('admin/posts/manage_posts/' . $post->id) }}" class="btn btn-success">Edit</a> @if($post->status == 1) <a href="{{ url('admin/posts/status/0/' . $post->id) }}" class="btn btn-primary">Active</a> @elseif($post->status == 0) <a href="{{ url('admin/posts/status/1/' . $post->id) }}" class="btn btn-warning">Deactive</a> @endif <a href="{{ url('admin/posts/delete/' . $post->id) }}" class="btn btn-danger">Delete</a> </td> </tr> @endforeach </tbody> </table> </div> <!-- END DATA TABLE--> </div> </div> <script> function toggleDescription() { var shortDesc = document.getElementById('descriptionShort'); var fullDesc = document.getElementById('descriptionFull'); if (shortDesc.style.display === 'none') { shortDesc.style.display = 'inline'; fullDesc.style.display = 'none'; event.target.innerText = 'More'; } else { shortDesc.style.display = 'none'; fullDesc.style.display = 'inline'; event.target.innerText = 'Less'; } } </script> @endsection