152 lines
5.6 KiB
Plaintext
152 lines
5.6 KiB
Plaintext
<% if @module_key == 'asset' %>
|
|
<style type="text/css">
|
|
.file-input.file-input-ajax-new {
|
|
display: block;
|
|
}
|
|
</style>
|
|
<% end %>
|
|
<h3><%= generate_breadcrumb %></h3>
|
|
<span class="btn-wrapper">
|
|
<a href="javascript:void(0)" class="download redirect_recycle_bin"><%=t('file_manager.recycle_bin')%></a>
|
|
</span>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<% if @display_module_name %>
|
|
<th><%= t("file_manager.module") %></th>
|
|
<% end %>
|
|
<th><%= t("file_manager.name") %></th>
|
|
<th><%= t("file_manager.size") %></th>
|
|
<th><%= t("file_manager.updated_at") %></th>
|
|
<% unless @only_select_folder %>
|
|
<th><%= t("file_manager.rename") %></th>
|
|
<th><%= t("file_manager.delete") %></th>
|
|
<th><%= t("download") %></th>
|
|
<th><%= t("file_manager.upload") %></th>
|
|
<th><%= t("file_manager.link") %></th>
|
|
<% end %>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @directory.each do |entry| %>
|
|
<% next if @relative_path.blank? && entry[:relative] == '..' %>
|
|
<tr>
|
|
<% if @display_module_name %>
|
|
<td class="module">
|
|
<%
|
|
module_info = @module_info_dict[entry[:module]]
|
|
module_title = (module_info ? module_info[:title] : nil)
|
|
%>
|
|
<% if module_title %>
|
|
<%= link_to(module_title, "javascript:void(0)", class: "module-key", data: {'key'=>entry[:module]}) %>
|
|
<% end %>
|
|
</td>
|
|
<% end %>
|
|
<td class="name">
|
|
<%= link_to "javascript:void(0)", class: entry[:type].to_s, data: {'entry'=>entry[:entry], 'id'=> entry[:id]} do %>
|
|
<%= fa_icon (entry[:type] == :file ? 'file' : 'folder') %>
|
|
<span class="filename"><%= entry[:entry] %></span>
|
|
<% end %>
|
|
</td>
|
|
<td class="size">
|
|
<%= entry[:size] %>
|
|
</td>
|
|
<td class="date">
|
|
<%= entry[:date] %>
|
|
</td>
|
|
<% unless @only_select_folder %>
|
|
<td>
|
|
<% if entry[:is_editable] && entry[:entry] != './' && entry[:entry] != '../' %>
|
|
<%= link_to 'javascript:void(0)', class: 'rename', onclick: "rename('#{entry[:id]}', '#{URI.decode(entry[:relative])}')" do %>
|
|
<%= fa_icon 'i-cursor' %> <%= t("file_manager.rename") %>
|
|
<% end %>
|
|
<% end %>
|
|
</td>
|
|
<td>
|
|
<% if entry[:is_editable] && entry[:entry] != './' && entry[:entry] != '../' %>
|
|
<%= link_to "javascript:void(0)", class: 'delete', data: { "tmp-confirm"=> "Are you sure you want to delete `#{URI.decode(entry[:relative])}`?", "link"=> admin_file_manager_path(entry[:id]) } do %>
|
|
<%= fa_icon 'trash' %> <%= t("file_manager.delete") %>
|
|
<% end %>
|
|
<% end %>
|
|
</td>
|
|
<td>
|
|
<% if entry[:id] && entry[:is_file] %>
|
|
<a class="download" href="/xhr/file_manager_download?id=<%=entry[:id]%>" title="<%= t("download") + ' ' + entry[:entry] %>" target="_blank"><%= fa_icon 'download' %> <%= t("download") %></a>
|
|
<% end %>
|
|
</td>
|
|
<td>
|
|
<div class="dropup upload-button">
|
|
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
|
|
<i class="icon-upload-alt icon-white"></i><%= t('file_manager.upload') %>
|
|
<span class="caret"></span>
|
|
</button>
|
|
<div class="dropdown-menu upload-box">
|
|
<form action="<%= upload_file_admin_file_manager_path(entry[:id]) %>" method="post" enctype="multipart/form-data" class="upload_form">
|
|
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
|
|
<input type="file" name="file" >
|
|
<input type="hidden" name="url" value="<%= request.fullpath %>">
|
|
<input type="hidden" name="type" value="update">
|
|
<button class="btn btn-primary" type="submit"><%= t(:submit) %></button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<div class="tooltip">
|
|
<button class="copyButton btn btn-success" class="input-group-addon btn" data-link="<%= entry[:absolute].sub('public', '') %>" data-prompt="<%= t("file_manager.copied") %>">
|
|
<span class="tooltiptext"><%= t("file_manager.copy_link") %></span>
|
|
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<%=
|
|
content_tag :div, class: "bottomnav clearfix" do
|
|
content_tag(:div, paginate(@uploads), class: "pagination pagination-centered")
|
|
end
|
|
%>
|
|
</section>
|
|
<script>
|
|
<% unless @disable_path_traversal %>
|
|
window.path_mode = "params";
|
|
window.use_params_request = true;
|
|
<% end %>
|
|
if (typeof(FormData) != typeof(undefined)) {
|
|
$('.upload_form').submit(function(evt){
|
|
evt.preventDefault();
|
|
var formData = new FormData(this);
|
|
formData.append('remote', true);
|
|
var tr = $(this).parents('tr').eq(0);
|
|
var file_link = tr.find('td.name a');
|
|
var size_td = tr.find('td.size');
|
|
var date_td = tr.find('td.date');
|
|
$.ajax({
|
|
url: $(this).attr('action'),
|
|
type: 'POST',
|
|
data: formData,
|
|
async: false,
|
|
cache: false,
|
|
contentType: false,
|
|
enctype: 'multipart/form-data',
|
|
processData: false,
|
|
success: function (data) {
|
|
file_link.attr('data-entry', data.filename);
|
|
file_link.data('entry', data.filename);
|
|
file_link.attr('data-id', data.id);
|
|
file_link.data('id', data.id);
|
|
file_link.find('.filename').text(data.filename);
|
|
size_td.text(data.size);
|
|
date_td.text(data.date);
|
|
}
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
}
|
|
|
|
</script> |