improve collapser css

This commit is contained in:
2018-07-28 17:12:45 +02:00
parent 3a8d54a569
commit b9fed14465
4 changed files with 23 additions and 7 deletions
+17 -3
View File
@@ -13,11 +13,22 @@ use MightyPork\Exceptions\NotApplicableException;
class TableController extends Controller
{
public function view(User $user, string $table)
public function view(Request $request, User $user, string $table)
{
$input = $this->validate($request, [
'rev' => 'nullable|int'
]);
/** @var Table $tableModel */
$tableModel = $user->tables()->where('name', $table)->first();
$revision = $tableModel->revision;
if ($input->has('rev')) {
$rev = (int)$input->rev;
$revision = $tableModel->revisions()->orderBy('created_at')->skip($rev)->first();
if ($revision === null) abort(404, "No such revision");
} else {
$revision = $tableModel->revision;
}
return view('table.view', [
'table' => $tableModel,
@@ -113,6 +124,7 @@ class TableController extends Controller
$rowsData = null;
try {
$rowsData = array_map(function ($row) use ($columns) {
if (count($row) == 0 || count($row)==1&&$row[0]=='') return null;
if (count($row) != count($columns)) {
throw new NotApplicableException("All rows must have " . count($columns) . " fields.");
}
@@ -129,8 +141,10 @@ class TableController extends Controller
'data' => json_encode($parsed),
];
}, $rowTable);
$rowsData = array_filter($rowsData);
} catch (\Exception $e) {
return $this->backWithErrors(['columns' => $e->getMessage()]);
return $this->backWithErrors(['data' => $e->getMessage()]);
}
$revisionFields = [
+1 -1
View File
@@ -75,7 +75,7 @@ class CollapsibleTextBoxWidget
if ($this->collapsing) {
return '<div class="block-collapse"
title="Click to expand / Double-click to collapse"
title="Click to toggle"
style="max-height:'.$this->maxHeight.'">' . $prefix . $content . '</div>';
} else {
return $prefix.'<div>' . $prefix . $content . '</div>';
+4 -2
View File
@@ -16,8 +16,10 @@
&::after{
content: '';
width: 70%;
background: linear-gradient(to right, rgba(255, 255, 255, 0), white 90%);
width: 100%;
height: 50%;
background: linear-gradient(170deg, rgba(255, 255, 255, 0) 30%, white 90%),
linear-gradient(to bottom, rgba(255, 255, 255, 0) 80%, white 100%);
}
&::before {
+1 -1
View File
@@ -29,7 +29,7 @@
@if($table->origin)
<p class="last-p-mb-0">
<b>Source</b><br>
{!! Widget::tryLink($table->origin) !!}
@icon(fa-link){!! Widget::tryLink($table->origin) !!}
</p>
@endif
</div>