-
entries = {:folder => [], :file => []}
-
slider_class = ‘slider-%s’ % fullpath.hash
-
Dir.foreach(fullpath).reject {|e| [‘.’, ‘..’].include?(e)}.each do |entry|
-
path = path_array + [entry]
-
fullpath = File.join(root, *path)
-
active = given.location[0..path.size-1] == path
-
entry = [File.join(*path), entry, active]
-
if File.file?(fullpath)
-
entries << entry
-
-
elsif File.directory?(fullpath)
-
entries << entry
-
-
-
[:folder, :file].each do |type|
-
entries.each do |(path, name, active)|
-
dom_id = ‘context_menu-%s’ % path.__id__
-
dirname = File.dirname(path)
-
classes = [‘draggable’, ‘context_menu’]
-
classes << ‘droppable’ if type == :folder
-
classes << ‘active_entry’ if active
-
attrs = {class: classes, ‘data-path’ => path}
-
attrs = “$(‘#%s’).modal().css({width: ‘%spx’}); return false;” % [dom_id, 360]
div *attrs
- url = type == :folder ? \ parent_route(location: path) : \ parent_route(location: given.location[:URL], file: path) - if type == :file && image?(name) a.entry href=route(:image, image: path) class=([:preview, slider_class]) - else span.entry class=type a href=url data-type=type data-path=dirname data-name=name = name
.modal.hide.fade id=dom_id
.modal-body p .input-append - input_id = 'rename_' + dom_id - attrs = {id: input_id, type: :text, value: name} - attrs['data-path'] = File.dirname(path) - attrs['data-name'] = name input.input-large.input-rename *attrs a.btn.btn-info onclick=("ELFinder.rename('#%s');" % input_id) href="javascript:void(null);" i.entry class=type | Rename p a.btn.btn-block href=url i.icon-search | Open - if type == :file p - onclick = "ELFinder.download('%s', '%s');" % [dirname, name] a.btn.btn-block href="#" onclick=onclick i.icon-download-alt | Download p - onclick = "ELFinder.delete('%s', '%s', '%s');" % [type, dirname, name] a.btn.btn-warning.btn-block href="#" onclick=onclick i.icon-trash | Delete
-
-
.droppable data-path=path_array.join(‘/’) style=“height: 20em;”