Skip to content

Commit a56a28f

Browse files
committed
ZIP Exports: Built out initial import view
Added syles for non-custom, non-image file inputs. Started planning out back-end handling.
1 parent 4051d5b commit a56a28f

File tree

4 files changed

+62
-15
lines changed

4 files changed

+62
-15
lines changed

app/Exports/Controllers/ImportController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ public function __construct()
1414

1515
public function start(Request $request)
1616
{
17+
// TODO - Show existing imports for user (or for all users if admin-level user)
18+
1719
return view('exports.import');
1820
}
1921

2022
public function upload(Request $request)
2123
{
22-
// TODO
24+
// TODO - Read existing ZIP upload and send through validator
25+
// TODO - If invalid, return user with errors
26+
// TODO - Upload to storage
27+
// TODO - Store info/results from validator
28+
// TODO - Send user to next import stage
2329
}
2430
}

lang/en/entities.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
'default_template_explain' => 'Assign a page template that will be used as the default content for all pages created within this item. Keep in mind this will only be used if the page creator has view access to the chosen template page.',
4545
'default_template_select' => 'Select a template page',
4646
'import' => 'Import',
47+
'import_validate' => 'Validate Import',
4748

4849
// Permissions and restrictions
4950
'permissions' => 'Permissions',

resources/sass/_forms.scss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,43 @@ input[type=color] {
545545
outline: 1px solid var(--color-primary);
546546
}
547547

548+
.custom-simple-file-input {
549+
max-width: 100%;
550+
border: 1px solid;
551+
@include lightDark(border-color, #DDD, #666);
552+
border-radius: 4px;
553+
padding: $-s $-m;
554+
}
555+
.custom-simple-file-input::file-selector-button {
556+
background-color: transparent;
557+
text-decoration: none;
558+
font-size: 0.8rem;
559+
line-height: 1.4em;
560+
padding: $-xs $-s;
561+
border: 1px solid;
562+
font-weight: 400;
563+
outline: 0;
564+
border-radius: 4px;
565+
cursor: pointer;
566+
margin-right: $-m;
567+
@include lightDark(color, #666, #AAA);
568+
@include lightDark(border-color, #CCC, #666);
569+
&:hover, &:focus, &:active {
570+
@include lightDark(color, #444, #BBB);
571+
border: 1px solid #CCC;
572+
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.1);
573+
background-color: #F2F2F2;
574+
@include lightDark(background-color, #f8f8f8, #444);
575+
filter: none;
576+
}
577+
&:active {
578+
border-color: #BBB;
579+
background-color: #DDD;
580+
color: #666;
581+
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
582+
}
583+
}
584+
548585
input.shortcut-input {
549586
width: auto;
550587
max-width: 120px;

resources/views/exports/import.blade.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,30 @@
55
<div class="container small">
66

77
<main class="card content-wrap auto-height mt-xxl">
8-
<div class="grid half left-focus v-end gap-m wrap">
9-
<div>
10-
<h1 class="list-heading">{{ trans('entities.import') }}</h1>
11-
<p class="text-muted mb-s">
12-
TODO - Desc
13-
{{-- {{ trans('entities.permissions_desc') }}--}}
14-
</p>
15-
</div>
16-
</div>
8+
<h1 class="list-heading">{{ trans('entities.import') }}</h1>
179
<form action="{{ url('/import') }}" method="POST">
1810
{{ csrf_field() }}
19-
<div class="flex-container-row justify-flex-end">
20-
<div class="form-group mb-m">
21-
@include('form.checkbox', ['name' => 'images', 'label' => 'Include Images'])
22-
@include('form.checkbox', ['name' => 'attachments', 'label' => 'Include Attachments'])
11+
<div class="flex-container-row justify-space-between wrap gap-x-xl gap-y-s">
12+
<p class="flex min-width-l text-muted mb-s">
13+
Import content using a portable zip export from the same, or a different, instance.
14+
Select a ZIP file to import then press "Validate Import" to proceed.
15+
After the file has been uploaded and validated you'll be able to configure & confirm the import in the next view.
16+
</p>
17+
<div class="flex-none min-width-l flex-container-row justify-flex-end">
18+
<div class="mb-m">
19+
<label for="file">Select ZIP file to upload</label>
20+
<input type="file"
21+
accept=".zip,application/zip,application/x-zip-compressed"
22+
name="file"
23+
id="file"
24+
class="custom-simple-file-input">
25+
</div>
2326
</div>
2427
</div>
2528

2629
<div class="text-right">
2730
<a href="{{ url('/books') }}" class="button outline">{{ trans('common.cancel') }}</a>
28-
<button type="submit" class="button">{{ trans('entities.import') }}</button>
31+
<button type="submit" class="button">{{ trans('entities.import_validate') }}</button>
2932
</div>
3033
</form>
3134
</main>

0 commit comments

Comments
 (0)