diff --git a/app/Http/Controllers/BookController.php b/app/Http/Controllers/BookController.php index 41d8bed26..c17a082a5 100644 --- a/app/Http/Controllers/BookController.php +++ b/app/Http/Controllers/BookController.php @@ -107,13 +107,14 @@ class BookController extends Controller 'name' => 'required|string|max:255', 'description' => 'string|max:1000' ]); + $book->fill($request->all()); $slug = Str::slug($book->name); while($this->bookRepo->countBySlug($slug) > 0 && $book->slug != $slug) { $slug += '1'; } $book->slug = $slug; $book->save(); - return redirect('/books'); + return redirect($book->getUrl()); } /** diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index b22c73949..da56fb26b 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -85,7 +85,8 @@ class PageController extends Controller */ public function show($bookSlug, $pageSlug) { - $page = $this->pageRepo->getBySlug($pageSlug); + $book = $this->bookRepo->getBySlug($bookSlug); + $page = $this->pageRepo->getBySlug($pageSlug, $book->id); return view('pages/show', ['page' => $page]); } @@ -98,7 +99,8 @@ class PageController extends Controller */ public function edit($bookSlug, $pageSlug) { - $page = $this->pageRepo->getBySlug($pageSlug); + $book = $this->bookRepo->getBySlug($bookSlug); + $page = $this->pageRepo->getBySlug($pageSlug, $book->id); return view('pages/edit', ['page' => $page]); } @@ -112,8 +114,8 @@ class PageController extends Controller */ public function update(Request $request, $bookSlug, $pageSlug) { - $page = $this->pageRepo->getBySlug($pageSlug); $book = $this->bookRepo->getBySlug($bookSlug); + $page = $this->pageRepo->getBySlug($pageSlug, $book->id); $page->fill($request->all()); $slug = Str::slug($page->name); while($this->pageRepo->countBySlug($slug, $book->id) > 0 && $slug != $pageSlug) { diff --git a/app/Repos/PageRepo.php b/app/Repos/PageRepo.php index 209e2816b..62fbe9d8f 100644 --- a/app/Repos/PageRepo.php +++ b/app/Repos/PageRepo.php @@ -27,9 +27,9 @@ class PageRepo return $this->page->all(); } - public function getBySlug($slug) + public function getBySlug($slug, $bookId) { - return $this->page->where('slug', '=', $slug)->first(); + return $this->page->where('slug', '=', $slug)->where('book_id', '=', $bookId)->first(); } public function newFromInput($input) diff --git a/bower.json b/bower.json index c1831df7d..feed69959 100644 --- a/bower.json +++ b/bower.json @@ -15,6 +15,8 @@ ], "dependencies": { "dropzone": "~4.0.1", - "tinymce-dist": "~4.2.1" + "tinymce-dist": "~4.2.1", + "bootstrap": "~3.3.5", + "jquery-sortable": "~0.9.13" } } diff --git a/gulpfile.js b/gulpfile.js index 728827654..1da6e0497 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,4 +1,5 @@ var elixir = require('laravel-elixir'); +require('laravel-elixir-livereload'); /* |-------------------------------------------------------------------------- @@ -12,5 +13,5 @@ var elixir = require('laravel-elixir'); */ elixir(function(mix) { - mix.sass('styles.scss'); + mix.sass('styles.scss').livereload(); }); diff --git a/package.json b/package.json index b1b4a6e61..ecbb47b05 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "private": true, "devDependencies": { - "gulp": "^3.8.8" + "gulp": "^3.8.8", + "laravel-elixir-livereload": "0.0.3" }, "dependencies": { "laravel-elixir": "^2.0.0", diff --git a/resources/assets/sass/_buttons.scss b/resources/assets/sass/_buttons.scss index 4ef81ede9..b28f29ea6 100644 --- a/resources/assets/sass/_buttons.scss +++ b/resources/assets/sass/_buttons.scss @@ -32,7 +32,7 @@ $button-border-radius: 3px; @include generate-button-colors(#EEE, $primary); } -.button, button[type="button"], input[type="button"], input[type="submit"] { +.button, input[type="button"], input[type="submit"] { @extend .button-base; &.pos { @include generate-button-colors(#EEE, $positive); diff --git a/resources/assets/sass/_forms.scss b/resources/assets/sass/_forms.scss index ae8a900f8..37e03c3cf 100644 --- a/resources/assets/sass/_forms.scss +++ b/resources/assets/sass/_forms.scss @@ -45,3 +45,40 @@ input[type="text"], input[type="number"], input[type="email"], input[type="searc .form-group { margin-bottom: $-s; } + +.inline-input-style { + border: 2px dotted #BBB; + display: block; + width: 100%; + padding: $-xs $-s; +} + +.title-input label, .description-input label{ + margin-top: $-m; + color: #666; +} + +.title-input input[type="text"] { + @extend h1; + @extend .inline-input-style; + margin-top: 0; + color: #444; +} + +.title-input.page-title { + padding: $-s; +} +.title-input.page-title input[type="text"]{ + //border: 2px dotted #BBB; + margin-bottom: 0; +} +.edit-area { + padding: 0 $-s $-s $-s; +} + +.description-input textarea { + @extend .inline-input-style; + font-size: $fs-m; + color: #666; + width: 100%; +} \ No newline at end of file diff --git a/resources/assets/sass/_html.scss b/resources/assets/sass/_html.scss index 73de7ff97..3b019d583 100644 --- a/resources/assets/sass/_html.scss +++ b/resources/assets/sass/_html.scss @@ -2,7 +2,7 @@ box-sizing: border-box; } html { - background-color: #FFF; + background-color: #f8f8f8; } body { font-family: $text; diff --git a/resources/assets/sass/_text.scss b/resources/assets/sass/_text.scss index 4cd440a11..9e24d4cd5 100644 --- a/resources/assets/sass/_text.scss +++ b/resources/assets/sass/_text.scss @@ -1,6 +1,6 @@ /* -* Header Styles -*/ + * Header Styles + */ h1 { font-size: 3.625em; @@ -23,11 +23,12 @@ h3 { h4 { font-size: 1em; line-height: 1.375em; - margin-top: 1.375em; - margin-bottom: 1.375em; + margin-top: 0.78571429em; + margin-bottom: 0.43137255em; } h1, h2, h3, h4 { + font-weight: 500; .subheader { display: block; font-size: 0.5em; @@ -37,8 +38,8 @@ h1, h2, h3, h4 { } /* -* Link styling -*/ + * Link styling + */ a { color: $primary; cursor: pointer; @@ -48,11 +49,14 @@ a { text-decoration: underline; color: darken($primary, 20%); } + i { + padding-right: $-s; + } } /* -* Other HTML Text Elements -*/ + * Other HTML Text Elements + */ p, ul, ol, pre, table, blockquote { margin-top: 0.3em; margin-bottom: 1.375em; @@ -136,8 +140,8 @@ span.code { padding: 1px $-xs; } /* -* Text colors -*/ + * Text colors + */ p.pos, p .pos, span.pos, .text-pos { color: $positive; } @@ -159,8 +163,8 @@ p.secondary, p .secondary, span.secondary, .text-secondary { } /* -* Generic text styling classes -*/ + * Generic text styling classes + */ .underlined { text-decoration: underline; } @@ -176,3 +180,13 @@ p.secondary, p .secondary, span.secondary, .text-secondary { .text-right { text-align: right; } + +/** + * Grouping + */ +.header-group { + margin: $-m 0; + h1, h2, h3, h4, h5, h6 { + margin: 0; + } +} \ No newline at end of file diff --git a/resources/assets/sass/_tinymce.scss b/resources/assets/sass/_tinymce.scss new file mode 100644 index 000000000..7c1cf771d --- /dev/null +++ b/resources/assets/sass/_tinymce.scss @@ -0,0 +1,18 @@ + +//.mce-container { +// .mce-menubar, .mce-toolbar-grp { +// position: fixed; +// width: 100%; +// } +// .mce-container-body { +// position: relative; +// overflow: hidden; +// display: block; +// } +//} + +.mce-tinymce.mce-container.fullscreen { + position: fixed; + top: 0; + height: 100%; +} \ No newline at end of file diff --git a/resources/assets/sass/styles.scss b/resources/assets/sass/styles.scss index 9f4eda5a9..6df66b832 100644 --- a/resources/assets/sass/styles.scss +++ b/resources/assets/sass/styles.scss @@ -7,6 +7,20 @@ @import "blocks"; @import "buttons"; @import "forms"; +@import "tinymce"; + +header { + background-color: #f8f8f8; + position: fixed; + display: block; + width: 100%; + z-index: -1; + top: 0; +} + +body { + margin-top: 64px; +} header hr { margin-top: 0; @@ -27,6 +41,81 @@ header .menu { font-size: 1.4em; } +.affix { + position: fixed; +} + +.page-style { + background-color: #FFF; + padding: $-s $-xxl $-xxl $-xxl; + border-radius: 4px; + box-shadow: 0 0 9px 0 rgba(0, 0, 0, 0.15); + margin-bottom: $-xxl; + max-width: 100%; +} + +.page-style.editor { + padding: 0 !important; +} + +.page-content { + @extend .page-style; + min-height: 70vh; + &.right { + float: right; + } + &.left { + float: left; + } +} + +.page-list { + a { + display: block; + padding: $-s 0; + border-bottom: 2px dotted #CCC; + &:first-child { + border-top: 2px dotted #CCC; + } + } +} + +.page-menu { + opacity: 0.6; + transition: opacity ease-in-out 120ms; + &:hover { + opacity: 1; + } +} + +.page-nav-list { + $nav-indent: $-s; + li { + //border-left: 1px solid rgba(0, 0, 0, 0.1); + padding-left: $-xs; + } + .nav-H2 { + margin-left: $nav-indent; + font-size: 0.95em; + } + .nav-H3 { + margin-left: $nav-indent*2; + font-size: 0.90em + } + .nav-H4 { + margin-left: $nav-indent*3; + font-size: 0.85em + } + .nav-H5 { + margin-left: $nav-indent*4; + font-size: 0.80em + } + .nav-H6 { + margin-left: $nav-indent*5; + font-size: 0.75em + } +} + .overlay { background-color: rgba(0, 0, 0, 0.2); position: fixed; diff --git a/resources/views/base.blade.php b/resources/views/base.blade.php index ba386d6c3..a8e17ce7e 100644 --- a/resources/views/base.blade.php +++ b/resources/views/base.blade.php @@ -7,18 +7,28 @@ + + @yield('head')
-{{$book->description}}
+{{$book->description}}
- -{{$book->description}}
- + New Page -This book has no pages
- @endif +{{$book->description}}
+ +This book has no pages
+ @endif ++ +
+ + +