Bootstrap4 :: Article and Category page UI updated

This commit is contained in:
Sakthi002
2020-12-18 18:18:53 +05:30
committed by Manish Verma
parent f1cd59fe29
commit fc880a9504
5 changed files with 188 additions and 104 deletions

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.client.layout.logclient')
@section('home')
class = "active"
class = "nav-item active"
@stop
@section('breadcrumb')

View File

@@ -6,54 +6,70 @@
@stop
@section('kb')
class = "active"
class = "nav-item active"
@stop
@section('content')
<div id="content" class="site-content col-md-9">
<header class="archive-header">
<h1 >{!! $category->name !!}</h1>
</header><!-- .archive-header -->
<blockquote class="archive-description" style="display: none;">
<p>{!! $category->description !!}</p>
</blockquote>
<h1 class="archive-title">{!! $category->name !!}</h1>
</header>
<div class="archive-list archive-article">
<?php foreach ($article_id as $id) { ?>
<?php
$article = App\Model\kb\Article::where('id', $id);
if (!Auth::user() || Auth::user()->role == 'user') {
$article = $article->where('status', 1);
$article = $article->where('type', 1);
}
$article = $article->orderBy('publish_time', 'desc');
$article = $article->get();
?>
@forelse($article as $arti)
<article class="hentry">
<?php
$article = App\Model\kb\Article::where('id', $id);
if (!Auth::user() || Auth::user()->role == 'user') {
$article = $article->where('status', 1);
$article = $article->where('type', 1);
}
$article = $article->orderBy('publish_time', 'desc');
$article = $article->get();
?>
@forelse($article as $arti)
<article class="hentry">
<header class="entry-header">
<i class="fa fa-list-alt fa-2x fa-fw pull-left text-muted"></i>
<h2 class="entry-title h4"><a href="{{url('show/'.$arti->slug)}}" onclick="toggle_visibility('foo');">{{$arti->name}}</a></h2>
</header><!-- .entry-header -->
<i class="fa fa-list-alt fa-2x fa-fw float-left text-muted"></i>
<h2 class="entry-title h4">
<a href="{{url('show/'.$arti->slug)}}" onclick="toggle_visibility('foo');">{{$arti->name}}</a>
</h2>
</header>
<?php $str = $arti->description; ?>
<?php $excerpt = App\Http\Controllers\Client\kb\UserController::getExcerpt($str, $startPos = 0, $maxLength = 400); ?>
<blockquote class="archive-description">
<blockquote class="blockquote archive-description" id="block" style="margin-bottom: 10px; margin-top: 10px;">
<?php $content = trim(preg_replace("/<img[^>]+\>/i", "", $excerpt), " \t.") ?>
<p>{!! strip_tags($content) !!}</p>
<a class="readmore-link" href="{{url('show/'.$arti->slug)}}">{!! Lang::get('lang.read_more') !!}</a>
</blockquote>
<p><a href="{{url('show/'.$arti->slug)}}">{!! Lang::get('lang.read_more') !!}</a></p>
</blockquote>
<footer class="entry-footer">
<div class="entry-meta text-muted">
<span class="date"><i class="fa fa-clock-o fa-fw"></i> <time datetime="2013-10-22T20:01:58+00:00">{{$arti->created_at->format('l, d-m-Y')}}</time></span>
</div><!-- .entry-meta -->
</footer><!-- .entry-footer -->
</article><!-- .hentry -->
<span style="margin-right:0px;"><i class="far fa-clock fa-fw"></i>
<span>{{$arti->created_at->format('l, d-m-Y')}}</span>
</span>
</div>
</footer>
</article>
@empty
<p>No articles available</p>
@endforelse
<?php
@endforelse
<?php
}
//echo $all->render();
?>
?>
</div>
</div>
<script type="text/javascript">
@@ -70,19 +86,45 @@ class = "active"
@stop
@section('category')
<h2 class="section-title h4 clearfix">{!! Lang::get('lang.categories') !!}<small class="pull-right"><i class="fa fa-hdd-o fa-fw"></i></small></h2>
<ul class="nav nav-pills nav-stacked nav-categories">
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id', '=', $category->id)->get();
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li><a href="{{url('category-list/'.$category->slug)}}"><span class="badge pull-right">{{$numcount}}</span>{{$category->name}}</a></li>
@endforeach
</ul>
<div id="sidebar" class="site-sidebar col-md-3">
<div class="col-sm-12">
<div class="widget-area">
<section id="section-categories" class="section">
<h2 class="section-title h4 clearfix">
<i class="line"></i>{!! Lang::get('lang.categories') !!}
<small class="float-right"><i class="far fa-hdd fa-fw"></i></small>
</h2>
<ul class="nav nav-pills nav-stacked nav-categories">
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id','=', $category->id)->get();
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li class="d-flex justify-content-between align-items-center">
<a href="{{url('category-list/'.$category->slug)}}" class="list-group-item list-group-item-action" style="padding: 5px;">
<span class="badge badge-pill float-right" style="margin-top: 2px;">{{$numcount}}</span>
{{$category->name}}
</a>
</li>
@endforeach
</ul>
</section>
</div>
</div>
</div>
@stop

View File

@@ -1,4 +1,15 @@
@extends('themes.default1.client.layout.client')
@section('title')
@if(isset($category->name))
{!! $category->name !!} -
@endif
@stop
@section('kb')
class = "nav-item active"
@stop
@section('breadcrumb')
<?php
@@ -24,24 +35,26 @@ $category_id = $all->pluck('category_id')->toArray();
{!! $arti->name !!} -
@stop
@section('content')
<div id="content" class="site-content col-md-9">
<!--
<article class=" type-post format-standard hentry clearfix">
<h1 class="post-title"><a href="#">{{$arti->name}}</a></h1>
<div class="post-meta clearfix">
<span class="date">{{$arti->created_at}}</span>
<span class="category"><a href="#" title="View all posts in Server &amp; Database">{{$category->name}}</a></span>
</div> end of post meta
{!!$arti->description!!}
</article>-->
<article class="hentry">
<header class="entry-header">
<h1 class="entry-title">{{$arti->name}}</h1>
<div class="entry-meta text-muted">
<span class="date"><i class="fa fa-film fa-fw"></i> <time datetime="2013-09-19T20:01:58+00:00">{{$arti->created_at->format('l, d-m-Y')}}</time></span>
<span class="category"><i class="fa fa-folder-open-o fa-fw"></i> <a href="#">{{$category->name}}</a></span>
<span class="date">
<i class="far fa-clock fa-fw"></i>
<time datetime="2013-09-19T20:01:58+00:00">{{$arti->created_at->format('l, d-m-Y')}}</time>
</span>
<span class="category">
<i class="fas fa-folder-open fa-fw"></i>
<a href="{{url('category-list/'.$category->slug)}}">{{$category->name}}</a>
</span>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
@@ -52,6 +65,7 @@ $category_id = $all->pluck('category_id')->toArray();
</div><!-- .entry-content -->
</article><!-- .hentry -->
<?php $comments = App\Model\kb\Comment::where('article_id', $arti->id)->where('status', '1')->get(); ?>
<div id="comments" class="comments-area">
@@ -84,40 +98,41 @@ $category_id = $all->pluck('category_id')->toArray();
</li><!-- .comment -->
</ol><!-- .comment-list -->
@endforeach
<div id="respond" class="comment-respond form-border">
<h3 id="reply-title" class="comment-reply-title section-title">{!! Lang::get('lang.leave_a_reply') !!}</h3>
<h3 id="reply-title" class="comment-reply-title section-title">
<i class="line"></i>{!! Lang::get('lang.leave_a_reply') !!}
</h3>
{!! Form::open(['method'=>'post','url'=>'postcomment/'.$arti->slug]) !!}
<div class="row">
<div class="form-group">
<div class="col-md-4">
<div class="form-group {{ $errors->has('name') ? 'has-error' : '' }}">
{!! Form::label('name',Lang::get('lang.name')) !!}
{!! $errors->first('name', '<spam class="help-block" style="red">:message</spam>') !!}
{!! Form::text('name',null,['class' => 'form-control']) !!}
</div>
<div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::label('email',Lang::get('lang.email')) !!}
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('email',null,['class' => 'form-control']) !!}
</div>
<div class="form-group {{ $errors->has('website') ? 'has-error' : '' }}">
{!! Form::label('website',Lang::get('lang.website')) !!}
{!! $errors->first('website', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('website',null,['class' => 'form-control']) !!}
</div>
<button type="submit" class="btn btn-custom btn-lg">{!! Lang::get('lang.post_message') !!}</button>
<div class="col-md-4">
<div class="form-group {{ $errors->has('name') ? 'has-error' : '' }}">
{!! Form::label('name',Lang::get('lang.name')) !!}
{!! Form::text('name',null,['class' => 'form-control']) !!}
{!! $errors->first('name', '<spam class="help-block" style="red">:message</spam>') !!}
</div>
<div class="col-md-8">
<div class="form-group {{ $errors->has('comment') ? 'has- error' : '' }}">
{!! Form::label('comment',Lang::get('lang.message')) !!}
{!! $errors->first('comment', '<spam class="help-block">:message</spam>') !!}
{!! Form::textarea('comment',null,['class' => 'form-control','size' => '30x8','id'=>'comment']) !!}
</div>
</div>
<div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::label('email',Lang::get('lang.email')) !!}
{!! Form::text('email',null,['class' => 'form-control']) !!}
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
</div>
<div class="form-group {{ $errors->has('website') ? 'has-error' : '' }}">
{!! Form::label('website',Lang::get('lang.website')) !!}
{!! Form::text('website',null,['class' => 'form-control']) !!}
{!! $errors->first('website', '<spam class="help-block">:message</spam>') !!}
</div>
<button type="submit" class="btn btn-custom btn-lg">{!! Lang::get('lang.post_message') !!}</button>
</div>
<div class="col-md-8">
<div class="form-group {{ $errors->has('comment') ? 'has- error' : '' }}">
{!! Form::label('comment',Lang::get('lang.message')) !!}
{!! Form::textarea('comment',null,['class' => 'form-control','size' => '30x8','id'=>'comment']) !!}
{!! $errors->first('comment', '<spam class="help-block">:message</spam>') !!}
</div>
</div>
</div>
{!! Form::close() !!}
</div><!-- #respond -->
</div>
@@ -125,30 +140,49 @@ $category_id = $all->pluck('category_id')->toArray();
<script type="text/javascript">
$(function () {
$("textarea").wysihtml5();
$("textarea").summernote();
});
</script>
@stop
@section('title')
@if(isset($category->name))
{!! $category->name !!} -
@endif
@stop
@section('category')
<h2 class="section-title h4 clearfix">{!! Lang::get('lang.categories') !!}<small class="pull-right"><i class="fa fa-hdd-o fa-fw"></i></small></h2>
<ul class="nav nav-pills nav-stacked nav-categories">
<?php $categorys = App\Model\kb\Category::all(); ?>
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id','=', $category->id)->get();
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li><a href="{{url('category-list/'.$category->slug)}}"><span class="badge pull-right">{{$numcount}}</span>{{$category->name}}</a></li>
@endforeach
</ul>
<div id="sidebar" class="site-sidebar col-md-3">
<div class="col-sm-12">
<div class="widget-area">
<section id="section-categories" class="section">
<h2 class="section-title h4 clearfix">
<i class="line"></i>{!! Lang::get('lang.categories') !!}
<small class="float-right"><i class="far fa-hdd fa-fw"></i></small>
</h2>
<ul class="nav nav-pills nav-stacked nav-categories">
<?php $categorys = App\Model\kb\Category::all(); ?>
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id','=', $category->id)->get();
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li class="d-flex justify-content-between align-items-center">
<a href="{{url('category-list/'.$category->slug)}}" class="list-group-item list-group-item-action" style="padding: 5px;">
<span class="badge badge-pill float-right" style="margin-top: 2px;">{{$numcount}}</span>{{$category->name}}
</a>
</li>
@endforeach
</ul>
</section>
</div>
</div>
</div>
@stop

View File

@@ -71,6 +71,10 @@
.alert { width: 100% !important; }
.has-error .form-control { border-color : #dd4b39; }
.help-block { color : #dd4b39; }
.text-red { color: red; }
</style>
<div id="page" class="hfeed site text-small">

View File

@@ -71,6 +71,10 @@
.alert { width: 100% !important; }
.has-error .form-control { border-color : #dd4b39; }
.help-block { color : #dd4b39; }
.text-red { color: red; }
</style>
<div id="page" class="hfeed site text-small">