new static page links

This commit is contained in:
Arno Kaimbacher 2018-09-12 17:30:42 +02:00
parent d777eeeea1
commit ee8584a2d5
10 changed files with 110 additions and 62 deletions

View File

@ -9,6 +9,7 @@ use Illuminate\Http\Request;
use Illuminate\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\DB;
use App\Exceptions\GeneralException;
class LicenseController extends Controller
{
@ -51,8 +52,15 @@ class LicenseController extends Controller
$license = License::findOrFail($id);
$input = $request->all();
$license->update($input);
session()->flash('flash_message', 'You have updated the license!');
return redirect()->route('settings.license');
if ($license->update($input)) {
// event(new PageUpdated($page));
return redirect()
->route('settings.license')
->with('flash_message', 'You have updated the license!');
}
throw new GeneralException(trans('exceptions.backend.licenses.update_error'));
// $license->update($input);
// session()->flash('flash_message', 'You have updated the license!');
// return redirect()->route('settings.license');
}
}

View File

@ -11,6 +11,7 @@ use Illuminate\View\View;
use Illuminate\Http\RedirectResponse;
use App\Exceptions\GeneralException;
use App\Events\Pages\PageUpdated;
use Illuminate\Support\Facades\DB;
class PageController extends Controller
{
@ -69,8 +70,12 @@ class PageController extends Controller
*/
public function edit(Page $page)
{
return view('settings.page.edit')
->withPage($page);
$languages = DB::table('languages')
->where('active', true)
->pluck('part2_t', 'part2_t');
return view('settings.page.edit', compact('page', 'languages'));
// ->withPage($page);
}
/**
@ -85,7 +90,7 @@ class PageController extends Controller
// $this->pages->update($page, $request->except(['_method', '_token']));
$input = $request->except(['_method', '_token']);
// Making extra fields
$input['page_slug'] = str_slug($input['title']);
//$input['page_slug'] = str_slug($input['title']);
$input['status'] = isset($input['status']) ? 1 : 0;
$input['updated_by'] = \Auth::user()->id;

View File

@ -10,17 +10,17 @@ class License extends Model
public $timestamps = false;
protected $fillable = [
'active',
'desc_text',
'desc_text',
'desc_text',
'name_long',
'language',
'link_licence',
'link_logo',
'desc_text',
'desc_markup',
'comment_internal',
'mime_type',
'name_long',
'pod_allowed',
'sort_order',
'active',
'pod_allowed'
];
public function datasets()

View File

@ -2,9 +2,9 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\User;
use App\Models\ModelTrait;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
class Page extends Model
{
@ -32,6 +32,8 @@ class Page extends Model
'created_by' => 1,
];
//You can specify default eager loaded relationships using the $with property on the model.
//https://stackoverflow.com/questions/25674143/laravel-whenever-i-return-a-model-always-return-a-relationship-with-it
protected $with = ['owner'];
public function __construct(array $attributes = [])
@ -53,8 +55,8 @@ class Page extends Model
return '<div class="btn-group action-btn">
' . $this->getEditButtonAttribute('page', 'settings.page.edit') . '
' . $this->getViewButtonAttribute() . '
'.$this->getDeleteButtonAttribute('page', 'settings.page.destroy').'
</div>';
// '.$this->getDeleteButtonAttribute('page', 'settings.page.destroy').'
}
/**

View File

@ -22,6 +22,13 @@ return [
'not_found' => 'That Page does not exist.',
'update_error' => 'There was a problem updating this Page. Please try again.',
],
'licenses' => [
'already_exists' => 'That License already exists. Please choose a different name.',
'create_error' => 'There was a problem creating this License. Please try again.',
'delete_error' => 'There was a problem deleting this License. Please try again.',
'not_found' => 'That License does not exist.',
'update_error' => 'There was a problem updating this License. Please try again.',
],
],
'frontend' => [],
];

View File

@ -31,7 +31,6 @@ return [
'home_news_pagetitle' => 'News',
'solrsearch_title_simple' => 'Search',
'solrsearch_title_advanced' => 'Advanced Search',
'solrsearch_title_alldocs' => 'All datasets',

View File

@ -1,5 +1,16 @@
@extends('layouts.app')
@section('content')
<div class="content">
<h1>
{!! $page->title !!}
</h1>
<div>
<p>
{!! $page->description !!}
</p>
</div>
</div>
@endsection

View File

@ -56,7 +56,8 @@
<div class="block">
<h3 class="block-title">About RDR</h3>
<ul>
<li><a href="{{ URL::route('frontend.home.about') }}">About Us</a></li>
{{-- <li><a href="{{ URL::route('frontend.home.about') }}">About Us</a></li> --}}
<li class="last"><a href="{!! URL::route('frontend.pages.show', ['page_slug'=>'about']) !!}">About Us</a></li>
<li><a href="{{ URL::route('frontend.home.news') }}">News</a></li>
</ul>
</div>
@ -67,9 +68,9 @@
<div class="block">
<h3 class="block-title">TOOLS &amp; SUPPORT</h3>
<ul id="secondary-nav" class="nav">
{{-- <li>{{ Request::ip() }}</li> --}}
<li class="first"><a href="{{ URL::route('frontend.home.contact') }}">Contact</a></li>
<li><a href="{{ URL::route('frontend.home.imprint') }}">Impressum</a></li>
{{-- <li><a href="{{ URL::route('frontend.home.imprint') }}">Impressum</a></li> --}}
<li class="last"><a href="{!! URL::route('frontend.pages.show', ['page_slug'=>'imprint']) !!}">Impressum</a></li>
<li class="last"><a href="{{ URL::route('frontend.sitelinks.index') }}">Sitelinks</a></li>
<li class="last"><a href="{!! URL::route('frontend.pages.show', ['page_slug'=>'terms-and-conditions']) !!}">Terms and Conditions</a></li>

View File

@ -30,8 +30,8 @@
<script type="text/javascript">
// Backend.Pages.init();
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.js"></script>
<script>
$(document).ready(function() {
$('#desc_markup').summernote();

View File

@ -28,7 +28,7 @@
<div class="pure-control-group">
{{ Form::label('title', trans('validation.attributes.backend.pages.title'), ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10">
{{ Form::text('title', null, ['class' => 'form-control box-size', 'placeholder' => trans('validation.attributes.backend.pages.title'), 'required' => 'required']) }}
{{ Form::text('title', null, ['class' => 'form-control box-size', 'placeholder' => trans('validation.attributes.backend.pages.title'), 'required' => 'required', 'readonly' => 'true']) }}
</div><!--col-lg-10-->
</div><!--form control-->
@ -39,6 +39,13 @@
</div><!--col-lg-3-->
</div><!--form control-->
<div class="pure-control-group">
{{ Form::label('language', 'Language..', ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10">
{{ Form::select('language', $languages, $page->language, ['placeholder' => '--no language--']) }}
</div>
</div>
<div class="pure-control-group">
{{ Form::label('cannonical_link', trans('validation.attributes.backend.pages.cannonical_link'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
@ -95,11 +102,19 @@
<script type="text/javascript">
// Backend.Pages.init();
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.js"></script>
<script>
$(document).ready(function() {
$('#description').summernote();
// $('#description').summernote();
$('#description').summernote({
height: "300px",
callbacks: {
// onImageUpload: function(files, editor, welEditable) {
// app.sendFile(files[0], editor, welEditable);
// }
}
});
});
</script>
@endsection