Skip to content

Commit b768dac

Browse files
committed
基本功能完成
1 parent 9a03383 commit b768dac

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "An extension of laravel-admin for uploading large files",
44
"type": "library",
55
"keywords": ["laravel-admin", "extension"],
6-
"homepage": "https://github.com/laravel-admin-ext/large-file-upload",
6+
"homepage": "https://github.com/Dianwoung/large-file-upload",
77
"license": "MIT",
88
"authors": [
99
{

resources/assets/js/aetherupload.admin.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ var AetherUpload = {
208208
form.append("sub_dir", this.subDir);
209209

210210
form.append("locale", this.locale);
211-
console.log(form);
212211

213212
$.ajax({
214213

@@ -370,5 +369,5 @@ function aetherupload(name, file, group) {
370369
}
371370

372371
function getPath(){
373-
console.log(this.savedPath.substr(this.savedPath.lastIndexOf('/') + 1));
372+
//this.savedPath.substr(this.savedPath.lastIndexOf('/') + 1));
374373
}

resources/views/large_file_upload.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@include('admin::form.error')
77

88
<div class="controls" id="aetherupload-wrapper-{{$name}}">
9-
<input type="file" id="{{$name}}-file" data-filename-placement="inside" class="file-inputs" onchange="aetherupload('{{$name}}', this, 'file').success(getPath).upload('{{$name}}')"/>
9+
<input type="file" id="{{$name}}-file" data-filename-placement="inside" class="file-inputs"/>
1010
<div class="progress " style="height: 10px;margin-bottom: 2px;margin-top: 10px;width: 200px;">
1111
<div id="{{$name}}-progressbar" style="background:blue;height:6px;width:0;"></div>
1212
</div>

src/LargeFileField.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
class LargeFileField extends Field
77
{
88

9-
public $view = __DIR__.'/../resources/views/large_file_upload.blade.php';
9+
public $view = 'large-file-field::large_file_upload';
1010

1111
public function render()
1212
{
1313
$name = $this->formatName($this->column);
1414

1515
$this->script = <<<SRC
1616
17-
$('#{$name}-file').bootstrapFileInput();
17+
$('#{$name}-file').bootstrapFileInput();
18+
$('#{$name}-file').change(function(){
19+
aetherupload('{$name}', this, 'file').success(getPath).upload('{$name}');
20+
});
1821
1922
SRC;
2023
return parent::render();

src/LargeFileUploadServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public function boot(LargeFileUpload $extension)
2323
);
2424
}
2525

26+
if ($views = $extension->views()) {
27+
$this->loadViewsFrom($views, 'large-file-field');
28+
}
29+
2630
Admin::booting(function (){
2731
Admin::js('vendor/laravel-admin-ext/large-file-upload/js/aetherupload.admin.js');
2832
Admin::js('vendor/laravel-admin-ext/large-file-upload/js/bootstrap.file-input.js');

0 commit comments

Comments
 (0)