]>
BookStack Code Mirror - bookstack/commitdiff
projects
/
bookstack
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
78564ec
)
Added tags to page display and simplified editing flow
author
Dan Brown
<redacted>
Sun, 15 May 2016 09:39:17 +0000
(10:39 +0100)
committer
Dan Brown
<redacted>
Sun, 15 May 2016 09:39:17 +0000
(10:39 +0100)
Tags now save with the page content data
app/Repos/PageRepo.php
patch
|
blob
|
history
resources/assets/sass/_pages.scss
patch
|
blob
|
history
resources/assets/sass/styles.scss
patch
|
blob
|
history
resources/views/pages/edit.blade.php
patch
|
blob
|
history
resources/views/pages/form-toolbox.blade.php
patch
|
blob
|
history
resources/views/pages/page-display.blade.php
patch
|
blob
|
history
diff --git
a/app/Repos/PageRepo.php
b/app/Repos/PageRepo.php
index 938c0f5ae756aa8ea9a84eef9070cf29b6ff9f8f..a28717b76ace3418468b60dcea25425cbb81467f 100644
(file)
--- a/
app/Repos/PageRepo.php
+++ b/
app/Repos/PageRepo.php
@@
-14,14
+14,17
@@
class PageRepo extends EntityRepo
{
protected $pageRevision;
+ protected $tagRepo;
/**
* PageRepo constructor.
* @param PageRevision $pageRevision
+ * @param TagRepo $tagRepo
*/
- public function __construct(PageRevision $pageRevision)
+ public function __construct(PageRevision $pageRevision
, TagRepo $tagRepo
)
{
$this->pageRevision = $pageRevision;
+ $this->tagRepo = $tagRepo;
parent::__construct();
}
@@
-308,6
+311,11
@@
class PageRepo extends EntityRepo
$page->slug = $this->findSuitableSlug($input['name'], $book_id, $page->id);
}
+ // Save page tags if present
+ if(isset($input['tags'])) {
+ $this->tagRepo->saveTagsToEntity($page, $input['tags']);
+ }
+
// Update with new details
$userId = auth()->user()->id;
$page->fill($input);
diff --git
a/resources/assets/sass/_pages.scss
b/resources/assets/sass/_pages.scss
index e1feccb64d038849f76a5993b8dc1b6c40a52c6a..a1297649b3895cc5686263d8c6a4356dfb67ce56 100644
(file)
--- a/
resources/assets/sass/_pages.scss
+++ b/
resources/assets/sass/_pages.scss
@@
-122,9
+122,153
@@
}
}
-h1, h2, h3, h4, h5, h6 {
- &:hover a.link-hook {
- opacity: 1;
- transform: translate3d(0, 0, 0);
+// Attribute form
+.floating-toolbox {
+ background-color: #FFF;
+ border: 1px solid #DDD;
+ right: $-xl*2;
+ z-index: 99;
+ width: 48px;
+ overflow: hidden;
+ align-items: stretch;
+ flex-direction: row;
+ display: flex;
+ transition: width ease-in-out 180ms;
+ margin-top: -1px;
+ &.open {
+ width: 480px;
+ }
+ [toolbox-toggle] i {
+ transition: transform ease-in-out 180ms;
+ }
+ [toolbox-toggle] {
+ transition: background-color ease-in-out 180ms;
+ }
+ &.open [toolbox-toggle] {
+ background-color: rgba(255, 0, 0, 0.29);
+ }
+ &.open [toolbox-toggle] i {
+ transform: rotate(180deg);
+ }
+ > div {
+ flex: 1;
+ position: relative;
+ }
+ .tabs {
+ display: block;
+ border-right: 1px solid #DDD;
+ width: 54px;
+ flex: 0;
+ }
+ .tabs i {
+ color: rgba(0, 0, 0, 0.5);
+ padding: 0;
+ margin: 0;
+ }
+ .tabs > span {
+ display: block;
+ cursor: pointer;
+ padding: $-s $-m;
+ font-size: 13.5px;
+ line-height: 1.6;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.3);
+ }
+ &.open .tabs > span.active {
+ color: #444;
+ background-color: rgba(0, 0, 0, 0.1);
+ }
+ div[tab-content] {
+ padding-bottom: 45px;
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ }
+ div[tab-content] .padded {
+ flex: 1;
+ padding-top: 0;
+ }
+ h4 {
+ font-size: 24px;
+ margin: $-m 0 0 0;
+ padding: 0 $-l $-s $-l;
+ }
+ .tags input {
+ max-width: 100%;
+ width: 100%;
+ min-width: 50px;
+ }
+ .tags td {
+ padding-right: $-s;
+ padding-top: $-s;
+ }
+ button.pos {
+ position: absolute;
+ bottom: 0;
+ display: block;
+ width: 100%;
+ padding: $-s;
+ height: 45px;
+ border: 0;
+ margin: 0;
+ box-shadow: none;
+ border-radius: 0;
+ &:hover{
+ box-shadow: none;
+ }
}
+ .handle {
+ user-select: none;
+ cursor: move;
+ color: #999;
+ }
+ form {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ overflow-y: scroll;
+ }
+}
+
+[tab-content] {
+ display: none;
}
+
+.tag-display {
+ margin: $-xl $-xs;
+ border: 1px solid #DDD;
+ min-width: 180px;
+ max-width: 320px;
+ opacity: 0.7;
+ table {
+ width: 100%;
+ margin: 0;
+ padding: 0;
+ }
+ span {
+ color: #666;
+ margin-left: $-s;
+ }
+ .heading {
+ padding: $-xs $-s;
+ color: #444;
+ }
+ td {
+ border: 0;
+ border-bottom: 1px solid #DDD;
+ padding: $-xs $-s;
+ color: #444;
+ }
+ .tag-value {
+ color: #888;
+ }
+ td i {
+ color: #888;
+ }
+ tr:last-child td {
+ border-bottom: none;
+ }
+ .tag {
+ padding: $-s;
+
+ }
+}
\ No newline at end of file
diff --git
a/resources/assets/sass/styles.scss
b/resources/assets/sass/styles.scss
index 774088fa83c0a7beefb3bb86ec89c9a867c5f300..0a7da179b09c58d3ec01ca65db36050949a9bca4 100644
(file)
--- a/
resources/assets/sass/styles.scss
+++ b/
resources/assets/sass/styles.scss
@@
-207,113
+207,3
@@
$btt-size: 40px;
color: #EEE;
}
}
-
-// Attribute form
-.floating-toolbox {
- background-color: #FFF;
- border: 1px solid #DDD;
- right: $-xl*2;
- z-index: 99;
- width: 48px;
- overflow: hidden;
- align-items: stretch;
- flex-direction: row;
- display: flex;
- transition: width ease-in-out 180ms;
- margin-top: -1px;
- &.open {
- width: 480px;
- }
- [toolbox-toggle] i {
- transition: transform ease-in-out 180ms;
- }
- [toolbox-toggle] {
- transition: background-color ease-in-out 180ms;
- }
- &.open [toolbox-toggle] {
- background-color: rgba(255, 0, 0, 0.29);
- }
- &.open [toolbox-toggle] i {
- transform: rotate(180deg);
- }
- > div {
- flex: 1;
- position: relative;
- }
- .tabs {
- display: block;
- border-right: 1px solid #DDD;
- width: 54px;
- flex: 0;
- }
- .tabs i {
- color: rgba(0, 0, 0, 0.5);
- padding: 0;
- margin: 0;
- }
- .tabs > span {
- display: block;
- cursor: pointer;
- padding: $-s $-m;
- font-size: 13.5px;
- line-height: 1.6;
- border-bottom: 1px solid rgba(255, 255, 255, 0.3);
- }
- &.open .tabs > span.active {
- color: #444;
- background-color: rgba(0, 0, 0, 0.1);
- }
- div[tab-content] {
- padding-bottom: 45px;
- display: flex;
- flex: 1;
- }
- div[tab-content] .padded {
- flex: 1;
- padding-top: 0;
- }
- h4 {
- font-size: 24px;
- margin: $-m 0 0 0;
- padding: 0 $-l $-s $-l;
- }
- .tags input {
- max-width: 100%;
- width: 100%;
- min-width: 50px;
- }
- .tags td {
- padding-right: $-s;
- padding-top: $-s;
- }
- button.pos {
- position: absolute;
- bottom: 0;
- display: block;
- width: 100%;
- padding: $-s;
- height: 45px;
- border: 0;
- margin: 0;
- box-shadow: none;
- border-radius: 0;
- &:hover{
- box-shadow: none;
- }
- }
- .handle {
- user-select: none;
- cursor: move;
- color: #999;
- }
- form {
- display: flex;
- flex: 1;
- flex-direction: column;
- overflow-y: scroll;
- }
-}
-
-[tab-content] {
- display: none;
-}
\ No newline at end of file
diff --git
a/resources/views/pages/edit.blade.php
b/resources/views/pages/edit.blade.php
index d5cb1d3e3dd1b027da7c4f42c3d63d1e222045d8..c58c8edfb148e245c61adb4c95c35e86e0bc7b33 100644
(file)
--- a/
resources/views/pages/edit.blade.php
+++ b/
resources/views/pages/edit.blade.php
@@
-14,9
+14,9
@@
<input type="hidden" name="_method" value="PUT">
@endif
@include('pages/form', ['model' => $page])
+ @include('pages/form-toolbox')
</form>
- @include('pages/form-toolbox')
</div>
@include('partials/image-manager', ['imageType' => 'gallery', 'uploaded_to' => $page->id])
diff --git
a/resources/views/pages/form-toolbox.blade.php
b/resources/views/pages/form-toolbox.blade.php
index 011094b9cb12ae96dc199d796c8e7ed10ef34b24..36044b789c0e7830f462b6332404fa7ff2e83c98 100644
(file)
--- a/
resources/views/pages/form-toolbox.blade.php
+++ b/
resources/views/pages/form-toolbox.blade.php
@@
-5,33
+5,30
@@
<span tab-button="tags" title="Page Tags" class="active"><i class="zmdi zmdi-tag"></i></span>
</div>
<div tab-content="tags" ng-controller="PageTagController" page-id="{{ $page->id or 0 }}">
- <form ng-submit="saveTags()" >
- <h4>Page Tags</h4>
- <div class="padded tags">
- <p class="muted small">Add some tags to better categorise your content. <br> You can assign a value to a tag for more in-depth organisation.</p>
- <table class="no-style" style="width: 100%;">
- <tbody ui-sortable="sortOptions" ng-model="tags" >
- <tr ng-repeat="tag in tags">
- <td width="20" ><i class="handle zmdi zmdi-menu"></i></td>
- <td><input class="outline" type="text" ng-model="tag.name" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag"></td>
- <td><input class="outline" type="text" ng-model="tag.value" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag Value (Optional)"></td>
- <td width="10" class="text-center text-neg" style="padding: 0;" ng-click="removeTag(tag)"><i class="zmdi zmdi-close"></i></td>
- </tr>
- </tbody>
- </table>
- <table class="no-style" style="width: 100%;">
- <tbody>
- <tr class="unsortable">
- <td width="34"></td>
- <td ng-click="addEmptyTag()">
- <button type="button" class="text-button">Add another tag</button>
- </td>
- <td></td>
+ <h4>Page Tags</h4>
+ <div class="padded tags">
+ <p class="muted small">Add some tags to better categorise your content. <br> You can assign a value to a tag for more in-depth organisation.</p>
+ <table class="no-style" style="width: 100%;">
+ <tbody ui-sortable="sortOptions" ng-model="tags" >
+ <tr ng-repeat="tag in tags track by $index">
+ <td width="20" ><i class="handle zmdi zmdi-menu"></i></td>
+ <td><input class="outline" ng-attr-name="tags[@{{$index}}][name]" type="text" ng-model="tag.name" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag"></td>
+ <td><input class="outline" ng-attr-name="tags[@{{$index}}][value]" type="text" ng-model="tag.value" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag Value (Optional)"></td>
+ <td width="10" ng-show="tags.length != 1" class="text-center text-neg" style="padding: 0;" ng-click="removeTag(tag)"><i class="zmdi zmdi-close"></i></td>
</tr>
- </tbody>
- </table>
- </div>
- <button class="button pos" type="submit">Save Tags</button>
- </form>
+ </tbody>
+ </table>
+ <table class="no-style" style="width: 100%;">
+ <tbody>
+ <tr class="unsortable">
+ <td width="34"></td>
+ <td ng-click="addEmptyTag()">
+ <button type="button" class="text-button">Add another tag</button>
+ </td>
+ <td></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</div>
</div>
\ No newline at end of file
diff --git
a/resources/views/pages/page-display.blade.php
b/resources/views/pages/page-display.blade.php
index babc4ccfd00b8f4b7309d703101e8604006aeb03..df555da078ab49c0940832a9e792ae25833f8a18 100644
(file)
--- a/
resources/views/pages/page-display.blade.php
+++ b/
resources/views/pages/page-display.blade.php
@@
-1,5
+1,22
@@
<div ng-non-bindable>
- <h1 id="bkmrk-page-title">{{$page->name}}</h1>
+
+ <h1 id="bkmrk-page-title" class="float left">{{$page->name}}</h1>
+
+ @if(count($page->tags) > 0)
+ <div class="tag-display float right">
+ <div class="heading primary-background-light">Page Tags</div>
+ <table>
+ @foreach($page->tags as $tag)
+ <tr class="tag">
+ <td @if(!$tag->value) colspan="2" @endif> {{ $tag->name }}</td>
+ @if($tag->value) <td class="tag-value">{{$tag->value}}</td> @endif
+ </tr>
+ @endforeach
+ </table>
+ </div>
+ @endif
+
+ <div style="clear:left;"></div>
{!! $page->html !!}
</div>
\ No newline at end of file
hide
Morty Proxy
This is a
proxified and sanitized
view of the page, visit
original site
.