]> gitweb.hamatoma.de Git - gadeku.git/commitdiff
0.1.5 Phrases: Übersetzung
authorHamatoma <author@hamatoma.de>
Wed, 10 Apr 2024 07:43:30 +0000 (09:43 +0200)
committerHamatoma <author@hamatoma.de>
Wed, 10 Apr 2024 07:43:30 +0000 (09:43 +0200)
- Phrases:
  - neues Attribut phrase_id: zeigt auf deutschen Satz
  - Übersetzungen in andere Sprachen
- Words: Löschen nur wenn Admin

- Falsche Id von "Deutsch (Deutschland)" bei sproperty scope "localization"

14 files changed:
CHANGELOG.md
app/Helpers/DbHelperLocal.php [new file with mode: 0644]
app/Http/Controllers/NounController.php
app/Http/Controllers/PhraseController.php
app/Http/Controllers/VerbController.php
app/Models/Phrase.php
composer.lock
database/migrations/2024_04_09_190303_add_phrases_phrase_id.php [new file with mode: 0644]
lang/de_DE.json
resources/lang/sources/gadeku.de.json
resources/views/phrase/edit.blade.php
resources/views/phrase/index.blade.php
resources/views/word/index.blade.php
resources/views/word/show.blade.php

index c9c0dfeb2a28ffa726c9b83f50ce09a9f2b4993a..6bf25acc24e228960892ee8e75ff0847e9f712e6 100644 (file)
@@ -1,3 +1,15 @@
+# V 0.1.5 Phrases: Übersetzung
+
+# Added:
+- Phrases: 
+  - neues Attribut phrase_id: zeigt auf deutschen Satz
+  - Übersetzungen in andere Sprachen
+- Words: Löschen nur wenn Admin
+
+# Changed
+- Falsche Id von "Deutsch (Deutschland)" bei sproperty scope "localization"
+
+
 # V 0.1.4 Korrekturen Verb
 
 # Changed
diff --git a/app/Helpers/DbHelperLocal.php b/app/Helpers/DbHelperLocal.php
new file mode 100644 (file)
index 0000000..c1cbc9d
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+namespace App\Helpers;
+
+use App\Helpers\ViewHelper;
+use Illuminate\Support\Facades\DB;
+
+class DbHelperLocal
+{
+    
+}
\ No newline at end of file
index d92ff03e72893cc14e796be8e6597790b58ba0f8..8d30fa6ad92c34c2652b1217a86e479d60d505db 100644 (file)
@@ -54,7 +54,7 @@ class NounController extends Controller
             $fields = $request->all();
             if (count($fields) === 0) {
                 $word = Word::find($noun->word_id);
-                $phrase = DB::select('select id, phrase from phrases where word_id=? and language_scope=1201', [$word->id])[0];
+                $phrase = DB::select('select id, phrase from phrases where word_id=? and language_scope=1202', [$word->id])[0];
                 $plural = Word::find($noun->plural_id);
                 $fields = [
                     'noun' => $word->word,
@@ -203,12 +203,12 @@ class NounController extends Controller
                     'wordtype_scope' => 2001,
                     'verifiedby_id' => null,
                     'owner_id' => auth()->id(),
-                    'language_scope' => 1201
+                    'language_scope' => 1202
                 ]);
                 $phrase = Phrase::create([
                     'phrase' => $fields['usage'],
                     'word_id' => $word->id,
-                    'language_scope' => 1201,
+                    'language_scope' => 1202,
                     'owner_id' => auth()->id()
                 ]);
                 $plural = Word::create([
@@ -216,7 +216,7 @@ class NounController extends Controller
                     'wordtype_scope' => 2001,
                     'verifiedby_id' => null,
                     'owner_id' => auth()->id(),
-                    'language_scope' => 1201
+                    'language_scope' => 1202
                 ]);
                 Noun::create(['word_id' => $word->id, 'plural_id' => $plural->id, 'genus_scope' => $fields['genus_scope']]);
             }
index c2e4174946fb4e2bf91bb35eb45391d303b4f48f..3a01dd09cc73bc535999ff57c13af66aba83543e 100644 (file)
@@ -40,7 +40,7 @@ class PhraseController extends Controller
             $optionsPhrase = DbHelper::comboboxDataOfTable('words', 'name', 'id', $fields['phrase_id'], __('<Please select>'));
             $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner_id'], __('<Please select>'));
             $optionsVerifiedby = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['verifiedby_id'], __('<Please select>'));
-            $context = new ContextLaraKnife($request, $fields);     
+            $context = new ContextLaraKnife($request, $fields);
             $rc = view('phrase.create', [
                 'context' => $context,
                 'optionsLanguage' => $optionsLanguage,
@@ -48,7 +48,7 @@ class PhraseController extends Controller
                 'optionsPhrase' => $optionsPhrase,
                 'optionsOwner' => $optionsOwner,
                 'optionsVerifiedby' => $optionsVerifiedby,
-                ]);
+            ]);
         }
         return $rc;
     }
@@ -61,30 +61,34 @@ class PhraseController extends Controller
             $rc = redirect('/phrase-index');
         } else {
             $fields = $request->all();
-            if (count($fields) === 0) {
+            if (count($fields) === 1){
                 $fields = [
                     'phrase' => '',
-                    'language_scope' => '',
-                    'word_id' => '',
-                    'phrase_id' => '',
-                    'owner_id' => '',
-                    'verifiedby_id' => ''
-                    ];
+                    'language' => $request->language,
+                    'lastLanguage' => '',
+                    'translation' => ''
+                ];
+            } elseif (count($fields) === 0) {
+                $fields = [
+                    'phrase' => '',
+                    'language' => SProperty::idOfLocalization(),
+                    'lastLanguage' => '',
+                    'translation' => ''
+                ];
             }
-            $optionsLanguage = SProperty::optionsByScope('language', $phrase->language_scope, '');
-            $optionsWord = DbHelper::comboboxDataOfTable('words', 'name', 'id', $fields['word_id'], __('<Please select>'));
-            $optionsPhrase = DbHelper::comboboxDataOfTable('words', 'name', 'id', $fields['phrase_id'], __('<Please select>'));
-            $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner_id'], __('<Please select>'));
-            $optionsVerifiedby = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['verifiedby_id'], __('<Please select>'));
-            $context = new ContextLaraKnife($request, null, $phrase);
+            if ($fields['lastLanguage'] != $fields['language']){
+                $phraseTranslation = Phrase::where(['language_scope' => $fields['language'], 'phrase_id' => $phrase->id])->first();
+                if ($phraseTranslation != null){
+                    $fields['translation'] = $phraseTranslation->phrase;
+                }
+            }
+            $fields['lastLanguage'] = $fields['language'];
+            $optionsLanguage = SProperty::optionsByScope('localization', $fields['language'], '');
+            $context = new ContextLaraKnife($request, $fields, $phrase);
             $rc = view('phrase.edit', [
                 'context' => $context,
                 'optionsLanguage' => $optionsLanguage,
-                'optionsWord' => $optionsWord,
-                'optionsPhrase' => $optionsPhrase,
-                'optionsOwner' => $optionsOwner,
-                'optionsVerifiedby' => $optionsVerifiedby,
-                ]);
+            ]);
         }
         return $rc;
     }
@@ -108,46 +112,36 @@ class PhraseController extends Controller
         } else {
             $sql = 'SELECT t0.*,'
                 . 't1.name as language_scope, '
-                . 't2.name as word_id, '
-                . 't3.name as phrase_id, '
-                . 't4.name as owner_id, '
-                . 't5.name as verifiedby_id '
+                . 't2.name as owner_id, '
+                . 't3.name as verifiedby_id '
                 . ' FROM phrases t0'
                 . ' LEFT JOIN sproperties t1 ON t1.id=t0.language_scope'
-                . ' LEFT JOIN sproperties t2 ON t2.id=t0.word_id'
-                . ' LEFT JOIN sproperties t3 ON t3.id=t0.phrase_id'
-                . ' LEFT JOIN sproperties t4 ON t4.id=t0.owner_id'
-                . ' LEFT JOIN sproperties t5 ON t5.id=t0.verifiedby_id'
-                ;
+                . ' LEFT JOIN sproperties t2 ON t2.id=t0.owner_id'
+                . ' LEFT JOIN sproperties t3 ON t3.id=t0.verifiedby_id'
+            ;
             $parameters = [];
             $fields = $request->all();
             if (count($fields) == 0) {
                 $fields = [
-                'language' => '',
-                'word' => '',
-                'phrase' => '',
-                'owner' => '',
-                'verifiedby' => '',
-                'phrase' => '',
-                '_sortParams' => 'id:asc' 
-                                . ';phrase:desc'
+                    'language' => '',
+                    'word' => '',
+                    'phrase' => '',
+                    'owner' => '',
+                    'verifiedby' => '',
+                    '_sortParams' => 't0.phrase:asc;t0.id:desc'
                 ];
             } else {
                 $conditions = [];
                 ViewHelper::addConditionComparism($conditions, $parameters, 'language_scope', 'language');
-                ViewHelper::addConditionComparism($conditions, $parameters, 'word_id', 'word');
-                ViewHelper::addConditionComparism($conditions, $parameters, 'phrase_id', 'phrase');
                 ViewHelper::addConditionComparism($conditions, $parameters, 'owner_id', 'owner');
                 ViewHelper::addConditionComparism($conditions, $parameters, 'verifiedby_id', 'verifiedby');
-                ViewHelper::addConditionPattern($conditions, $parameters, 'phrase');
+                ViewHelper::addConditionPattern($conditions, $parameters, 'phrase', 'text');
                 $sql = DbHelper::addConditions($sql, $conditions);
             }
             $sql = DbHelper::addOrderBy($sql, $fields['_sortParams']);
             $pagination = new Pagination($sql, $parameters, $fields);
             $records = $pagination->records;
             $optionsLanguage = SProperty::optionsByScope('language', $fields['language'], 'all');
-            $optionsWord = DbHelper::comboboxDataOfTable('words', 'name', 'id', $fields['word'], __('<Please select>'));
-            $optionsPhrase = DbHelper::comboboxDataOfTable('words', 'name', 'id', $fields['phrase'], __('<Please select>'));
             $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner'], __('<Please select>'));
             $optionsVerifiedby = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['verifiedby'], __('<Please select>'));
             $context = new ContextLaraKnife($request, $fields);
@@ -155,8 +149,6 @@ class PhraseController extends Controller
                 'context' => $context,
                 'records' => $records,
                 'optionsLanguage' => $optionsLanguage,
-                'optionsWord' => $optionsWord,
-                'optionsPhrase' => $optionsPhrase,
                 'optionsOwner' => $optionsOwner,
                 'optionsVerifiedby' => $optionsVerifiedby,
                 'pagination' => $pagination
@@ -167,24 +159,23 @@ class PhraseController extends Controller
      * Returns the validation rules.
      * @return array<string, string> The validation rules.
      */
-    private function rules(bool $isCreate=false): array
+    private function rules(bool $isCreate = false): array
     {
         $rc = [
             'phrase' => 'required',
-            'language_scope' => 'required',
-            'word_id' => 'required',
-            'phrase_id' => 'required',
-            'owner_id' => 'required',
-            'verifiedby_id' => 'required'
+            'translation' => 'required',
         ];
+        if ($isCreate){
+            $rc['language'] = 'required';
+        }
         return $rc;
     }
     public static function routes()
     {
         Route::get('/phrase-index', [PhraseController::class, 'index'])->middleware('auth');
         Route::post('/phrase-index', [PhraseController::class, 'index'])->middleware('auth');
-        Route::get('/phrase-create', [PhraseController::class, 'create'])->middleware('auth');
-        Route::put('/phrase-store', [PhraseController::class, 'store'])->middleware('auth');
+        //Route::get('/phrase-create', [PhraseController::class, 'create'])->middleware('auth');
+        //Route::put('/phrase-store', [PhraseController::class, 'store'])->middleware('auth');
         Route::post('/phrase-edit/{phrase}', [PhraseController::class, 'edit'])->middleware('auth');
         Route::get('/phrase-edit/{phrase}', [PhraseController::class, 'edit'])->middleware('auth');
         Route::post('/phrase-update/{phrase}', [PhraseController::class, 'update'])->middleware('auth');
@@ -199,21 +190,18 @@ class PhraseController extends Controller
         if ($request->btnSubmit === 'btnCancel') {
             $rc = redirect('/phrase-index')->middleware('auth');
         } else {
+            $fields = $request->all();
             $optionsLanguage = SProperty::optionsByScope('language', $phrase->language_scope, '');
-            $optionsWord = DbHelper::comboboxDataOfTable('words', 'name', 'id', $fields['word_id'], __('<Please select>'));
-            $optionsPhrase = DbHelper::comboboxDataOfTable('words', 'name', 'id', $fields['phrase_id'], __('<Please select>'));
             $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner_id'], __('<Please select>'));
             $optionsVerifiedby = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['verifiedby_id'], __('<Please select>'));
             $context = new ContextLaraKnife($request, null, $phrase);
             $rc = view('phrase.show', [
                 'context' => $context,
                 'optionsLanguage' => $optionsLanguage,
-                'optionsWord' => $optionsWord,
-                'optionsPhrase' => $optionsPhrase,
                 'optionsOwner' => $optionsOwner,
                 'optionsVerifiedby' => $optionsVerifiedby,
                 'mode' => 'delete'
-                ]);
+            ]);
         }
         return $rc;
     }
@@ -231,11 +219,12 @@ class PhraseController extends Controller
                 $rc = back()->withErrors($validator)->withInput();
             } else {
                 $validated = $validator->validated();
-            $validated['phrase'] = strip_tags($validated['phrase']);
+                $validated['phrase'] = strip_tags($validated['phrase']);
+                $validated['translation'] = strip_tags($validated['translation']);
                 Phrase::create($validated);
             }
         }
-        if ($rc == null){
+        if ($rc == null) {
             $rc = redirect('/phrase-index');
         }
         return $rc;
@@ -246,19 +235,50 @@ class PhraseController extends Controller
     public function update(Phrase $phrase, Request $request)
     {
         $rc = null;
-        if ($request->btnSubmit === 'btnStore') {
+        if ($request->btnSubmit === 'btnInternal'){
+            // Language combobox has been changed:
+            $url = "/phrase-edit/$phrase->id?language=" . $request->language;
+            $rc = redirect($url);
+        } elseif ($request->btnSubmit === 'btnStore') {
+            $id = $phrase->id;
             $fields = $request->all();
             $validator = Validator::make($fields, $this->rules(false));
             if ($validator->fails()) {
+                $errors = $validator->errors();
                 $rc = back()->withErrors($validator)->withInput();
             } else {
                 $validated = $validator->validated();
                 $validated['phrase'] = strip_tags($validated['phrase']);
-                $phrase->update($validated);
+                $validated['translation'] = strip_tags($validated['translation']);
+                // Phrase has been changed?
+                $phraseDb = Phrase::find($id);
+                if ($phrase->phrase !== $phraseDb->phrase) {
+                    // Invalidate all verifications:
+                    DB::update("update phrases set validatedby_id=None where phrase_id=$id;");
+                    // Store new phrase:
+                    $phrase->update(['phrase' => $validated['phrase'], 'verifiedby_id' => null]);
+                }
+                // Does translation already exists?
+                $phraseTranslation = Phrase::where(['language_scope' => $fields['language'], 'phrase_id' => $phrase->id])->first();
+                if ($phraseTranslation == null) {
+                    // Store the new record:
+                    Phrase::create([
+                        'phrase_id' => $id,
+                        'phrase' => $validated['translation'],
+                        'owner_id' => auth()->id(),
+                        'language_scope' => $fields['language']
+                    ]);
+                } else {
+                    // Update only if changed:
+                    if ($phraseTranslation->phrase !== $validated['translation']){
+                        $phraseTranslation->update(['phrase' => $validated['translation'], 'verifiedby_id' => null]);
+                    }
+                }
+                $rc = redirect("/phrase-edit/$phrase->id?language=" . $fields['language']);
             }
         }
-        if ($rc == null){
-            $rc = redirect('/phrase-index');
+        if ($rc == null) {
+            $rc = redirect("/phrase-index");
         }
         return $rc;
     }
index 17539e8e89f511f64e9a5b1c27daace15fc2ad49..77b3eefc38db2103f1e5652fadaf7dd1b0ca93a1 100644 (file)
@@ -69,7 +69,7 @@ class VerbController extends Controller
             if (count($fields) === 0) {
                 ViewHelper::adaptCheckbox($fields, 'transitive');
                 $word = Word::find($verb->word_id);
-                $phrase = DB::select('select id, phrase from phrases where word_id=? and language_scope=1201', [$word->id])[0];
+                $phrase = DB::select('select id, phrase from phrases where word_id=? and language_scope=1202', [$word->id])[0];
                 $fields = [
                     'noun' => $word->word,
                     'word_id' => $verb->word_id,
@@ -240,12 +240,12 @@ class VerbController extends Controller
                     'wordtype_scope' => 2002,
                     'verifiedby_id' => null,
                     'owner_id' => auth()->id(),
-                    'language_scope' => 1201
+                    'language_scope' => 1202
                 ]);
                 $phrase = Phrase::create([
                     'phrase' => $fields['usage'],
                     'word_id' => $word->id,
-                    'language_scope' => 1201,
+                    'language_scope' => 1202,
                     'owner_id' => auth()->id()
                 ]);
                 $validated['word_id'] = $word->id;
index a89e81e42b8c3060a75be67e571ac19b65ace828..da77f901185ad80ac0aeccce56a97a0c26293c13 100644 (file)
@@ -16,6 +16,7 @@ class Phrase extends Model
         'phrase',
         'language_scope',
         'word_id',
+        'phrase_id',
         'baselanguage_id',
         'owner_id',
         'verifiedby_id'
index 4565f1bd70036846c4bbcaedada62dbb1f76306a..71b1ec6f525aeea462abd7f1d62b42a4c5629959 100644 (file)
         },
         {
             "name": "laravel/framework",
-            "version": "v11.2.0",
+            "version": "v11.3.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "a1750156b671f37cba702380107e2d22161c31e3"
+                "reference": "cbcb0ee3da8c5f98497d9a282609732251a7dd1e"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/a1750156b671f37cba702380107e2d22161c31e3",
-                "reference": "a1750156b671f37cba702380107e2d22161c31e3",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/cbcb0ee3da8c5f98497d9a282609732251a7dd1e",
+                "reference": "cbcb0ee3da8c5f98497d9a282609732251a7dd1e",
                 "shasum": ""
             },
             "require": {
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2024-04-02T14:01:33+00:00"
+            "time": "2024-04-09T15:19:11+00:00"
         },
         {
             "name": "laravel/prompts",
-            "version": "v0.1.17",
+            "version": "v0.1.18",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/prompts.git",
-                "reference": "8ee9f87f7f9eadcbe21e9e72cd4176b2f06cd5b5"
+                "reference": "3b5e6b03f1f1175574b5a32331d99c9819da9848"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/prompts/zipball/8ee9f87f7f9eadcbe21e9e72cd4176b2f06cd5b5",
-                "reference": "8ee9f87f7f9eadcbe21e9e72cd4176b2f06cd5b5",
+                "url": "https://api.github.com/repos/laravel/prompts/zipball/3b5e6b03f1f1175574b5a32331d99c9819da9848",
+                "reference": "3b5e6b03f1f1175574b5a32331d99c9819da9848",
                 "shasum": ""
             },
             "require": {
             ],
             "support": {
                 "issues": "https://github.com/laravel/prompts/issues",
-                "source": "https://github.com/laravel/prompts/tree/v0.1.17"
+                "source": "https://github.com/laravel/prompts/tree/v0.1.18"
             },
-            "time": "2024-03-13T16:05:43+00:00"
+            "time": "2024-04-04T17:41:50+00:00"
         },
         {
             "name": "laravel/serializable-closure",
         },
         {
             "name": "league/flysystem",
-            "version": "3.26.0",
+            "version": "3.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/thephpleague/flysystem.git",
-                "reference": "072735c56cc0da00e10716dd90d5a7f7b40b36be"
+                "reference": "4729745b1ab737908c7d055148c9a6b3e959832f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/072735c56cc0da00e10716dd90d5a7f7b40b36be",
-                "reference": "072735c56cc0da00e10716dd90d5a7f7b40b36be",
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4729745b1ab737908c7d055148c9a6b3e959832f",
+                "reference": "4729745b1ab737908c7d055148c9a6b3e959832f",
                 "shasum": ""
             },
             "require": {
             ],
             "support": {
                 "issues": "https://github.com/thephpleague/flysystem/issues",
-                "source": "https://github.com/thephpleague/flysystem/tree/3.26.0"
+                "source": "https://github.com/thephpleague/flysystem/tree/3.27.0"
             },
             "funding": [
                 {
                     "type": "github"
                 }
             ],
-            "time": "2024-03-25T11:49:53+00:00"
+            "time": "2024-04-07T19:17:50+00:00"
         },
         {
             "name": "league/flysystem-local",
diff --git a/database/migrations/2024_04_09_190303_add_phrases_phrase_id.php b/database/migrations/2024_04_09_190303_add_phrases_phrase_id.php
new file mode 100644 (file)
index 0000000..b5df4d3
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::table('phrases', function(Blueprint $table) {
+            $table->foreignId('phrase_id')->nullable()->references('id')->on('phrases');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};
index 2c4b02438d26d04934333a3cbcaa92fc294f4470..11e4e3698834fee42c1e04de161f167816d1665a 100644 (file)
@@ -18,6 +18,7 @@
     "Change of a Menu Item": "\u00c4ndern einer Men\u00fceintrags",
     "Change of a Note": "\u00c4ndern einer Notiz",
     "Change of a Noun": "\u00c4nderung eines Nomens",
+    "Change of a Phrase": "\u00c4nderung eines Satzes",
     "Change of a Role": "\u00c4ndern einer Rolle",
     "Change of a Scoped Property": "\u00c4ndern einer bereichsbasierten Eigenschaft",
     "Change of a Term": "\u00c4ndern eines Termins",
@@ -42,6 +43,7 @@
     "Deletion of a Noun": "L\u00f6schen eines Nomens",
     "Deletion of a Scoped Property": "L\u00f6schen einer bereichsbasierten Eigenschaft",
     "Deletion of a Verb": "L\u00f6schen eines Verbs",
+    "Deletion of a Word": "L\u00f6schen eines Wortes",
     "Deletion of an User": "L\u00f6schen eines Benutzers",
     "Description": "Beschreibung",
     "Displaying an User": "Anzeige eines Benutzers",
@@ -67,6 +69,7 @@
     "Insert Position": "Einf\u00fcgeposition",
     "Italian (Italy)": "Italienisch (Italien)",
     "Label": "Beschriftung",
+    "Language": "Sprache",
     "Lines per Page": "Zeilen je Seite",
     "Link": "Verweis",
     "Localization": "Lokalisierung",
@@ -85,6 +88,8 @@
     "Participle": "Partizip",
     "Password": "Passwort",
     "Password forgotten?": "Passwort vergessen?",
+    "Phrase": "Satz",
+    "Phrases": "S\u00e4tze",
     "Please use the following link and change your password:": "Bitte benutze den folgenden Verweis und \u00e4ndere dein Passwort",
     "Preposition": "Pr\u00e4position",
     "Privacy": "Datenschutz",
     "Title": "Titel",
     "To": "Bis",
     "Total": "Gesamt",
+    "Translation": "\u00dcbersetzung",
     "Usage": "Verwendung",
     "User": "Benutzer",
     "Users": "Benutzer",
index d3398be4ea8c37f2c1750a59272fc55004928134..2a3f002c521dd91f32e670a9bfb8982c263515ef 100644 (file)
@@ -2,11 +2,13 @@
 "!comment": "Bitte alphabetisch sortiert eintragen!",
 "Adjective": "Adjektiv",
 "Change of a Noun": "Änderung eines Nomens",
+"Change of a Phrase": "Änderung eines Satzes",
 "Change of a Verb": "Änderung eines Verbs",
 "Change of a Word": "Änderung eines Wortes",
 "Creation of a Verb": "Neues Verb",
 "Deletion of a Noun": "Löschen eines Nomens",
 "Deletion of a Verb": "Löschen eines Verbs",
+"Deletion of a Word": "Löschen eines Wortes",
 "feminine": "Femininum",
 "Genus": "Geschlecht",
 "Imperfect": "Imperfekt",
 "Noun": "Nomen",
 "Nouns": "Nomen",
 "Participle": "Partizip",
+"Phrase": "Satz",
+"Phrases": "Sätze",
 "Preposition": "Präposition",
+"Translation": "Übersetzung",
 "Verb": "Verb",
 "Verbs": "Verben",
 "Word": "Wort",
index 4cb55ce4936728d9c7076158470061ad2a3b7197..12698f2fabe7c4c048d4c374a336012582fa1d9d 100644 (file)
@@ -3,14 +3,11 @@
 @section('content')
     <form id="phrase-edit" action="/phrase-update/{{ $context->model->id  }}" method="POST">
         @csrf
+        <input type="hidden" name="lastLanguage" value="{{ $context->valueOf('lastLanguage') }}">
         <x-laraknife.panels.edit title="{{ __('Change of a Phrase') }}">
-        <x-laraknife.forms.text position="alone" name="id" label="Id" value="{{ $context->model->id }}" width2="4" attribute="readonly"/>
-        <x-laraknife.forms.combobox position="alone" name="language_scope" label="Language" :options="$optionsLanguage" width2="4"/>
-        <x-laraknife.forms.combobox position="alone" name="word_id" label="Word" :options="$optionsWord" width2="4"/>
-        <x-laraknife.forms.combobox position="alone" name="phrase_id" label="Phrase" :options="$optionsPhrase" width2="4"/>
-        <x-laraknife.forms.combobox position="alone" name="owner_id" label="Owner" :options="$optionsOwner" width2="4"/>
-        <x-laraknife.forms.combobox position="alone" name="verifiedby_id" label="Verifiedby" :options="$optionsVerifiedby" width2="4"/>
-        <x-laraknife.forms.text position="alone" name="phrase" label="Phrase" value="{{ $context->valueOf('phrase') }}" width2="4" rows="2" />
+        <x-laraknife.forms.combobox position="alone" name="language" label="Language" :options="$optionsLanguage" width2="4" class="lkn-autoupdate"/>
+        <x-laraknife.forms.text position="alone" name="phrase" label="Phrase" value="{{ $context->valueOf('phrase') }}" width2="10" rows="3" />
+        <x-laraknife.forms.text position="alone" name="translation" label="Translation" value="{{ $context->valueOf('translation') }}" width2="10" rows="3" />
         </x-laraknife.panels.edit>
     </form>
 @endsection
index 278007659bdd1aa55ccc3f132b88a94b947274b0..5d1cd88eb424eb9c08803e66b699d26fda979580 100644 (file)
@@ -5,22 +5,17 @@
     @csrf
     <x-laraknife.panels.index title="{{ __('Phrases') }}">
       <x-laraknife.panels.filter legend="{{ $pagination->legendText() }}">
-      <x-laraknife.forms.combobox position="alone" name="language" label="Language" :options="$optionsLanguage" class="lkn-autoupdate" width2="4" />
-      <x-laraknife.forms.combobox position="alone" name="word" label="Word" :options="$optionsWord" class="lkn-autoupdate" width2="4" />
-      <x-laraknife.forms.combobox position="alone" name="phrase" label="Phrase" :options="$optionsPhrase" class="lkn-autoupdate" width2="4" />
-      <x-laraknife.forms.combobox position="alone" name="owner" label="Owner" :options="$optionsOwner" class="lkn-autoupdate" width2="4" />
-      <x-laraknife.forms.combobox position="alone" name="verifiedby" label="Verifiedby" :options="$optionsVerifiedby" class="lkn-autoupdate" width2="4" />
-      <x-laraknife.forms.text position="alone" name="phrase" label="Phrase" value="{{ $context->valueOf('phrase') }}" width2="4" rows="2" />
+        <x-laraknife.forms.combobox position="first" name="owner" label="Owner" :options="$optionsOwner" class="lkn-autoupdate" width2="4" />
+        <x-laraknife.forms.combobox position="last" name="verifiedby" label="Verifiedby" :options="$optionsVerifiedby" class="lkn-autoupdate" width2="4" />
+        <x-laraknife.forms.string position="first" name="text" label="Text" value="{{ $context->valueOf('text') }}" width2="4" />
+        <x-laraknife.forms.combobox position="last" name="language" label="Language" :options="$optionsLanguage" class="lkn-autoupdate" width2="4" />
       </x-laraknife.panels.filter>
-      <x-laraknife.panels.index-button buttonType="new"/>
       <x-laraknife.panels.sortable-table :context="$context" :pagination="$pagination">
         <thead>
           <tr>
             <th></th>
             <th sortId="phrase">{{__('Phrase')}}</th>
             <th sortId="language_scope">{{__('Language')}}</th>
-            <th sortId="word_id">{{__('Word')}}</th>
-            <th sortId="phrase_id">{{__('Phrase')}}</th>
             <th sortId="owner_id">{{__('Owner')}}</th>
             <th sortId="verifiedby_id">{{__('Verifiedby')}}</th>
             <th></th>
 @foreach ($records as $phrase)
         <tr>
             <td><x-laraknife.icons.change-record module="phrase" no="{{ $phrase->id }}" /></td>
-              <td> {{ __($phrase->language_scope) }}</td>
               <td>{{$phrase->phrase}}</td>
-              <td>{{$phrase->word_id}}</td>
-              <td>{{$phrase->phrase_id}}</td>
+              <td> {{ __($phrase->language_scope) }}</td>
               <td>{{$phrase->owner_id}}</td>
               <td>{{$phrase->verifiedby_id}}</td>
             <td><x-laraknife.icons.delete-record module="phrase" no="{{ $phrase->id }}" /></td>
index 6483cd08bacf4ba4d19482d3c04614673ef9e6e5..e8b01a48ba21aa27f3e4e55095e7b7e9a93b52a9 100644 (file)
@@ -22,7 +22,9 @@
                         <th sortId="wordtype">{{ __('Wordtype') }}</th>
                         <th sortId="verifiedby">{{ __('Verifiedby') }}</th>
                         <th sortId="owner">{{ __('Owner') }}</th>
+                        @if ($context->isAdmin())
                         <th></th>
+                        @endif
                     </tr>
                 </thead>
                 <tbody>
@@ -33,7 +35,9 @@
                             <td> {{ __($word->wordtype) }}</td>
                             <td>{{ $word->verifiedby }}</td>
                             <td>{{ $word->owner }}</td>
+                            @if ($context->isAdmin())
                             <td><x-laraknife.icons.delete-record module="word" no="{{ $word->id }}" /></td>
+                            @endif
                         </tr>
                     @endforeach
                 </tbody>
index 0b7f5e93fbde2f31fdd872557e73bb206807a510..deadfeef92ff057e0cfd88af13fbdb55830bf68b 100644 (file)
@@ -7,9 +7,8 @@
         @method('DELETE')
         @endif
         <x-laraknife.panels.show title="{{ __($mode !== 'delete' ? 'A Word' : 'Deletion of a Word') }}" mode="{{$mode}}">
-            <x-laraknife.forms.string position="first" name="name" label="Name" value="{{ $context->valueOf('name') }}" width2="4" attribute="readonly" />
+            <x-laraknife.forms.string position="first" name="name" label="Name" value="{{ $context->valueOf('word') }}" width2="4" attribute="readonly" />
                 <x-laraknife.forms.combobox position="last" name="wordtype_scope" label="Wordtype" :options="$optionsWordtype" width2="4" attribute="readonly"/>
-            <x-laraknife.forms.text position="alone" name="usage" label="Usage" value="{{ $context->valueOf('usage') }}" width2="10" attribute="readonly" rows="3" />
             <x-laraknife.forms.combobox position="alone" name="verifiedby_id" label="Verifiedby" :options="$optionsVerifiedby" width2="4" attribute="readonly"/>
         </x-laraknife.panels.show>
     </form>