Skip to content

Commit

Permalink
Merge pull request #418 from nasirkhan/update
Browse files Browse the repository at this point in the history
Fixed File Brower issue
  • Loading branch information
nasirkhan authored May 14, 2023
2 parents 07ad7ff + 1cd3b39 commit 53771b9
Show file tree
Hide file tree
Showing 32 changed files with 2,189 additions and 555 deletions.
40 changes: 31 additions & 9 deletions Modules/Article/Resources/views/backend/posts/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@
<div class="input-group mb-3">
{{ html()->text($field_name)->placeholder($field_placeholder)->class('form-control')->attributes(["$required", 'aria-label'=>'Image', 'aria-describedby'=>'button-image']) }}
<div class="input-group-append">
<button class="btn btn-info" type="button" id="button-image"><i class="fas fa-folder-open"></i> @lang('Browse')</button>
<button class="btn btn-info" type="button" id="button-image" data-input="{{$field_name}}"><i class="fas fa-folder-open"></i> @lang('Browse')</button>
</div>
</div>
</div>
</div>
</div>

<div class="row mb-3">
<div class="col-4">
<div class="form-group">
Expand All @@ -99,7 +100,7 @@
{{ html()->select($field_name, isset($$module_name_singular)?optional($$module_name_singular->$field_relation)->pluck('name', 'id'):'')->placeholder($field_placeholder)->class('form-control select2-category')->attributes(["$required"]) }}
</div>
</div>
<div class="col-4">
<div class=" col-4">
<div class="form-group">
<?php
$field_name = 'type';
Expand Down Expand Up @@ -290,13 +291,30 @@
@push ('after-scripts')
<script type="module" src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.20/summernote-lite.min.js"></script>
<script type="module">
const FMButton = function(context) {
const ui = $.summernote.ui;
const button = ui.button({
// Define function to open filemanager window
var lfm = function(options, cb) {
var route_prefix = (options && options.prefix) ? options.prefix : '/laravel-filemanager';
window.open(route_prefix + '?type=' + options.type || 'file', 'FileManager', 'width=900,height=600');
window.SetUrl = cb;
};
// Define LFM summernote button
var LFMButton = function(context) {
var ui = $.summernote.ui;
var button = ui.button({
contents: '<i class="note-icon-picture"></i> ',
tooltip: 'File Manager',
tooltip: 'Insert image with filemanager',
click: function() {
window.open('/file-manager/summernote', 'fm', 'width=1000,height=800');
lfm({
type: 'image',
prefix: '/laravel-filemanager'
}, function(lfmItems, path) {
lfmItems.forEach(function(lfmItem) {
context.invoke('insertImage', lfmItem.url);
});
});
}
});
return button.render();
Expand All @@ -310,15 +328,19 @@
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'fm', 'video']],
['insert', ['link', 'lfm', 'video']],
['view', ['codeview', 'undo', 'redo', 'help']],
],
buttons: {
fm: FMButton
lfm: LFMButton
}
});
</script>

<script type="module" src="{{ asset('vendor/laravel-filemanager/js/stand-alone-button.js') }}"></script>
<script type="module">
$('#button-image').filemanager('image');
</script>

<script type="module">
$(document).ready(function() {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"type": "project",
"require": {
"php": "^8.1",
"alexusmai/laravel-file-manager": "^3.0",
"arcanedev/log-viewer": "^10.0",
"guzzlehttp/guzzle": "^7.5",
"hashids/hashids": "^5.0",
Expand All @@ -26,6 +25,7 @@
"spatie/laravel-html": "^3.2",
"spatie/laravel-medialibrary": "^10.7",
"spatie/laravel-permission": "^5.9",
"unisharp/laravel-filemanager": "^2.6",
"yajra/laravel-datatables-oracle": "^10.3"
},
"require-dev": {
Expand Down
Loading

0 comments on commit 53771b9

Please sign in to comment.