add and delete news from admin dashboard #52
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="header">
|
||||
<h4 class="title">Announcements</h4>
|
||||
<p class="category">just updated</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
blah blah blah
|
||||
</div>
|
||||
</div>
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
@include('admin.dashboard.announcements')
|
||||
@include('admin.dashboard.news')
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
@component('admin.components.infobox')
|
||||
@@ -43,4 +43,17 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).on('submit', 'form.pjax_news_form', function (event) {
|
||||
event.preventDefault();
|
||||
$.pjax.submit(event, '#pjax_news_wrapper', {push: false});
|
||||
});
|
||||
|
||||
/*$(document).on('pjax:complete', function () {
|
||||
$(".select2").select2();
|
||||
});*/
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
64
resources/views/admin/dashboard/news.blade.php
Normal file
64
resources/views/admin/dashboard/news.blade.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<div id="pjax_news_wrapper">
|
||||
<div class="card border-blue-bottom">
|
||||
@if($news->count() === 0)
|
||||
<div class="text-center text-muted" style="padding: 30px;">
|
||||
no news items
|
||||
</div>
|
||||
@endif
|
||||
@foreach($news as $item)
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<h4 class="title">{!! $item->subject !!}</h4>
|
||||
<p class="category">{!! $item->user->name !!} - {!! show_datetime($item->created_at) !!}</p>
|
||||
</div>
|
||||
|
||||
{!! $item->body !!}
|
||||
|
||||
<div class="text-right">
|
||||
{!! Form::open(['route' => 'admin.dashboard.news',
|
||||
'method' => 'delete',
|
||||
'class' => 'pjax_news_form',
|
||||
]) !!}
|
||||
{!! Form::hidden('news_id', $item->id) !!}
|
||||
{!!
|
||||
Form::button('delete',
|
||||
['type' => 'submit',
|
||||
'class' => ' btn btn-danger btn-xs text-small'])
|
||||
|
||||
!!}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
@endforeach
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<h4 class="title">Add News</h4>
|
||||
</div>
|
||||
{!! Form::open(['route' => 'admin.dashboard.news',
|
||||
'method' => 'post',
|
||||
'class' => 'pjax_news_form',
|
||||
]) !!}
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>{!! Form::label('subject', 'Subject:') !!}</td>
|
||||
<td>{!! Form::text('subject', '', ['class' => 'form-control']) !!}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{!! Form::label('body', 'Body:') !!}</td>
|
||||
<td>{!! Form::textarea('body', '', ['class' => 'form-control']) !!}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="text-right">
|
||||
{!!
|
||||
Form::button('<i class="glyphicon glyphicon-plus"></i> add',
|
||||
['type' => 'submit',
|
||||
'class' => 'btn btn-success btn-s'])
|
||||
|
||||
!!}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user