Initial commit
This commit is contained in:
9
resources/views/submissions/create.blade.php
Normal file
9
resources/views/submissions/create.blade.php
Normal file
@@ -0,0 +1,9 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('page-title', "Submit - " . config('app.name') )
|
||||
|
||||
@section('content')
|
||||
{{ \Diglactic\Breadcrumbs\Breadcrumbs::render() }}
|
||||
<div class="page-title">{{ $words['page_title'] }}</div>
|
||||
@include('submissions.form')
|
||||
@endsection
|
||||
9
resources/views/submissions/edit.blade.php
Normal file
9
resources/views/submissions/edit.blade.php
Normal file
@@ -0,0 +1,9 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('page-title', "Edit $entry->title - " . config('app.name') )
|
||||
|
||||
@section('content')
|
||||
{{ \Diglactic\Breadcrumbs\Breadcrumbs::render() }}
|
||||
<div class="page-title">{{ $words['page_title'] }}</div>
|
||||
@include('submissions.form')
|
||||
@endsection
|
||||
172
resources/views/submissions/form.blade.php
Normal file
172
resources/views/submissions/form.blade.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/** @var \App\Models\Modification $modif */
|
||||
/** @var \App\Models\Status $status */
|
||||
?>
|
||||
|
||||
{{-- Pushed in header. --}}
|
||||
@push('styles')
|
||||
<meta name="fs-section" content="{{ $section }}">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="submission-has-errors" content="{{ $errors->any() ? '1' : '0' }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
@vite('resources/js/submissions.js')
|
||||
@endpush
|
||||
|
||||
{{-- Server side errors summary --}}
|
||||
@if($errors->any())
|
||||
@foreach( $errors->all() as $error )
|
||||
<x-form-error-text message="{{ $error }}" />
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
<div class="block">
|
||||
<form action="{{ $isEdit ? route('submit.update', [ $section, $entry->id ] ) : route('submit.store', $section ) }}"
|
||||
method="POST" x-data="Submission()" x-init="init()" @submit.prevent="submitForm($event)">
|
||||
@include('submissions.fs-upload')
|
||||
|
||||
<!-- ABOUT THE ENTRY -->
|
||||
<x-form-group-title label="{{ $words['about_the'] }}" icon="puzzle" />
|
||||
|
||||
@if( section_must_not_be( 'translations', $section ) )
|
||||
<div class="form-group">
|
||||
<x-form-field-title name="{{ $words['entry_title'] }}" required="true" />
|
||||
<input class="form-input" type="text" name="entry_title" value="{{ old('entry_title', $entry->title ?? '' ) }}" required>
|
||||
@error('entry_title')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
</div>
|
||||
@else
|
||||
<div class="form-group">
|
||||
<x-form-field-title name="{{ $words['entry_title'] }}" helper="{{ $words['entry_title_helper'] }}" />
|
||||
<input class="form-input" type="text" name="entry_title" value="{{ old('entry_title', $entry->title, '' ) }}">
|
||||
@error('entry_title')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if( section_must_be( 'romhacks', $section ) )
|
||||
<div class="form-group">
|
||||
<x-form-field-title name="{{ $words['type_of_hack'] }}" required="true" />
|
||||
<div class="form-type-of-checkboxes form-group level" id="modifications-group" x-ref="modificationsGroup">
|
||||
@foreach( $modifications as $modif )
|
||||
<label><input class="form-checkbox" type="checkbox" name="modifications[]" value="{{ $modif->id }}" {{ in_array($modif->id, $oldModifications) ? 'checked' : '' }}>{{ $modif->name }}</label>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="form-error-text" x-show="errorKey === 'noModifications'" x-text="errorMessage"></div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if( section_must_be( ['romhacks', 'translations'], $section ) )
|
||||
<div class="form-group grid-c3">
|
||||
<div>
|
||||
<x-form-field-title name="{{ $words['version'] }}" required="true" />
|
||||
<input class="form-input" type="text" name="version" value="{{ old( 'version', $entry->version ?? '' ) }}" required>
|
||||
</div>
|
||||
<div>
|
||||
<x-form-field-title name="{{ $words['release_date'] }}" helper="{{ $words['release_date_helper'] }}" required="true" />
|
||||
{{-- TODO: Add max to the date --}}
|
||||
<input type="date" class="form-input" name="release-date" value="{{ old('release-date') ?? $entry->release_date?->format('Y-m-d') ?? '' }}" required>
|
||||
</div>
|
||||
<div>
|
||||
<x-form-field-title name="{{ $words['status'] }}" required="true" />
|
||||
<div class="form-status-radio form-group level">
|
||||
@foreach( $statuses as $status )
|
||||
<label><input class="form-radio" type="radio" name="status" value="{{ $status->id }}" {{ old('status', $entry->status_id ) == $status->id ? 'checked' : '' }} required>{{ $status->name }}</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if( section_must_be( 'translations', $section ) )
|
||||
<x-form-field-title name="Languages" required="true" />
|
||||
<x-languages-selector :selected="$oldLanguages" />
|
||||
@endif
|
||||
|
||||
<div class="form-group" x-ref="descriptionField">
|
||||
<x-form-field-title name="{{ $words['description'] }}" required="true" />
|
||||
<x-markdown-textarea name="description" value="{{ old('description', $entry->description ?? '') }}" />
|
||||
<div class="form-error-text" x-show="errorKey === 'noDescription'" x-text="errorMessage"></div>
|
||||
@error('description')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<x-form-group-title label="{{ $words['about_game'] }}" icon="gamepad-2" />
|
||||
<div x-ref="gameSelector">
|
||||
<livewire:game-selector
|
||||
:game-id="old('game_id', $entry->game_id ?? null )"
|
||||
:new-game-title="old('new-game-title')"
|
||||
:new-game-platform="old('new-game-platform')"
|
||||
:new-game-genre="old('new-game-genre')"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-error-text" x-show="errorKey === 'noGame'" x-text="errorMessage"></div>
|
||||
@error('game_id')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
@error('new-game-title')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
@error('new-game-platform')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
@error('new-game-genre')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
<livewire:hashes-upload :old-hashes="old('hashes', $entry->hashes->toArray(), [])" />
|
||||
|
||||
@if( section_must_not_be( 'translations', $section ) )
|
||||
<x-form-field-title name="Languages" required="true" />
|
||||
<x-languages-selector :selected="$oldLanguages" />
|
||||
@error('languages')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
@error('languages.*')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
@endif
|
||||
|
||||
<x-form-group-title label="{{ $words['attachments'] }}" icon="paperclip" />
|
||||
<x-main-image-field :old-path="old('main-image', $entry->main_image ?? '')" />
|
||||
<x-gallery-field :old-paths="old('gallery', $entry->gallery->pluck('image')->toArray() ?? [] )"/>
|
||||
@error('gallery')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
@error('gallery.*')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
|
||||
<x-form-group-title label="{{ $words['authors'] }}" icon="users" />
|
||||
<livewire:authors-selector :old-authors="old('authors', $entry->authors->map(fn($a) => ['id' => $a->id, 'name' => $a->name ])->toArray() ?? [])" :old-new-authors="old('new-authors', [])" />
|
||||
@error('authors')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
@error('new-authors')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
<x-staff-credits-field :old-staff-credits="old('staff_credits', $entry->staff_credits ?? null)" />
|
||||
|
||||
<x-form-group-title label="{{ $words['related_links'] }}" icon="link" />
|
||||
<div class="form-group grid-c2">
|
||||
<div>
|
||||
<x-form-field-title name="{{ $words['release_site'] }}" helper="{{ $words['release_site_helper'] }}" required="" />
|
||||
<input class="form-input" type="url" name="release_site" value="{{ old( 'release_site', $entry->relevant_link ?? '' ) }}">
|
||||
</div>
|
||||
<div>
|
||||
<x-form-field-title name="{{ $words['youtube_video'] }}" required="" />
|
||||
<input class="form-input" type="url" name="youtube_video" value="{{ old( 'youtube_video', $entry->youtube_link ?? '' ) }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@csrf
|
||||
|
||||
<div class="submit">
|
||||
<x-submit-entry-status :section="$section" />
|
||||
<button id="submit-button" type="submit" class="btn primary" style="padding:1%;">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
69
resources/views/submissions/fs-upload.blade.php
Normal file
69
resources/views/submissions/fs-upload.blade.php
Normal file
@@ -0,0 +1,69 @@
|
||||
{{-- File Server uploader import --}}
|
||||
<div class="form-group level" x-data="FSUploader()" x-init="init(@js($oldFilesArray))">
|
||||
|
||||
<x-form-group-title label="Download Files" icon="upload-cloud" />
|
||||
<div class="form-group">
|
||||
<x-form-field-title name="Files" helper="test" required="true" />
|
||||
<div class="form-upload" x-ref="uploadTarget" :class="{ 'disabled': isUploading }">
|
||||
<input type="file" multiple :disabled="isUploading" @change="handleSubmitFile($event)">
|
||||
<div class="form-upload-placeholder level">
|
||||
<i data-lucide="file-archive" size="36" style="margin-bottom:15px;color:var(--text2)"></i>
|
||||
<div style="font-size: 1.1rem;color:var(--text);margin-bottom:5px;">
|
||||
Click or drag'n drop files here.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<x-form-error-text message="Don't submit ROMs" />
|
||||
|
||||
{{-- Client-side Errors --}}
|
||||
<div class="form-error-text" x-show="errorKey === 'noFiles' || errorKey === 'uploadError' || errorKey === 'notAllFilesDone'" x-text="errorMessage"></div>
|
||||
|
||||
{{-- Server-side Errors --}}
|
||||
@error('file_ids')
|
||||
<x-form-error-text message="{{ $message }}" />
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
{{--
|
||||
File listing. Used for editions or server-side errors.
|
||||
--}}
|
||||
<div class="upload-list" x-show="numberOfFiles > 0" x-cloak>
|
||||
<template x-for="(file,i) in files" :key="i">
|
||||
<div class="upload-item" :class="
|
||||
{
|
||||
'upload-item-uploading': !file.done && !file.error,
|
||||
'upload-item-done': file.done,
|
||||
'upload-item-error': file.error
|
||||
}">
|
||||
<template x-if="!file.done && !file.error">
|
||||
<i data-lucide="loader-2" class="spin"></i>
|
||||
</template>
|
||||
<template x-if="file.done">
|
||||
<i data-lucide="check-circle"></i>
|
||||
</template>
|
||||
<template x-if="file.error">
|
||||
<i data-lucide="alert-circle"></i>
|
||||
</template>
|
||||
|
||||
<div class="upload-item-info">
|
||||
<span class="upload-item-name" x-text="file.name"></span>
|
||||
<div class="progress" x-show="!file.done && !file.error">
|
||||
<div class="progress-bar" :style="{width: file.progressValue + '%' }">
|
||||
<span class="progress-bar-label" x-text="file.progressValue + '% - chunk' + file.currentChunk + ' / ' + file.totalChunks"></span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="upload-item-error" x-show="file.error" x-text="file.error"></span>
|
||||
</div>
|
||||
<div class="upload-item-actions">
|
||||
<button type="button" class="btn" x-show="file.error" @click="handleRetryFile(i)">
|
||||
<i data-lucide="refresh-cw"></i>
|
||||
</button>
|
||||
<button type="button" class="btn" x-show="file.done || file.error" @click="handleRemoveFile(i)">
|
||||
<i data-lucide="x"></i>
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" name="files_uuid[]" :value="file.uuid" x-show="file.done">
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
Reference in New Issue
Block a user