Skip to content

Commit

Permalink
Merge pull request #1 from TypiCMS/2.1
Browse files Browse the repository at this point in the history
2.1
  • Loading branch information
sdebacker committed Apr 28, 2015
2 parents 085f0fc + 6099024 commit a2afa7d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
],
"require": {
"typicms/core": "~2.0.0"
"typicms/core": "~2.1.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 0 additions & 6 deletions src/Http/Controllers/PublicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ public function __construct(PartnerInterface $partner)
*/
public function index()
{
TypiCMS::setModel($this->repository->getModel());

$models = $this->repository->all();

return view('partners::public.index')
->with(compact('models'));
}
Expand All @@ -38,9 +35,6 @@ public function index()
public function show($slug)
{
$model = $this->repository->bySlug($slug);

TypiCMS::setModel($model);

return view('partners::public.show')
->with(compact('model'));
}
Expand Down
17 changes: 9 additions & 8 deletions src/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace TypiCMS\Modules\Partners\Providers;

use Config;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
use TypiCMS\Facades\TypiCMS;

class RouteServiceProvider extends ServiceProvider {

Expand Down Expand Up @@ -42,12 +42,13 @@ public function map(Router $router)
/**
* Front office routes
*/
$routes = $this->app->make('TypiCMS.routes');
foreach (Config::get('translatable.locales') as $lang) {
if (isset($routes['partners'][$lang])) {
$uri = $routes['partners'][$lang];
$router->get($uri, array('as' => $lang.'.partners', 'uses' => 'PublicController@index'));
$router->get($uri.'/{slug}', array('as' => $lang.'.partners.slug', 'uses' => 'PublicController@show'));
if ($page = TypiCMS::getPageLinkedToModule('partners')) {
foreach (config('translatable.locales') as $lang) {
$options = $page->private ? ['middleware' => 'auth'] : [] ;
if ($uri = $page->uri($lang)) {
$router->get($uri, $options + ['as' => $lang.'.partners', 'uses' => 'PublicController@index']);
$router->get($uri.'/{slug}', $options + ['as' => $lang.'.partners.slug', 'uses' => 'PublicController@show']);
}
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/resources/views/admin/_form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
<script src="{{ asset('js/admin/form.js') }}"></script>
@stop

@section('otherSideLink')
@include('core::admin._navbar-public-link')
@stop


@include('core::admin._buttons-form')

{!! BootForm::hidden('id') !!}
Expand Down
11 changes: 6 additions & 5 deletions src/resources/views/public/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
@extends('core::public.master')
@extends('pages::public.master')
<?php $page = TypiCMS::getPageLinkedToModule('partners') ?>

@section('title', trans('partners::global.name') . '' . $websiteTitle)
@section('ogTitle', trans('partners::global.name'))
@section('bodyClass', 'body-partners')
@section('bodyClass', 'body-partners body-partners-index body-page body-page-' . $page->id)

@section('main')

<h1>@lang('partners::global.name')</h1>
{!! $page->body !!}

@include('galleries::public._galleries', ['model' => $page])

@if ($models->count())
@include('partners::public._list', ['items' => $models])
Expand Down
3 changes: 2 additions & 1 deletion src/resources/views/public/show.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@extends('core::public.master')
<?php $page = TypiCMS::getPageLinkedToModule('partners') ?>

@section('title', $model->title . '' . trans('news::global.name') . '' . $websiteTitle)
@section('ogTitle', $model->title)
@section('description', $model->summary)
@section('image', $model->present()->thumbAbsoluteSrc())
@section('bodyClass', 'body-partner body-partner-' . $model->id)
@section('bodyClass', 'body-partners body-partner-' . $model->id . ' body-page body-page-' . $page->id)

@section('main')

Expand Down

0 comments on commit a2afa7d

Please sign in to comment.