Added page editing

This commit is contained in:
Dan Brown
2015-07-12 21:31:15 +01:00
parent eaa1765c7a
commit 3c7bd297ea
19 changed files with 252 additions and 23 deletions

View File

@ -19,4 +19,10 @@ header .menu {
display: inline-block;
margin-left: $-m;
}
}
.page-title input {
display: block;
width: 100%;
font-size: 1.4em;
}

View File

@ -5,7 +5,9 @@
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/css/app.css">
<link href='http://fonts.googleapis.com/css?family=Roboto:400,400italic,500,500italic,700,700italic,300italic,100,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
@yield('head')
</head>
<body>

View File

@ -4,4 +4,14 @@
<h2>{{$book->name}}</h2>
<p class="text-muted">{{$book->description}}</p>
<a href="{{$book->getUrl() . '/page/create'}}">+ New Page</a>
<h4>Pages:</h4>
@if(count($book->pages) > 0)
@foreach($book->pages as $page)
<a href="{{$page->getUrl()}}">{{$page->name}}</a><br>
@endforeach
@else
<p class="text-muted">This book has no pages</p>
@endif
@stop

View File

@ -1,5 +1,6 @@
<input type="text" id="{{ $name }}" name="{{ $name }}"
@if($errors->has($name)) class="neg" @endif
@if(isset($placeholder)) placeholder="{{$placeholder}}" @endif
@if(isset($model) || old($name)) value="{{ old($name) ? old($name) : $model->$name}}" @endif>
@if($errors->has($name))
<div class="text-neg text-small">{{ $errors->first($name) }}</div>

View File

@ -0,0 +1,19 @@
@extends('base')
@section('head')
<link rel="stylesheet" href="/plugins/css/froala_editor.min.css">
<link rel="stylesheet" href="/plugins/css/froala_style.min.css">
<script src="/plugins/js/froala_editor.min.js"></script>
@stop
@section('content')
<form action="{{$book->getUrl() . '/page'}}" method="POST">
@include('pages/form')
</form>
<script>
$(function() {
$('#html').editable({inlineMode: false});
});
</script>
@stop

View File

@ -0,0 +1,20 @@
@extends('base')
@section('head')
<link rel="stylesheet" href="/plugins/css/froala_editor.min.css">
<link rel="stylesheet" href="/plugins/css/froala_style.min.css">
<script src="/plugins/js/froala_editor.min.js"></script>
@stop
@section('content')
<form action="{{$page->getUrl()}}" method="POST">
<input type="hidden" name="_method" value="PUT">
@include('pages/form', ['model' => $page])
</form>
<script>
$(function() {
$('#html').editable({inlineMode: false});
});
</script>
@stop

View File

@ -0,0 +1,13 @@
{{ csrf_field() }}
<div class="page-title row">
<div class="col-md-10">
@include('form/text', ['name' => 'name', 'placeholder' => 'Enter Page Title'])
</div>
<div class="col-md-2">
<button type="submit" class="button pos">Save</button>
</div>
</div>
<div class="edit-area">
@include('form/textarea', ['name' => 'html'])
</div>

View File

@ -0,0 +1,12 @@
@extends('base')
@section('content')
<a href="{{$page->getUrl() . '/edit'}}" class="button primary float right">Edit Page</a>
<h1>{{$page->name}}</h1>
<div class="page-content">
{!! $page->html !!}
</div>
@stop