-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7305eb0
commit d752416
Showing
8 changed files
with
91 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 51 additions & 2 deletions
53
src/Clastic/MediaBundle/Resources/public/scripts/form.wysiwyg.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,54 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
(function($) { | ||
$('textarea.wysiwyg').on('ckeditor-config', function(el, config) { | ||
config.filebrowserBrowseUrl = '/admin/elfinder/default'; | ||
}); | ||
})(); | ||
|
||
$('.file_browser_container').each(function() { | ||
var $container = $(this); | ||
var $el = $container.find('input'); | ||
var $finder = $container.find('.finder'); | ||
var $img = $container.find('img.preview'); | ||
var $imgCaption = $container.find('.caption'); | ||
|
||
var sync = function() { | ||
var val = $el.val(); | ||
$img.attr('src', val); | ||
if (!$img.attr('src')) { | ||
$img.hide(); | ||
} else { | ||
$img.show(); | ||
} | ||
$imgCaption.html(val); | ||
}; | ||
var setValue = function(val) { | ||
$el.val(val); | ||
sync(); | ||
}; | ||
|
||
sync(); | ||
|
||
$container | ||
.on('click', 'button.select', function() { | ||
if ($finder.hasClass('elfinder')) { | ||
$finder.elfinder('open'); | ||
} else { | ||
$finder | ||
.elfinder({ | ||
url : '/admin/efconnect', | ||
getFileCallback: function(file) { | ||
setValue('/'+file.path); | ||
sync(); | ||
$finder.elfinder('close'); | ||
} | ||
}) | ||
.elfinder($el.attr('id')); | ||
} | ||
}) | ||
.on('click', 'button.unselect', function() { | ||
setValue(''); | ||
sync(); | ||
}) | ||
}); | ||
})(jQuery); |
49 changes: 7 additions & 42 deletions
49
src/Clastic/MediaBundle/Resources/public/styles/style.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,10 @@ | ||
.media-browser { | ||
position: relative; | ||
.add { | ||
position: absolute; | ||
right: 0; | ||
z-index: 999; | ||
a { | ||
float: right; | ||
padding: 5px 10px; | ||
font-size: 20px; | ||
} | ||
.form { | ||
display: none; | ||
width: 100%; | ||
background-color: #fff; | ||
padding: 10px; | ||
} | ||
.file_browser_container { | ||
.preview-container { | ||
height: 250px; | ||
width: 200px; | ||
} | ||
|
||
.row > div { | ||
min-height: 400px; | ||
padding: 20px; | ||
} | ||
|
||
.files li { | ||
float: left; | ||
width: 100px; | ||
list-style: none; | ||
margin: 10px; | ||
padding: 10px; | ||
&:hover { | ||
background-color: #eee; | ||
} | ||
.icon { | ||
text-align: center; | ||
font-size: 50px; | ||
} | ||
.name { | ||
text-align: center; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
img { | ||
max-height: 200px; | ||
max-width: 200px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
module.exports = function() { | ||
'use strict'; | ||
return []; | ||
return [ | ||
new global.Clastic.GulpScript('web/assets/jquery-ui/jquery-ui.min.js', 'vendor', {weight: 10}), | ||
new global.Clastic.GulpScript('web/assets/elfinder/js/elfinder.min.js', 'vendor', {weight: 11}) | ||
]; | ||
}; |