Repository URL to install this package:
|
Version:
0.9.0 ▾
|
- 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[:path_array][0..path.size-1] == path
- entry = [File.join(*path), entry, active]
- if File.file?(fullpath)
- entries[:file] << entry
- elsif File.directory?(fullpath)
- entries[:folder] << entry
- [:folder, :file].each do |type|
- entries[type].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
- oncontextmenu = "$('#%s').modal().css({width: '%spx'}); return false;" % [dom_id, 360]
div class=classes data-path=path oncontextmenu==oncontextmenu
- 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;"