file-manager/app/views/admin/file_managers/module.html.erb

90 lines
4.0 KiB
Plaintext

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag 'file_manager/default_theme', media: 'all' %>
<%= stylesheet_link_tag 'file_manager/application', media: 'all' %>
<%= stylesheet_link_tag "bootstrap-fileinput/css/fileinput.min" %>
<%= stylesheet_link_tag "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.min.css", :crossorigin => "anonymous" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag 'file_manager/application' %>
<%= javascript_include_tag "file-upload/tmpl.min.js" %>
<%= javascript_include_tag "file-upload/load-image.min.js" %>
<%= javascript_include_tag "file-upload/canvas-to-blob.min.js" %>
<%= javascript_include_tag "file-upload/jquery.iframe-transport.js" %>
<%= javascript_include_tag "file-upload/drop-zone.js" %>
<%= javascript_include_tag "bootstrap-fileinput/js/plugins/piexif.min" %>
<%= javascript_include_tag "bootstrap-fileinput/js/plugins/sortable.min" %>
<%= javascript_include_tag "bootstrap-fileinput/js/fileinput.min" %>
<%= javascript_include_tag "bootstrap-fileinput/js/locales/#{I18n.locale}" %>
<% end %>
<div id="threadModal" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="threadModal" aria-hidden="false" data-id="<%= @thread.id if @thread %>">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3><%= @thread_title %></h3>
</div>
<div class="modal-body">
<% if @thread %>
<div class="thread-status"><%= @thread.status[:status] %></div>
<div><span class="thread-current-count"><%= @thread.status[:current_count].to_i %></span>/<span class="thread-all-count"><%= @thread.status[:all_count].to_i %></span></div>
<span class="thread-finish_percent"><%= @thread.status[:finish_percent].to_i %></span> % finished
<% else %>
<div class="thread-status">Processing</div>
<div><span class="thread-current-count">0</span>/<span class="thread-all-count">0</span></div>
<span class="thread-finish_percent">0</span> % finished
<% end %>
</div>
<div class="modal-footer">
<button class="btn" id="modal-close-btn" style="width: 4em;" data-dismiss="modal" aria-hidden="true"><%=t('close')%></button>
</div>
</div>
</div>
</div>
<%= render_filter @filter_fields, "index_table" %>
<section id="file_manager_section">
<% if @display_uploader_region %>
<input id="file-uploader" type="file" name="file" multiple>
<style type="text/css">
.file-input.file-input-ajax-new {
display: none;
}
</style>
<script class="file-uploader-script">
var $el;
$(document).ready(function() {
if($('#file_manager_section .file-input').length == 0){
$el = $("#file-uploader");
var footerTemplate = '<div class="file-thumbnail-footer" style ="height:94px">\n' +
' <div>{caption}</div> ' +
' <div class="small" style="margin:15px 0 2px 0">{size}</div> {progress}\n{indicator}\n{actions}\n' +
'</div>';
$el.fileinput({
language: "<%= I18n.locale %>",
uploadUrl: "<%= upload_file_admin_file_manager_path(@module_key) %>",
previewFileType: 'any',
uploadAsync: true,
layoutTemplates: {footer: footerTemplate}
}).on('filebatchselected', function(event, files) {
//console.log(files);
}).on('fileuploaded', function(event, data) {
reload_explorer_section(undefined, $('#file_manager_section .file-input .progress-bar:not(.progress-bar-success)').length != 0);
}).on('filebatchuploadcomplete', function(event, data) {
reload_explorer_section();
});
}
});
</script>
<% end %>
<script>
window.file_manager_path = "<%= admin_file_managers_path(:locale=> I18n.locale) %>";
window.module_key = "<%= @module_key %>";
</script>
<span id="index_table">
<% if @file %>
<%= render :partial => 'file' %>
<% elsif @recycle_bin %>
<%= render :partial => 'recycle_bin' %>
<% else %>
<%= render :partial => 'module' %>
<% end %>
</span>