diff --git a/app/Http/Controllers/TableController.php b/app/Http/Controllers/TableController.php
index 7e9696d..c2d0b17 100644
--- a/app/Http/Controllers/TableController.php
+++ b/app/Http/Controllers/TableController.php
@@ -23,7 +23,7 @@ class TableController extends Controller
'table' => $tableModel,
'revision' => $revision,
'columns' => Column::columnsFromJson(json_decode($revision->columns)),
- 'rows' => $revision->rows,
+ 'rows' => $revision->rows()->paginate(25),
]);
}
diff --git a/app/View/CollapsibleTextBoxWidget.php b/app/View/CollapsibleTextBoxWidget.php
new file mode 100644
index 0000000..3b0e379
--- /dev/null
+++ b/app/View/CollapsibleTextBoxWidget.php
@@ -0,0 +1,80 @@
+srEscape = $escape;
+ $this->srPrefix = $content;
+ return $this;
+ }
+
+ /**
+ * @param string $text - text to show
+ * @param int $thresholdLength - mb_character length that triggers the collapsible behavior; choose experimentally
+ * @param string $maxHeight - max height CSS value (e.g. 8em)
+ */
+ public function __construct($text, $thresholdLength, $maxHeight)
+ {
+ $this->text = $text;
+ $this->collapsing = mb_strlen($text) > $thresholdLength;
+ $this->maxHeight = $maxHeight;
+ }
+
+ private function processText($t)
+ {
+ $out = e($t);
+ $out = str_replace("\r\n", "\n", $out);
+
+ $out = '
' . $prefix . $content . '
';
+ } else {
+ return $prefix.'' . $prefix . $content . '
';
+ }
+ }
+
+ public function __toString()
+ {
+ return (string) $this->render();
+ }
+}
diff --git a/app/View/WidgetFactory.php b/app/View/WidgetFactory.php
index c5ee215..0de0f5b 100644
--- a/app/View/WidgetFactory.php
+++ b/app/View/WidgetFactory.php
@@ -31,6 +31,11 @@ class WidgetFactory
"";
}
+ public function collapsible($text, $thrSize, $maxHeight)
+ {
+ return new CollapsibleTextBoxWidget($text, $thrSize, $maxHeight);
+ }
+
private function baseWidget($view, $name, $label)
{
return (new Widget($view, $name, $label))->layout($this->labelCols, $this->fieldCols);
diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js
index d05eb66..f81373f 100644
--- a/resources/assets/js/app.js
+++ b/resources/assets/js/app.js
@@ -20,6 +20,12 @@ $(function () {
$notifs.addClass('hidden')
}, 500)
}, 2500)
+
+ $('.block-collapse').on('click', (e) => {
+ $(e.target).closest('.block-collapse').addClass('reveal')
+ }).on('dblclick', (e) => {
+ $(e.target).closest('.block-collapse').removeClass('reveal')
+ });
})
// auto-alias
diff --git a/resources/assets/sass/_block-collapse.scss b/resources/assets/sass/_block-collapse.scss
new file mode 100644
index 0000000..3f72909
--- /dev/null
+++ b/resources/assets/sass/_block-collapse.scss
@@ -0,0 +1,37 @@
+.block-collapse {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ position: relative;
+
+ &::before,
+ &::after {
+ position: absolute;
+ right: 0;
+ bottom: 0;
+ text-align: right;
+ height: 1.7em;
+ line-height: 1.7em;
+ cursor: pointer;
+ }
+
+ &::after{
+ content: '';
+ width: 70%;
+ background: linear-gradient(to right, rgba(255, 255, 255, 0), white 90%);
+ }
+
+ &::before {
+ content: '▼';
+ z-index: 10;
+ color: $gray-500;
+ }
+
+ &.reveal {
+ max-height: unset !important; // override inline styles
+
+ &::before, &::after {
+ display: none;
+ }
+ }
+}
+
diff --git a/resources/assets/sass/_helpers.scss b/resources/assets/sass/_helpers.scss
index fee6245..184bf4c 100644
--- a/resources/assets/sass/_helpers.scss
+++ b/resources/assets/sass/_helpers.scss
@@ -26,3 +26,19 @@
.border-dotted {
border-style: dotted !important;
}
+
+.last-p-mb-0 {
+ &:last-child {
+ margin-bottom: 0;
+ }
+}
+
+@each $color, $value in $colors {
+ .border-#{$color} {
+ border-color: $value !important;
+ }
+}
+
+.box-shadow {
+ box-shadow: 0 2px 3px rgba(black, .3);
+}
diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss
index f62a789..c4a051c 100644
--- a/resources/assets/sass/app.scss
+++ b/resources/assets/sass/app.scss
@@ -7,6 +7,7 @@ html {
@import "helpers";
@import "fa-utils";
+@import "block-collapse";
@import "bootstrap-customizations/paginate";
@import "bootstrap-customizations/card";
diff --git a/resources/assets/sass/bootstrap-customizations/_card.scss b/resources/assets/sass/bootstrap-customizations/_card.scss
index 41b11a7..96a4c34 100644
--- a/resources/assets/sass/bootstrap-customizations/_card.scss
+++ b/resources/assets/sass/bootstrap-customizations/_card.scss
@@ -14,7 +14,7 @@
}
.card {
- box-shadow: 0 2px 3px rgba(black, .3);
+ @extend .box-shadow;
}
.card-header-extra {
diff --git a/resources/assets/sass/bootstrap-customizations/_variables.scss b/resources/assets/sass/bootstrap-customizations/_variables.scss
index e20f6be..e58d4e8 100644
--- a/resources/assets/sass/bootstrap-customizations/_variables.scss
+++ b/resources/assets/sass/bootstrap-customizations/_variables.scss
@@ -15,9 +15,9 @@ $font-family-sans-serif: "IBM Plex Sans", "Droid Sans", "Helvetica Neue", "Helve
$font-size-base: 1rem;
$line-height-base: 1.6;
-$link-color: $gray-800;
+$link-color: darken($primary, 15%);
$link-decoration: none;
-$link-hover-color: darken($link-color, 15%);
+$link-hover-color: darken($primary, 10%);
$link-hover-decoration: underline;
$card-cap-bg: lighten($primary, 5);
diff --git a/resources/views/profile/view.blade.php b/resources/views/profile/view.blade.php
index 6487c08..cbbbf90 100644
--- a/resources/views/profile/view.blade.php
+++ b/resources/views/profile/view.blade.php
@@ -30,27 +30,9 @@
@if($user->bio)
- @if(mb_strlen($user->bio) > 250)
-
- @sr(About me:)
- {{mb_substr($user->bio, 0, 250)}}…
-
- [more]
-
-
-
- @sr(About me:)
- {{ $user->bio }}
-
- [collapse]
-
-
- @else
-
- @sr(About me:)
- {{ $user->bio }}
-
- @endif
+
+ {!! Widget::collapsible($user->bio, 350, '8em')->srPrefix('About me:') !!}
+
@endif
diff --git a/resources/views/table/view.blade.php b/resources/views/table/view.blade.php
index 6ae8903..ff7ff77 100644
--- a/resources/views/table/view.blade.php
+++ b/resources/views/table/view.blade.php
@@ -10,13 +10,68 @@
{{ $table->title }}
-
-
+
+
+ @if($table->description)
+
+ Description
+ {!! Widget::collapsible($table->description, 400, '8em') !!}
+
+ @endif
+
+ @if($table->origin)
+
+ Source
+ {{ $table->origin }}
+
+ @endif
+
+
+
+
+
+
+ License |
+ {{ $table->license ?: 'CC0' }} |
+
+
+
+ Created |
+ {{ $table->created_at->format("M j, Y") }} |
+
+
+
+ Updated |
+ {{ $table->updated_at->format("M j, Y") }} |
+
+
+
+ Revisions |
+ {{ $table->revisions()->count() }} |
+
+
+
+
+
+
+ Right Column with buttons etc, maybe
+
+
+
+
+
+
+
+
+
+
+
- ID |
@foreach($columns as $col)
{{ $col->title }} |
@endforeach
@@ -25,7 +80,6 @@
@foreach($rows as $row)
- #{{ $row->id }} |
@php($rdata = json_decode($row['data'], true))
@foreach($columns as $col)
{{ $rdata[$col->name] }} |