Skip to content

Commit 1675980

Browse files
committed
Merge pull request #1 from TypiCMS/2.1
2.1
2 parents ca77988 + 863197f commit 1675980

File tree

6 files changed

+18
-28
lines changed

6 files changed

+18
-28
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
],
1010
"require": {
11-
"typicms/core": "~2.0.0"
11+
"typicms/core": "~2.1.0"
1212
},
1313
"autoload": {
1414
"psr-4": {

src/Http/Controllers/PublicController.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ public function __construct(PlaceInterface $place)
2424
*/
2525
public function index()
2626
{
27-
TypiCMS::setModel($this->repository->getModel());
28-
2927
$models = $this->repository->all();
30-
3128
return view('places::public.index')
3229
->with(compact('models'));
3330
}
@@ -39,9 +36,7 @@ public function index()
3936
*/
4037
public function search()
4138
{
42-
4339
$models = $this->repository->all();
44-
4540
return view('places::public.results')
4641
->with(compact('models'));
4742
}
@@ -54,9 +49,6 @@ public function search()
5449
public function show($slug)
5550
{
5651
$model = $this->repository->bySlug($slug);
57-
58-
TypiCMS::setModel($model);
59-
6052
return view('places::public.show')
6153
->with(compact('model'));
6254
}

src/Providers/RouteServiceProvider.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
namespace TypiCMS\Modules\Places\Providers;
33

4-
use Config;
5-
use Illuminate\Routing\Router;
64
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
5+
use Illuminate\Routing\Router;
6+
use TypiCMS\Facades\TypiCMS;
77

88
class RouteServiceProvider extends ServiceProvider {
99

@@ -42,12 +42,13 @@ public function map(Router $router)
4242
/**
4343
* Front office routes
4444
*/
45-
$routes = $this->app->make('TypiCMS.routes');
46-
foreach (Config::get('translatable.locales') as $lang) {
47-
if (isset($routes['places'][$lang])) {
48-
$uri = $routes['places'][$lang];
49-
$router->get($uri, array('as' => $lang.'.places', 'uses' => 'PublicController@index'));
50-
$router->get($uri.'/{slug}', array('as' => $lang.'.places.slug', 'uses' => 'PublicController@show'));
45+
if ($page = TypiCMS::getPageLinkedToModule('places')) {
46+
foreach (config('translatable.locales') as $lang) {
47+
$options = $page->private ? ['middleware' => 'auth'] : [] ;
48+
if ($uri = $page->uri($lang)) {
49+
$router->get($uri, $options + ['as' => $lang.'.places', 'uses' => 'PublicController@index']);
50+
$router->get($uri.'/{slug}', $options + ['as' => $lang.'.places.slug', 'uses' => 'PublicController@show']);
51+
}
5152
}
5253
}
5354

src/resources/views/admin/_form.blade.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<script src="{{ asset('js/admin/gmaps.js') }}"></script>
66
@stop
77

8-
@section('otherSideLink')
9-
@include('core::admin._navbar-public-link')
10-
@stop
11-
12-
138
@include('core::admin._buttons-form')
149

1510
{!! BootForm::hidden('id') !!}

src/resources/views/public/index.blade.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
@extends('core::public.master')
1+
@extends('pages::public.master')
2+
<?php $page = TypiCMS::getPageLinkedToModule('places') ?>
23

3-
@section('title', trans('places::global.name') . '' . $websiteTitle)
4-
@section('ogTitle', trans('places::global.name'))
5-
@section('bodyClass', 'body-places')
4+
@section('bodyClass', 'body-places body-places-index body-page body-page-' . $page->id)
65

76
@section('js')
87
<script src="{{ asset('//maps.googleapis.com/maps/api/js?sensor=false&amp;language='.config('app.locale')) }}"></script>
@@ -11,7 +10,9 @@
1110

1211
@section('main')
1312

14-
<h1>@lang('places::global.name')</h1>
13+
{!! $page->body !!}
14+
15+
@include('galleries::public._galleries', ['model' => $page])
1516

1617
<div class="row">
1718

src/resources/views/public/show.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
@extends('core::public.master')
2+
<?php $page = TypiCMS::getPageLinkedToModule('places') ?>
23

34
@section('title', $model->title . '' . trans('news::global.name') . '' . $websiteTitle)
45
@section('ogTitle', $model->title)
56
@section('description', $model->summary)
67
@section('image', $model->present()->thumbAbsoluteSrc())
7-
@section('bodyClass', 'body-place body-place-' . $model->id)
8+
@section('bodyClass', 'body-places body-place-' . $model->id . ' body-page body-page-' . $page->id)
89

910
@section('js')
1011
<script src="{{ asset('//maps.googleapis.com/maps/api/js?sensor=false&amp;language='.config('app.locale')) }}"></script>

0 commit comments

Comments
 (0)