Skip to content

Commit

Permalink
Merge branch 'master' into new_files_from_core
Browse files Browse the repository at this point in the history
  • Loading branch information
PSkierniewski committed Dec 29, 2017
2 parents 5368d0b + 7fa732f commit ed1cc73
Show file tree
Hide file tree
Showing 51 changed files with 3,594 additions and 546 deletions.
File renamed without changes
11 changes: 7 additions & 4 deletions resources/views/blocks/basic.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<div class="block {{isset($block->theme) ? $block->theme : 'col-sm-12'}}">
@if(isset($translation))
<?php /* @var $block \Gzero\Cms\ViewModels\BlockViewModel */ ?>
<div class="block {{ $block->theme('col-sm-12') }}">
@if($block->hasTitle())
<div class="block-title">
<h4>{{ $translation->title }}</h4>
<h4>{{ $block->title() }}</h4>
</div>
@endif
@if($block->hasBody())
<div class="block-body">
{!! $translation->body !!}
{!! $block->body() !!}
</div>
@endif
</div>
11 changes: 7 additions & 4 deletions resources/views/blocks/menu.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<div class="block {{isset($block->theme) ? $block->theme : 'col-sm-12'}}">
@if(isset($translation))
<?php /* @var $block \Gzero\Cms\ViewModels\BlockViewModel */ ?>
<div class="block {{ $block->theme('col-sm-12') }}">
@if($block->hasTitle())
<div class="block-title">
<h2>{{ $translation->title }}</h2>
<h4>{{ $block->title() }}</h4>
</div>
@endif
@if($block->hasBody())
<div class="block-body">
{!! $translation->body !!}
{!! $block->body() !!}
</div>
@endif
</div>
13 changes: 8 additions & 5 deletions resources/views/blocks/slider.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<div class="{{isset($block->theme) ? $block->theme : 'col-sm-12'}}">
<div id="slider-{{$block->id}}" class="slider">
<?php /* @var $block \Gzero\Cms\ViewModels\BlockViewModel */ ?>
<div class="{{ $block->theme('col-sm-12') }}">
<div id="slider-{{$block->id()}}" class="slider">
<div class="jumbotron">
@if(isset($translation))
<h1>{{ $translation->title }}</h1>
<p>{!! $translation->body !!}</p>
@if($block->hasTitle())
<h2>{{ $block->title() }}</h2>
@endif
@if($block->hasBody())
<p>{!! $block->body() !!}</p>
@endif
<p>
<a class="btn btn-lg btn-success" href="{{ route('register') }}" role="button">
Expand Down
11 changes: 7 additions & 4 deletions resources/views/blocks/widget.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<div class="block {{isset($block->theme) ? $block->theme : 'col-sm-12'}}">
@if(isset($translation))
<?php /* @var $block \Gzero\Cms\ViewModels\BlockViewModel */ ?>
<div class="block {{ $block->theme('col-sm-12') }}">
@if($block->hasTitle())
<div class="block-title">
<h2>{{ $translation->title }}</h2>
<h4>{{ $block->title() }}</h4>
</div>
@endif
@if($block->hasBody())
<div class="block-body">
{!! $translation->body !!}
{!! $block->body() !!}
</div>
@endif
</div>
95 changes: 41 additions & 54 deletions resources/views/contents/_article.blade.php
Original file line number Diff line number Diff line change
@@ -1,61 +1,48 @@
<?php $childTranslation = $child->translation($language->code); ?>
@if($childTranslation)
<?php $childUrl = $child->routeUrl($language->code); ?>
<article class="{{ $child->is_sticky ? 'is-sticky' : '' }}{{ $child->is_promoted ? ' is-promoted' : '' }}">
<h2 class="article-title">
<a href="{{ $childUrl }}">
{{ $childTranslation->title }}
</a>
</h2>
<div class="row justify-content-between article-meta">
<div class="col col-md-auto">
<p class="text-muted">
<small>@lang('gzero-core::common.posted_by') {{ $child->authorName() }}</small>
<small>@lang('gzero-core::common.posted_on') {{ $child->publishDate() }}</small>
</p>
</div>
@if(config('gzero-cms.disqus.enabled') && $child->is_comment_allowed)
<div class="col-auto">
<a href="{{ $childUrl }}#disqus_thread"
data-disqus-identifier="{{ $child->id }}"
class="disqus-comment-count">
0 @lang('gzero-core::common.comments')
</a>
</div>
@endif
<?php /* @var $child \Gzero\Cms\ViewModels\ContentViewModel */ ?>
<article class="{{ $child->isSticky() ? 'is-sticky' : '' }}{{ $child->isPromoted() ? ' is-promoted' : '' }}">
<h2 class="article-title">
<a href="{{ $child->url() }}">
{{ $child->title() }}
</a>
</h2>
<div class="row justify-content-between article-meta">
<div class="col col-md-auto">
<p class="text-muted">
<small>@lang('gzero-core::common.posted_by') {{ $child->author()->displayName() }}</small>
<small>@lang('gzero-core::common.posted_on') {{ $child->publishedAt() }}</small>
</p>
</div>
@if($child->thumb)
<?php $thumbTranslation = $child->thumb->translation($language->code); ?>
<div class="row mb-2">
<div class="col">
<img class="img-fluid img-thumbnail"
title="{{($thumbTranslation)? $thumbTranslation->title : ''}}"
src="{{croppaUrl($child->thumb->getFullPath(),
config('gzero.image.thumb.width'), config('gzero.image.thumb.height'), ['resize'])}}"
alt="{{($thumbTranslation)? $thumbTranslation->title : ''}}">
</div>
</div>
@endif
{!! $childTranslation->teaser !!}
<div class="row justify-content-md-between">
<div class="col-12 col-md-auto mb-3 mb-md-0">
<a href="{{ $childUrl }}" class="btn btn-outline-primary">
@lang('gzero-core::common.read_more')
@if(config('gzero-cms.disqus.enabled') && $child->isCommentAllowed())
<div class="col-auto">
<a href="{{ $child->url() }}#disqus_thread"
data-disqus-identifier="{{ $child->id() }}"
class="disqus-comment-count">
0 @lang('gzero-core::common.comments')
</a>
</div>
<div class="col col-md-auto">
<ul class="list-inline text-muted">
<li class="list-inline-item">
@lang('gzero-core::common.rating') {!! $child->ratingStars() !!}
</li>
<li class="list-inline-item">
@lang('gzero-core::common.number_of_views') {{ $child->visits }}
</li>
</ul>
@endif
</div>
@if($child->hasThumbnail())
<?php $thumbTranslation = $child->thumb->translation($language->code); ?>
<div class="row mb-2">
<div class="col">
<img class="img-fluid img-thumbnail"
title="{{($thumbTranslation)? $thumbTranslation->title : ''}}"
src="{{croppaUrl($child->thumb->getFullPath(),
config('gzero.image.thumb.width'), config('gzero.image.thumb.height'), ['resize'])}}"
alt="{{($thumbTranslation)? $thumbTranslation->title : ''}}">
</div>
</div>
</article>
@if($loop->remaining)
<hr class="my-4"/>
@endif
{!! $child->teaser() !!}
<div class="row justify-content-md-between">
<div class="col-12 col-md-auto mb-3 mb-md-0">
<a href="{{ $child->url() }}" class="btn btn-outline-primary">
@lang('gzero-core::common.read_more')
</a>
</div>
</div>
</article>
@if($loop->remaining)
<hr class="my-4"/>
@endif
2 changes: 1 addition & 1 deletion resources/views/contents/_notPublishedContentMsg.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@if(!$content->canBeShown())
@if(!$content->isPublished())
<div class="row justify-content-md-center">
<div class="col-12 col-md-auto">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
Expand Down
45 changes: 45 additions & 0 deletions resources/views/contents/_stDataMarkup.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php /* @var $content \Gzero\Cms\ViewModels\ContentViewModel */ ?>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"publisher": {
"@type": "Organization",
"url": "{{ routeMl('home') }}",
"name": "{{ config('app.name') }}",
"logo": {
"@type": "ImageObject",
"url": "{{ asset('/images/logo.png') }}"
}
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{{ routeMl('home') }}"
},
@if(isset($content))
"headline": "{{ $content->title()}}",
"author": {
"@type": "Person",
"name": "{{ $content->author()->displayName() }}"
},
"datePublished": "{{ $content->publishedAt() }}",
"dateModified": "{{ $content->updatedAt() }}",
"url": "{{ $content->url() }}",
@if($content->hasAncestors())
"articleSection": "{{ implode(',', $content->ancestorsNames()) }}",
@endif
"image": {
"@type": "ImageObject",
@if($content->hasThumbnail())
"url": "{{ asset(croppaUrl($content->thumb->getFullPath())) }}",
"width": "{{ isset($width) ? $width : config('gzero-cms.image.thumb.width') }}",
"height": "{{ isset($height) ? $height : 'auto' }}"
@else
"url": "{{ $content->firstImageUrl($content->teaser(), asset('images/share-logo.png')) }}",
"width": "{{ config('gzero-cms.image.thumb.width') }}",
"height": "{{ 'auto' }}"
@endif
}
@endif
}
</script>
21 changes: 13 additions & 8 deletions resources/views/contents/category.blade.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
<?php /* @var $content \Gzero\Cms\ViewModels\ContentViewModel */ ?>
@extends('gzero-core::layouts.withRegions')
@section('bodyClass', $content->theme)
@section('bodyClass', $content->theme())

@section('title', $translation->seoTitle())
@section('seoDescription', $translation->seoDescription())
@section('metaData')
@if(isProviderLoaded('Gzero\Social\ServiceProvider') && function_exists('fbOgTags'))
{!! fbOgTags($content->url(), $content->translation) !!}
@endif
@stop

@section('title', $content->seoTitle())
@section('seoDescription', $content->seoDescription())
@section('head')
@parent
@include('gzero-cms::contents._canonical', ['paginator' => $children])
@include('gzero-cms::contents._alternateLinks', ['content' => $content])
@if(method_exists($content, 'stDataMarkup'))
{!! $content->stDataMarkup($language->code) !!}
@endif
@include('gzero-cms::contents._stDataMarkup', ['content' => $content])
@stop
@section('breadcrumbs')
{!! Breadcrumbs::render('category') !!}
@stop
@section('content')
@include('gzero-cms::contents._notPublishedContentMsg')
<h1 class="content-title">
{{ $translation->title }}
{{ $content->title() }}
</h1>
{!! $translation->body !!}
{!! $content->body() !!}
@if($children)
@foreach($children as $index => $child)
@include('gzero-cms::contents._article', ['child' => $child])
Expand Down
47 changes: 19 additions & 28 deletions resources/views/contents/content.blade.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?php /* @var $content \Gzero\Cms\ViewModels\ContentViewModel */ ?>
@extends('gzero-core::layouts.withRegions')
@section('bodyClass', $content->theme)
<?php $url = $content->routeUrl($language->code); ?>
@section('bodyClass', $content->theme())

@section('metaData')
@if(isProviderLoaded('Gzero\Social\ServiceProvider') && function_exists('fbOgTags'))
{!! fbOgTags($url, $translation) !!}
{!! fbOgTags($content->url(), $content->translation) !!}
@endif
@stop

@section('title', $translation->seoTitle())
@section('seoDescription', $translation->seoDescription())
@section('title', $content->seoTitle())
@section('seoDescription', $content->seoDescription())
@section('head')
@parent
@include('gzero-cms::contents._canonical')
@include('gzero-cms::contents._alternateLinks', ['content' => $content])
@if(method_exists($content, 'stDataMarkup'))
{!! $content->stDataMarkup($language->code) !!}
@endif
@include('gzero-cms::contents._stDataMarkup', ['content' => $content])
@stop

@section('breadcrumbs')
Expand All @@ -26,24 +24,24 @@
@section('content')
@include('gzero-cms::contents._notPublishedContentMsg')
<h1 class="content-title">
{{ $translation->title }}
{{ $content->title() }}
</h1>
<div class="row justify-content-md-between content-meta">
<div class="col-12 col-md-auto">
<p class="content-author text-muted">
<i>@lang('gzero-core::common.posted_by') {{ $content->authorName() }}</i>
<i>@lang('gzero-core::common.posted_on') {{ $content->publishDate() }}</i>
<i>@lang('gzero-core::common.posted_by') {{ $content->author()->displayName() }}</i>
<i>@lang('gzero-core::common.posted_on') {{ $content->publishedAt() }}</i>
</p>
</div>
@if(isProviderLoaded('Gzero\Social\ServiceProvider') && function_exists('shareButtons'))
<div class="col-12 col-md-auto">
<div class="social-buttons">
{!! shareButtons($url, $translation) !!}
{!! shareButtons($content->url(), $content->translation) !!}
</div>
</div>
@endif
</div>
@if($content->thumb)
@if($content->hasThumbnail())
<?php $thumbTranslation = $content->thumb->translation($language->code); ?>
<div class="row mb-2">
<div class="col">
Expand All @@ -55,18 +53,18 @@
</div>
</div>
@endif
@if(!empty($translation->teaser))
@if($content->hasTeaser())
<p class="lead">
{!! $translation->teaser !!}
{!! $content->teaser() !!}
</p>
@endif
{!! $translation->body !!}
@include('gzero-cms::contents._gallery', ['images' => $images, 'thumb' => $content->thumb])
@if(config('gzero-cms.disqus.enabled') && $content->is_comment_allowed)
{!! $content->body() !!}
{{--@include('gzero-cms::contents._gallery', ['images' => $images, 'thumb' => $content->thumb])--}}
@if(config('gzero-cms.disqus.enabled') && $content->isCommentAllowed())
<div class="row">
<div class="col">
<div class="text-center">
@include('gzero-cms::contents._disqus', ['contentId' => $content->id, 'url' => $url])
@include('gzero-cms::contents._disqus', ['contentId' => $content->id(), 'url' => $content->url()])
</div>
</div>
</div>
Expand All @@ -76,16 +74,9 @@
<div class="row mb-2">
<div class="col">
<div class="social-buttons">
{!! likeButtons($url, $translation) !!}
{!! likeButtons($content->url(), $content->translation) !!}
</div>
</div>
</div>
@endif
<div class="row justify-content-end mb-2">
<div class="col-auto">
<div class="text-muted">
@lang('gzero-core::common.rating') {!! $content->ratingStars() !!}
</div>
</div>
</div>
@stop
@stop
10 changes: 10 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ function ($router) {
$router->get('deleted-contents', 'DeletedContentController@index');
$router->delete('deleted-contents/{id}', 'DeletedContentController@destroy');
$router->post('deleted-contents/{id}/restore', 'DeletedContentController@restore');

$router->get('blocks', 'BlockController@index');
$router->post('blocks', 'BlockController@store');
$router->patch('blocks/{id}', 'BlockController@update');
$router->delete('blocks/{id}', 'BlockController@destroy');
$router->get('blocks/{id}', 'BlockController@show');

$router->get('blocks/{id}/translations', 'BlockTranslationController@index');
$router->post('blocks/{id}/translations', 'BlockTranslationController@store');
$router->delete('blocks/{id}/translations/{translationId}', 'BlockTranslationController@destroy');
}
);

Expand Down
3 changes: 1 addition & 2 deletions src/Gzero/Cms/Handlers/Block/Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public function handle(Block $block, Language $language)
return $html;
}
$html = view('gzero-cms::blocks.basic', [
'block' => $block,
'translation' => $block->getActiveTranslation($language->code),
'block' => $block
])->render();
$this->putInCache($block, $language, $html);
return $html;
Expand Down
Loading

0 comments on commit ed1cc73

Please sign in to comment.