Skip to content

Instantly share code, notes, and snippets.

@Senither
Created April 9, 2018 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Senither/66dcec5213a49dcc52b8325e41efdb19 to your computer and use it in GitHub Desktop.
Save Senither/66dcec5213a49dcc52b8325e41efdb19 to your computer and use it in GitHub Desktop.
Edit page resource from Yggdrasil
@extends('layouts.yggdrasil')
@section('page-title', 'Edit Page: ' . $page->name)
@section('title', 'Edit page: ' . $page->name)
@section('breadcrumbs')
<li><a href="{{ route('admin.home') }}">Home</a></li>
<li><a href="{{ route('admin.pages.index') }}">Pages</a></li>
<li><a href="#">Display Pages</a></li>
<li class="active">{{ $page->name }}</li>
@endsection
@section('content')
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="panel panel-white">
<div class="panel-body">
@if($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('admin.pages.update', $page) }}" method="post" class="form-horizontal">
@csrf
<input type="hidden" name="_method" value="PATCH">
<input type="hidden" name="_id" value="{{ $page->id }}">
<div class="form-group">
<label for="input-default" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" value="{{ $page->name }}" placeholder="This is the name of the page">
</div>
</div>
<div class="form-group">
<label for="input-help-block" class="col-sm-2 control-label">Page Route</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="route" value="{{ $page->route }}" placeholder="This is the url people will need to go to, to view the page.">
<p class="help-block">This is the url people will need to go to, to view the page, leave it back to set the page as the home page.</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Template</label>
<div class="col-sm-10">
<select class="form-control m-b-sm" name="template_id">
@foreach(\App\Template::all() as $template)
<option value="{{ $template->id }}" {{ $template->id == $page->template_id ? ' selected' : null }}>{{ $template->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Page Type</label>
<div class="col-sm-10">
<select class="form-control m-b-sm" name="type_id">
<option disabled selected>-- Select a Page type --</option>
@foreach(\App\PageType::all() as $pageType)
<option value="{{ $pageType->id }}" {{ $pageType->id == $page->type_id ? ' selected' : null }}>{{ $pageType->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="input-default" class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="title" value="{{ $page->title }}" placeholder="This is the title of the page">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Content</label>
<div class="col-sm-10">
<textarea class="summernote" name="body">
{!! $page->body !!}
</textarea>
</div>
</div>
<a href="{{ route('admin.pages.index') }}" class="btn btn-lg btn-danger">Return to Page List</a>
<input type="submit" value="Save Page" class="btn btn-lg btn-success" style="float:right;">
<a href="{{ route('admin.pages.live-edit', $page) }}" class="btn btn-lg btn-primary" style="float:right; margin-right: 20px;">Live Edit</a>
</form>
</div>
</div>
</div>
</div>
@endsection
@section('styles')
<link href="{{ asset('plugins/summernote-master/summernote.css') }}" rel="stylesheet" type="text/css"/>
@endsection
@section('scripts')
<script src="{{ asset('plugins/summernote-master/summernote.min.js') }}"></script>
<script>
$(document).ready(function() {
$('.summernote').summernote({
height: 350
});
});
</script>
@endsection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment