Repository URL to install this package:
|
Version:
0.9.0 ▾
|
== js_tag(src: route(:assets, 'fileupload'), suffix: ASSETS_EXT)
- http_path = EUtils.normalize_path(params[:path].to_s).gsub(/\A\/+/, '')
- real_path = File.expand_path(http_path, @root)
javascript:
$(function(){
$('.img').tooltip();
$('.slider').colorbox({rel: 'slider', width: '80%', height: '80%'});
$('.slider-modal').colorbox({rel: 'slider-modal', width: '80%', height: '80%'});
});
function reload_tree() {
$.get(
'#{route(:browser__tree, params)}',
function(r) { $('#tree').html(r) }
);
}
function reload_files() {
$.get(
'#{route(:browser__files, params.merge(path: http_path))}',
function(r) { $('#files').html(r) }
);
}
function delete_file(file) {
$.ajax({
type: 'GET',
url: '#{ route(:browser__delete, params) }',
data: {file: file},
complete: function(xhr, txtResponse) {
if(txtResponse == 'success') {
reload_tree();
reload_files();
} else alert(xhr.responseText);
}
});
}
function fileupload_callback() { reload_tree(); reload_files(); }
.well.well-small
span.btn.fileinput-button style="margin-top: -5px;"
- url = route(:browser__upload, params.merge(path: http_path))
input#fileupload type="file" name="files[]" multiple=true data-url=url
i.icon-upload
| upload
a = File.basename(@root)
| /
- http_path.split(/\/+/).each do |d|
a = d
span.separator
| /
p
small.text-info DoubleClick on image to select it. Or RightClick and choose "Select"
ul.thumbnails
- files = Pathname.new(real_path).children.select {|e| e.file? && browseable?(e)}
- files.each do |file|
- name = File.basename(file)
- path = file.sub(@root_regexp, '').to_s
- src = route(:browser__image, params.merge(image: path))
- url = File.join(params[:prefix].to_s, path)
- values = [params[:CKEditorFuncNum].to_s, url].map {|s| escape_html(s)}
- select = "window.opener.CKEDITOR.tools.callFunction(%s, '%s'); window.close();" % values
li.span2
.thumbnail.img.context_menu title=name data-toggle="context" data-target=('#context_menu-%s' % path.__id__)
- classes = [:small]
- if image?(file)
- classes << :slider
- href = src
img src=src ondblclick=select
- else
- href = '#'
img src=route(:assets, 'icons/Oxygen/video.png%s' % ASSETS_EXT)
div.text-center
a class=classes href=href title=name
= shorten name
div id=('context_menu-%s' % path.__id__)
ul.dropdown-menu
li
a href='#' onclick=select
i.icon-ok
| Select
li.divider
li
a.slider-modal href=src title=name
i.icon-zoom-in
| Open
li.divider
li
a href="#" onclick="if(confirm('This action can not be undone! Continue?')) delete_file('#{path}');"
i.icon-trash
| Delete