download fixes

This commit is contained in:
Mark Gregory
2026-10-12 10:18:16 +01:00
parent 9ae51ada72
commit 259b1eac12
4 changed files with 2 additions and 4 deletions
@@ -5,8 +5,8 @@
@if(session('status'))<div class="distribution-notice" role="status">{{ session('status') }}</div>@endif
@if($errors->any())<div class="distribution-errors" role="alert"><strong>Please correct the following:</strong><ul>@foreach($errors->all() as $error)<li>{{ $error }}</li>@endforeach</ul></div>@endif
<div class="distribution-summary"><div><span>Total products</span><strong>{{ $products->count() }}</strong></div><div><span>Published</span><strong>{{ $products->where('is_published', true)->count() }}</strong></div><div><span>Drafts</span><strong>{{ $products->where('is_published', false)->count() }}</strong></div><div><span>Total downloads</span><strong>{{ number_format($products->sum('download_count')) }}</strong></div></div>
<section class="admin-table-card distribution-table"><div class="admin-table-title"><div><h2>Product catalogue</h2><p>Publish or unpublish products instantly, or edit their details.</p></div><a class="btn btn-primary" href="#new-product">+ Add product</a></div><div class="table-scroll"><table class="pro-table"><thead><tr><th>Product</th><th>Version / Platform</th><th>Downloads</th><th>Status</th><th style="text-align:right">Actions</th></tr></thead><tbody>
@forelse($products as $product)<tr><td><strong>{{ $product->name }}</strong><small>{{ \Illuminate\Support\Str::limit($product->description ?: $product->original_filename, 70) }}</small></td><td><strong>{{ $product->version ?: '—' }}</strong><small>{{ $product->platform ?: 'Unspecified' }} · {{ $product->formatted_size }}</small></td><td>{{ number_format($product->download_count) }}</td><td><span class="status-chip {{ $product->is_published ? 'success' : 'muted' }}">{{ $product->is_published ? 'Published' : 'Draft' }}</span></td><td><div class="distribution-row-actions"><a href="#edit-product-{{ $product->id }}" class="dist-action">Edit</a><form method="post" action="{{ route('admin.download-products.publication', $product) }}">@csrf @method('PATCH')<input type="hidden" name="is_published" value="{{ $product->is_published ? '0' : '1' }}"><button type="submit" class="dist-action {{ $product->is_published ? 'dist-unpublish' : 'dist-publish' }}">{{ $product->is_published ? 'Unpublish' : 'Publish' }}</button></form></div></td></tr>
<section class="admin-table-card distribution-table"><div class="admin-table-title"><div><h2>Product catalogue</h2><p>Publish or unpublish products instantly, or edit their details.</p></div><button class="btn btn-primary" type="button" onclick="const panel=document.getElementById('new-product');panel.open=true;panel.scrollIntoView({behavior:'smooth',block:'start'});">+ Add product</button></div><div class="table-scroll"><table class="pro-table"><thead><tr><th>Product</th><th>Version / Platform</th><th>Downloads</th><th>Status</th><th style="text-align:right">Actions</th></tr></thead><tbody>
@forelse($products as $product)<tr><td><strong>{{ $product->name }}</strong><small>{{ \Illuminate\Support\Str::limit($product->description ?: $product->original_filename, 70) }}</small></td><td><strong>{{ $product->version ?: '—' }}</strong><small>{{ $product->platform ?: 'Unspecified' }} · {{ $product->formatted_size }}</small></td><td>{{ number_format($product->download_count) }}</td><td><span class="status-chip {{ $product->is_published ? 'success' : 'muted' }}">{{ $product->is_published ? 'Published' : 'Draft' }}</span></td><td><div class="distribution-row-actions"><button type="button" class="dist-action" onclick="const panel=document.getElementById('edit-product-{{ $product->id }}');panel.open=true;panel.scrollIntoView({behavior:'smooth',block:'start'});">Edit</button><form method="post" action="{{ route('admin.download-products.publication', $product) }}">@csrf @method('PATCH')<input type="hidden" name="is_published" value="{{ $product->is_published ? '0' : '1' }}"><button type="submit" class="dist-action {{ $product->is_published ? 'dist-unpublish' : 'dist-publish' }}">{{ $product->is_published ? 'Unpublish' : 'Publish' }}</button></form></div></td></tr>
@empty<tr><td colspan="5" class="empty-cell">No additional products yet. Add your first installer below.</td></tr>@endforelse
</tbody></table></div></section>
<details class="distribution-panel" id="new-product" @if($errors->any() && !old('_method')) open @endif><summary><span><strong>Add a new product</strong><small>Upload an installer and choose whether to publish it.</small></span><span class="dist-chevron">+</span></summary><form class="distribution-form" method="post" action="{{ route('admin.download-products.store') }}" enctype="multipart/form-data">@csrf<div class="form-grid"><label>Product name<input name="name" value="{{ old('name') }}" required maxlength="150" placeholder="e.g. SonarDesk CLI"></label><label>Version<input name="version" value="{{ old('version') }}" maxlength="80" placeholder="e.g. 2.1.0"></label><label>Platform<input name="platform" value="{{ old('platform') }}" maxlength="120" placeholder="macOS, Windows, Linux…"></label></div><label>Description<textarea name="description" rows="3" maxlength="3000" placeholder="Describe what this product does">{{ old('description') }}</textarea></label><label class="distribution-file">Installer / package <small>Maximum 1 GB</small><input type="file" name="package" required></label><label class="distribution-check"><input type="checkbox" name="is_published" value="1" @checked(old('is_published'))><span><strong>Publish immediately</strong><small>Make this download available on the public page.</small></span></label><button class="btn btn-primary" type="submit">Add product</button></form></details>
@@ -6,8 +6,6 @@
@if($products->isNotEmpty())
<section class="distribution-catalogue"><div class="download-shell"><div class="section-heading"><span class="eyebrow">Software catalogue</span><h2>More downloads</h2><p>Additional tools and installers available from our team.</p></div><div class="distribution-product-grid">@foreach($products as $product)<article class="distribution-product-card"><div class="distribution-product-top"><span class="distribution-platform">{{ $product->platform ?: 'Software' }}</span><span class="distribution-version">{{ $product->version ? 'v'.$product->version : 'Latest' }}</span></div><div class="distribution-product-icon" aria-hidden="true">↓</div><h3>{{ $product->name }}</h3><p>{{ $product->description ?: 'Download the latest available package.' }}</p><div class="distribution-product-footer"><span>{{ $product->formatted_size }}</span><a class="btn btn-primary" href="{{ route('download.product',$product) }}" aria-label="Download {{ $product->name }}">Download →</a></div></article>@endforeach</div></div></section>
@endif
<section class="release-history"><div class="download-shell"><div class="section-heading"><span class="eyebrow">More downloads</span><h2>Other products</h2><p>Explore our other available software and downloads.</p></div><div class="release-history-list">@foreach($products as $product)<article><div><strong>{{ $product->name }}@if($product->version) {{ $product->version }}@endif</strong><span>{{ $product->description }}</span>@if($product->platform)<span>{{ $product->platform }}</span>@endif</div><div><span>{{ $product->formatted_size }}</span><a href="{{ route('download.product',$product) }}">Download</a></div></article>@endforeach</div></div></section>
@endif
<section class="release-history"><div class="download-shell"><div class="section-heading"><span class="eyebrow">Release archive</span><h2>Previous versions</h2><p>Published SonarDesk builds remain available here for customers who need a previous release.</p></div><div class="release-history-list">@forelse($releases as $release)<article><div><strong>SonarDesk {{ $release->version }}</strong><span>Build {{ $release->build_number }} · {{ ucfirst($release->channel) }} · {{ $release->published_at?->format('j M Y') }}</span></div><div><span>{{ $release->formatted_size }}</span><a href="{{ route('download.release',$release) }}">Download</a></div></article>@empty<p>No published releases are available yet.</p>@endforelse</div>{{ $releases->links() }}</div></section>
<section class="download-support"><div class="download-shell"><div><span class="eyebrow">Support</span><h2>Installation or activation help?</h2><p>{{ $settings['support_text'] }}</p></div><a class="btn btn-secondary" href="{{ route('support') }}">Contact SonarDesk support</a></div></section></main>
@endsection
View File
Executable → Regular
View File