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\View\View;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Exceptions\GeneralException;
class LicenseController extends Controller class LicenseController extends Controller
{ {
@ -51,8 +52,15 @@ class LicenseController extends Controller
$license = License::findOrFail($id); $license = License::findOrFail($id);
$input = $request->all(); $input = $request->all();
$license->update($input); if ($license->update($input)) {
session()->flash('flash_message', 'You have updated the license!'); // event(new PageUpdated($page));
return redirect()->route('settings.license'); 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 Illuminate\Http\RedirectResponse;
use App\Exceptions\GeneralException; use App\Exceptions\GeneralException;
use App\Events\Pages\PageUpdated; use App\Events\Pages\PageUpdated;
use Illuminate\Support\Facades\DB;
class PageController extends Controller class PageController extends Controller
{ {
@ -69,8 +70,12 @@ class PageController extends Controller
*/ */
public function edit(Page $page) public function edit(Page $page)
{ {
return view('settings.page.edit') $languages = DB::table('languages')
->withPage($page); ->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'])); // $this->pages->update($page, $request->except(['_method', '_token']));
$input = $request->except(['_method', '_token']); $input = $request->except(['_method', '_token']);
// Making extra fields // 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['status'] = isset($input['status']) ? 1 : 0;
$input['updated_by'] = \Auth::user()->id; $input['updated_by'] = \Auth::user()->id;

View File

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

View File

@ -2,14 +2,14 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\User;
use App\Models\ModelTrait; use App\Models\ModelTrait;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
class Page extends Model class Page extends Model
{ {
use ModelTrait; use ModelTrait;
/** /**
* The database table used by the model. * The database table used by the model.
* *
* @var string * @var string
@ -32,12 +32,14 @@ class Page extends Model
'created_by' => 1, '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']; protected $with = ['owner'];
public function __construct(array $attributes = []) public function __construct(array $attributes = [])
{ {
parent::__construct($attributes); parent::__construct($attributes);
$this->table = 'pages';//config('module.pages.table'); $this->table = 'pages'; //config('module.pages.table');
} }
public function owner() public function owner()
@ -45,41 +47,41 @@ class Page extends Model
return $this->belongsTo(User::class, 'created_by'); return $this->belongsTo(User::class, 'created_by');
} }
/** /**
* @return string * @return string
*/ */
public function getActionButtonsAttribute() public function getActionButtonsAttribute()
{ {
return '<div class="btn-group action-btn"> return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute('page', 'settings.page.edit').' ' . $this->getEditButtonAttribute('page', 'settings.page.edit') . '
'.$this->getViewButtonAttribute().' ' . $this->getViewButtonAttribute() . '
'.$this->getDeleteButtonAttribute('page', 'settings.page.destroy').'
</div>'; </div>';
// '.$this->getDeleteButtonAttribute('page', 'settings.page.destroy').'
} }
/** /**
* @return string * @return string
*/ */
public function getViewButtonAttribute() public function getViewButtonAttribute()
{ {
return '<a target="_blank" href=" return '<a target="_blank" href="
'. route('frontend.pages.show', $this->page_slug) .' " class="btn btn-flat btn-default"> ' . route('frontend.pages.show', $this->page_slug) . ' " class="btn btn-flat btn-default">
<i data-toggle="tooltip" data-placement="top" title="View Page" class="fa fa-eye"></i> <i data-toggle="tooltip" data-placement="top" title="View Page" class="fa fa-eye"></i>
</a>'; </a>';
} }
/** /**
* @return string * @return string
*/ */
public function getStatusLabelAttribute() public function getStatusLabelAttribute()
{ {
if ($this->isActive()) { if ($this->isActive()) {
return "<label class='label label-success'>".trans('labels.general.active').'</label>'; return "<label class='label label-success'>" . trans('labels.general.active') . '</label>';
} }
return "<label class='label label-danger'>".trans('labels.general.inactive').'</label>'; return "<label class='label label-danger'>" . trans('labels.general.inactive') . '</label>';
} }
/** /**
* @return bool * @return bool
*/ */

View File

@ -22,6 +22,13 @@ return [
'not_found' => 'That Page does not exist.', 'not_found' => 'That Page does not exist.',
'update_error' => 'There was a problem updating this Page. Please try again.', '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' => [], 'frontend' => [],
]; ];

View File

@ -1,46 +1,45 @@
<?php <?php
return [ return [
'msg' => 'Laravel Internationalization example.', 'msg' => 'Laravel Internationalization example.',
'home_index_label' => 'Home', 'home_index_label' => 'Home',
'home_index_pagetitle' => 'Home', 'home_index_pagetitle' => 'Home',
'home_index_title' => 'Publication Server of XYZ University', 'home_index_title' => 'Publication Server of XYZ University',
'home_index_welcome' => 'The library offers to publish electronically generated and 'home_index_welcome' => 'The library offers to publish electronically generated and
qualified documents on its online publication system. This service is qualified documents on its online publication system. This service is
for university members only and free of charge. After publication, the for university members only and free of charge. After publication, the
texts are available worldwide on the Internet and will be archived texts are available worldwide on the Internet and will be archived
permanently by the library. The documents are indexed and made permanently by the library. The documents are indexed and made
accessible in library catalogues and Web search engines.', accessible in library catalogues and Web search engines.',
'home_index_instructions' => 'If you want to search for documents of the university, please 'home_index_instructions' => 'If you want to search for documents of the university, please
choose the menu "Search" where you will find several search options. If choose the menu "Search" where you will find several search options. If
you want to publish a document, please select the menu "Publish"; here you want to publish a document, please select the menu "Publish"; here
you can submit your document to the publication server in just a few you can submit your document to the publication server in just a few
steps.', steps.',
'home_index_imprint_pagetitle' => 'Imprint', 'home_index_imprint_pagetitle' => 'Imprint',
'home_index_imprint_title' => 'Legal notice according to &#xA7; 5 E-Commerce-Gesetz (Austria)', 'home_index_imprint_title' => 'Legal notice according to &#xA7; 5 E-Commerce-Gesetz (Austria)',
'help_content_imprint' => Illuminate\Support\Facades\File::get(resource_path() . '/lang/en/imprint.en.txt'), 'help_content_imprint' => Illuminate\Support\Facades\File::get(resource_path() . '/lang/en/imprint.en.txt'),
'home_index_contact_pagetitle' => 'Contact', 'home_index_contact_pagetitle' => 'Contact',
'home_index_contact_title' => 'Contact us...', 'home_index_contact_title' => 'Contact us...',
'home_about_pagetitle' => 'About Us', 'home_about_pagetitle' => 'About Us',
'home_about_title' => 'About us...', 'home_about_title' => 'About us...',
'home_about_content' => 'RDR (Research Data Repository) is an interdisciplinary digital data repository for the archival and publication of research data resulting from completed scientific studies and projects. RDR focuses on disciplines who do not have a tradition of data sharing thus ensuring better availability, sustainable preservation and (independent) publication capacity of their research data.', 'home_about_content' => 'RDR (Research Data Repository) is an interdisciplinary digital data repository for the archival and publication of research data resulting from completed scientific studies and projects. RDR focuses on disciplines who do not have a tradition of data sharing thus ensuring better availability, sustainable preservation and (independent) publication capacity of their research data.',
'home_news_pagetitle' => 'News', 'home_news_pagetitle' => 'News',
'solrsearch_title_simple' => 'Search',
'solrsearch_title_advanced' => 'Advanced Search',
'solrsearch_title_alldocs' => 'All datasets',
'solrsearch_searchaction' => 'Search',
'solrsearch_title_latest' => 'Latest Documents',
'solrsearch_title_simple' => 'Search', 'rss_icon' => 'subscribe to RSS feed',
'solrsearch_title_advanced' => 'Advanced Search', 'rss_title' => 'subscribe to RSS feed',
'solrsearch_title_alldocs' => 'All datasets',
'solrsearch_searchaction' => 'Search',
'solrsearch_title_latest' => 'Latest Documents',
'rss_icon' =>'subscribe to RSS feed', 'default_auth_index' => 'Login',
'rss_title' => 'subscribe to RSS feed', 'auth_pagetitle' => 'User Login',
'default_auth_index' => 'Login',
'auth_pagetitle' => 'User Login',
]; ];

View File

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

View File

@ -56,7 +56,8 @@
<div class="block"> <div class="block">
<h3 class="block-title">About RDR</h3> <h3 class="block-title">About RDR</h3>
<ul> <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> <li><a href="{{ URL::route('frontend.home.news') }}">News</a></li>
</ul> </ul>
</div> </div>
@ -66,10 +67,10 @@
<div class="pure-u-1 pure-u-md-1-4 footer-links"> <div class="pure-u-1 pure-u-md-1-4 footer-links">
<div class="block"> <div class="block">
<h3 class="block-title">TOOLS &amp; SUPPORT</h3> <h3 class="block-title">TOOLS &amp; SUPPORT</h3>
<ul id="secondary-nav" class="nav"> <ul id="secondary-nav" class="nav">
{{-- <li>{{ Request::ip() }}</li> --}}
<li class="first"><a href="{{ URL::route('frontend.home.contact') }}">Contact</a></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.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> <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"> <script type="text/javascript">
// Backend.Pages.init(); // Backend.Pages.init();
</script> </script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.css" rel="stylesheet"> <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.9/summernote-lite.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#desc_markup').summernote(); $('#desc_markup').summernote();

View File

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