FEATURE: make content list in admin nicer

This commit is contained in:
Michal Kváček
2017-04-05 01:40:47 +02:00
parent 2e8f8dca1f
commit 870ca540c4
5 changed files with 403 additions and 400 deletions
+5 -2
View File
@@ -1,13 +1,15 @@
<?php <?php
namespace App\CMS\Widgets\Menu; namespace App\CMS\Widgets\Menu;
use App\CMS\Contracts\Repositories\Content as IContent;
use App\CMS\Contracts\Widgets\PublicWidget; use App\CMS\Contracts\Widgets\PublicWidget;
use App\CMS\Widgets\Contracts\WidgetRenderer; use App\CMS\Contracts\Widgets\WidgetRenderer;
use App\CMS\Widgets\Exceptions\MissingParameterException; use App\CMS\Widgets\Exceptions\MissingParameterException;
use App\Http\Requests\Request; use App\Http\Requests\Request;
use App\Models\Content\Content; use App\Models\Content\Content;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization; use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
use App\CMS\Contracts\Repositories\Content as IContent; use Modules\Blog\Article\Handlers\Article;
class Menu implements PublicWidget class Menu implements PublicWidget
{ {
@@ -76,6 +78,7 @@ class Menu implements PublicWidget
$pages = Content::where('language', LaravelLocalization::getCurrentLocale()) $pages = Content::where('language', LaravelLocalization::getCurrentLocale())
->whereIn('id', $ids) ->whereIn('id', $ids)
->whereIn('status', $allowedStatuses) ->whereIn('status', $allowedStatuses)
->where('moduleHandler', '!=', Article::class)
->get(); ->get();
$used = []; $used = [];
foreach ($pages as $page) { foreach ($pages as $page) {
+3 -1
View File
@@ -1,4 +1,5 @@
<?php <?php
namespace App\CMS\Widgets\Menu\Presenters; namespace App\CMS\Widgets\Menu\Presenters;
use App\CMS\Contracts\Repositories\Content as ContentContract; use App\CMS\Contracts\Repositories\Content as ContentContract;
@@ -81,7 +82,8 @@ class Menu implements WidgetRenderer
$content = app(ContentContract::class); $content = app(ContentContract::class);
// get list of all pages // get list of all pages
$pages = $content->getOverview(); $pages = $content->getOverview()
->get();
$widget->settings = new \stdClass(); $widget->settings = new \stdClass();
$widget->settings->links = []; $widget->settings->links = [];
@@ -1,7 +1,5 @@
@import "../imports"; @import "../imports";
/* ******************************************* /* *******************************************
* Item List general styles * Item List general styles
********************************************** */ ********************************************** */
@@ -10,7 +8,6 @@
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 0; margin: 0;
margin-bottom: 0;
line-height: $item-list-line-height; line-height: $item-list-line-height;
@include media(lg) { @include media(lg) {
@@ -29,11 +26,11 @@
flex-flow: column nowrap; flex-flow: column nowrap;
&.striped { &.striped {
& > li { & > div {
border-bottom: 1px solid $item-list-color-border; border-bottom: 1px solid $item-list-color-border;
} }
& > li:nth-child(2n + 1) { & > div:nth-child(2n + 1) {
background-color: lighten($color-divider, 12%); background-color: lighten($color-divider, 12%);
@include media-down(sm) { @include media-down(sm) {
@@ -47,12 +44,10 @@
} }
} }
/* ******************************************* /* *******************************************
* Item general styles * Item general styles
********************************************** */ ********************************************** */
.item-list { .item-list {
.item { .item {
display: flex; display: flex;
@@ -117,12 +112,10 @@
} }
} }
/* ******************************************* /* *******************************************
* Item components * Item components
********************************************** */ ********************************************** */
.item-list { .item-list {
/******************************************** /********************************************
@@ -220,7 +213,7 @@
.item-img { .item-img {
flex-grow: 1; flex-grow: 1;
align-self: stretch; align-self: stretch;
background-color: #efefef; background-color: #EFEFEF;
padding-bottom: 100%; padding-bottom: 100%;
width: 100%; width: 100%;
height: 0; height: 0;
@@ -328,7 +321,6 @@
left: 100%; left: 100%;
} }
.item-actions-list { .item-actions-list {
padding: 0; padding: 0;
list-style: none; list-style: none;
@@ -367,7 +359,6 @@
} }
/* ******************************************* /* *******************************************
* Adjustments * Adjustments
********************************************** */ ********************************************** */
@@ -1,5 +1,9 @@
@import "../../../imports"; @import "../../../imports";
.item-list {
}
.items-list-page { .items-list-page {
.title-search-block { .title-search-block {
@@ -313,12 +317,7 @@
text-align: left; text-align: left;
} }
}
} }
} }
}
} }
@@ -22,7 +22,9 @@
@endif @endif
@if (count($pages) > 0) @if (count($pages) > 0)
<div class="item-list rows-striped"> <div class="card items">
<div class="card-block">
<div class="item-list striped rows-striped">
<div class="row bold p-tb-15"> <div class="row bold p-tb-15">
<div class="col-md-1 hidden-sm-down"></div> <div class="col-md-1 hidden-sm-down"></div>
<div class="col-xs-10 col-md-3 col-lg-4">@lang('admin/contents.title')</div> <div class="col-xs-10 col-md-3 col-lg-4">@lang('admin/contents.title')</div>
@@ -55,7 +57,8 @@
{{$page->title}} {{$page->title}}
</a> </a>
@if($page->isHomepage) <span class="m-l-10 tag tag-primary">@lang('admin/contents.homepage')</span> @endif @if($page->isHomepage) <span
class="m-l-10 tag tag-primary">@lang('admin/contents.homepage')</span> @endif
</div> </div>
<div class="col-lg-2 col-md-3 hidden-sm-down"> <div class="col-lg-2 col-md-3 hidden-sm-down">
<span class="tag @if($page->isPublic()) tag-success <span class="tag @if($page->isPublic()) tag-success
@@ -85,7 +88,8 @@
<li> <li>
<a href="{{route('content.setHomepage', ['id' => $page->id])}}" <a href="{{route('content.setHomepage', ['id' => $page->id])}}"
data-toggle="tooltip" title="@lang('admin/contents.setHomepage')"> data-toggle="tooltip"
title="@lang('admin/contents.setHomepage')">
<i class="fa fa-home"></i> <i class="fa fa-home"></i>
</a> </a>
</li> </li>
@@ -115,7 +119,8 @@
</li> </li>
@else @else
<li> <li>
<a href="{{route('page.content', ['url' => $page->url])}}" target="_blank" <a href="{{route('page.content', ['url' => $page->url])}}"
target="_blank"
data-toggle="tooltip" title="@lang('admin/contents.viewPage')" data-toggle="tooltip" title="@lang('admin/contents.viewPage')"
class="button tiny secondary"><i class="fa fa-globe"></i> class="button tiny secondary"><i class="fa fa-globe"></i>
</a> </a>
@@ -144,10 +149,13 @@
</div> </div>
@endforeach @endforeach
</div> </div>
</div>
<div class="row"> <div class="card-footer">
{!! $pages->render() !!} {!! $pages->render() !!}
</div> </div>
</div>
@else @else
<div class="alert alert-info"> <div class="alert alert-info">