From c24b61a0a0a6e46c2ef2a3a4beb869a8a12a601c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= Date: Sun, 13 Oct 2019 18:18:41 +0200 Subject: [PATCH] [#21] Litteraturkritikk: Add korrekturstatus --- .../LitteraturkritikkSchema.php | 64 ++++++-- .../2019_10_13_171731_add_korrekturstatus.php | 142 ++++++++++++++++++ resources/lang/nb/litteraturkritikk.php | 2 + .../views/litteraturkritikk/show.blade.php | 33 ++-- 4 files changed, 217 insertions(+), 24 deletions(-) create mode 100644 database/migrations/2019_10_13_171731_add_korrekturstatus.php diff --git a/app/Litteraturkritikk/LitteraturkritikkSchema.php b/app/Litteraturkritikk/LitteraturkritikkSchema.php index 97b7408b..f0d8ac12 100644 --- a/app/Litteraturkritikk/LitteraturkritikkSchema.php +++ b/app/Litteraturkritikk/LitteraturkritikkSchema.php @@ -48,16 +48,6 @@ class LitteraturkritikkSchema extends Schema 'operators' => ['eq', 'neq'], ] ], - - // Sist endret - [ - 'key' => 'updated_at', - 'type' => 'simple', - 'editable' => false, - 'searchable' => 'disabled', - - 'columnClassName' => 'dt-body-nowrap', - ], ], 'groups' => [ @@ -332,6 +322,60 @@ class LitteraturkritikkSchema extends Schema ], ], ], + + // Posten + [ + 'label' => 'Databaseposten', + + 'fields' => [ + + // Opprettet + [ + 'key' => 'created_at', + 'type' => 'simple', + 'editable' => false, + 'searchable' => 'disabled', + + 'columnClassName' => 'dt-body-nowrap', + ], + + // Sist endret + [ + 'key' => 'updated_at', + 'type' => 'simple', + 'editable' => false, + 'searchable' => 'disabled', + + 'columnClassName' => 'dt-body-nowrap', + ], + + // Korrekturstatus + [ + 'key' => 'korrekturstatus', + 'type' => 'enum', + 'values' => [ + ['id' => 1, 'label' => 'Ikke korrekturlest'], + ['id' => 2, 'label' => 'Må korrekturleses mot fysisk materiale'], + ['id' => 3, 'label' => 'Korrekturlest mot fysisk materiale'], + ['id' => 4, 'label' => 'Korrekturlest og lenket til digitalt materiale'], + ], + 'searchOptions' => [ + 'operators' => ['ex'] + ], + 'columnClassName' => 'dt-body-nowrap', + ], + + // Slettet + [ + 'key' => 'deleted_at', + 'type' => 'simple', + 'editable' => false, + 'searchable' => 'disabled', + + 'columnClassName' => 'dt-body-nowrap', + ], + ] + ], ], ]; diff --git a/database/migrations/2019_10_13_171731_add_korrekturstatus.php b/database/migrations/2019_10_13_171731_add_korrekturstatus.php new file mode 100644 index 00000000..b92c195f --- /dev/null +++ b/database/migrations/2019_10_13_171731_add_korrekturstatus.php @@ -0,0 +1,142 @@ +index('publikasjon'); + $view->index('verk_sjanger'); + $view->index('kritikktype'); + $view->index('spraak'); + }); + } + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + $this->dropView(); + Schema::table('litteraturkritikk_records', function (Blueprint $table) { + $table->tinyInteger('korrekturstatus')->default(1); + }); + $this->recreateView(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $this->dropView(); + Schema::table('litteraturkritikk_records', function (Blueprint $table) { + $table->dropColumn('korrekturstatus'); + }); + $this->recreateView(); + } +} diff --git a/resources/lang/nb/litteraturkritikk.php b/resources/lang/nb/litteraturkritikk.php index e7add324..59e14dd3 100644 --- a/resources/lang/nb/litteraturkritikk.php +++ b/resources/lang/nb/litteraturkritikk.php @@ -5,6 +5,8 @@ 'id' => 'ID', 'created_at' => 'Opprettet', 'updated_at' => 'Sist endret', + 'deleted_at' => 'Slettet', + 'korrekturstatus' => 'Korrekturstatus', 'q' => 'Alle felt', 'person' => 'Person (forfatter, kritiker e.a.)', diff --git a/resources/views/litteraturkritikk/show.blade.php b/resources/views/litteraturkritikk/show.blade.php index 3db7751c..4a723065 100644 --- a/resources/views/litteraturkritikk/show.blade.php +++ b/resources/views/litteraturkritikk/show.blade.php @@ -78,7 +78,7 @@ Vis fulltekst ({{ $n + 1 }}) @endforeach - @else + @elseif ($group->label != 'Databaseposten') Søk etter fulltekst i NB @@ -121,10 +121,28 @@ {{ $url }}
@endforeach + @elseif ($field->type == 'enum') + + {{ $field->formatValue($record->{$field->key}) }} + @elseif (is_array($record->{$field->key})) {{ implode(', ', $record->{$field->key}) }} + @elseif ($field->key == 'created_at') + + {{ $record->{$field->key} }} + av {{ $record->createdBy ? $record->createdBy->name : ' (import)' }} + + @elseif ($field->key == 'updated_at') + + {{ $record->{$field->key} }} + av {{ $record->updatedBy ? $record->updatedBy->name : ' (import)' }} + + @elseif ($field->key == 'deleted_at') + + {{ $record->{$field->key} ?: 'Nei' }} + @else {{ $record->{$field->key} }} @@ -138,19 +156,6 @@ @endforeach - @if (Auth::check()) -

Metadata

-
-
Opprettet:
-
{{ $record->created_at }} av {{ $record->createdBy ? $record->createdBy->name : ' (import)' }}
-
Sist endret:
-
{{ $record->updated_at }} av {{ $record->updatedBy ? $record->updatedBy->name : ' (import)' }}
- @if ($record->deleted_at) -
Slettet:
-
{{ $record->deleted_at }}
- @endif -
- @endif