From 649598618854c3e48dc26841e2c4eeef2525e088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sun, 12 May 2024 14:22:01 +0800 Subject: [PATCH] First version. --- Gemfile | 14 + Rakefile | 6 + app/assets/images/.keep | 0 .../javascripts/file_manager/application.js | 13 + .../javascripts/file_manager/file_manager.js | 563 ++++++++++++++++++ app/assets/javascripts/file_manager/rename.js | 41 ++ app/assets/javascripts/file_manager/test.js | 3 + .../stylesheets/file_manager/application.scss | 270 +++++++++ .../file_manager/default_theme.scss | 35 ++ .../file_manager/fontawesome-5.15.4.min.css | 5 + .../admin/file_managers_controller.rb | 499 ++++++++++++++++ app/controllers/file_managers_controller.rb | 97 +++ app/helpers/file_managers_helper.rb | 54 ++ app/models/file_manager_root.rb | 8 + app/models/file_manager_setting.rb | 284 +++++++++ app/models/file_manager_trash.rb | 83 +++ app/models/file_manager_upload.rb | 172 ++++++ app/views/admin/file_managers/_file.html.erb | 95 +++ .../file_managers/_form_setting.html.erb | 22 + .../admin/file_managers/_module.html.erb | 152 +++++ .../admin/file_managers/_recycle_bin.html.erb | 100 ++++ app/views/admin/file_managers/index.html.erb | 39 ++ app/views/admin/file_managers/module.html.erb | 90 +++ .../admin/file_managers/settings.html.erb | 106 ++++ .../file_managers/custom_widget_data.html.erb | 9 + app/views/layouts/file_manager.html.erb | 56 ++ bin/rails | 18 + config/locales/en.yml | 41 ++ config/locales/zh_tw.yml | 41 ++ config/routes.rb | 53 ++ file-manager.gemspec | 106 ++++ lib/file-manager.rb | 4 + lib/file_manager/engine.rb | 29 + lib/file_manager/version.rb | 3 + lib/tasks/.keep | 0 lib/tasks/bulletin_tasks.rake | 8 + test/controllers/.keep | 0 test/controllers/index_test.rb | 62 ++ test/fixtures/.keep | 0 test/fixtures/files/.keep | 0 test/helpers/.keep | 0 test/integration/.keep | 0 test/test_helper.rb | 7 + 43 files changed, 3188 insertions(+) create mode 100644 Gemfile create mode 100644 Rakefile create mode 100644 app/assets/images/.keep create mode 100644 app/assets/javascripts/file_manager/application.js create mode 100644 app/assets/javascripts/file_manager/file_manager.js create mode 100644 app/assets/javascripts/file_manager/rename.js create mode 100644 app/assets/javascripts/file_manager/test.js create mode 100644 app/assets/stylesheets/file_manager/application.scss create mode 100644 app/assets/stylesheets/file_manager/default_theme.scss create mode 100644 app/assets/stylesheets/file_manager/fontawesome-5.15.4.min.css create mode 100644 app/controllers/admin/file_managers_controller.rb create mode 100644 app/controllers/file_managers_controller.rb create mode 100644 app/helpers/file_managers_helper.rb create mode 100644 app/models/file_manager_root.rb create mode 100644 app/models/file_manager_setting.rb create mode 100644 app/models/file_manager_trash.rb create mode 100644 app/models/file_manager_upload.rb create mode 100644 app/views/admin/file_managers/_file.html.erb create mode 100644 app/views/admin/file_managers/_form_setting.html.erb create mode 100644 app/views/admin/file_managers/_module.html.erb create mode 100644 app/views/admin/file_managers/_recycle_bin.html.erb create mode 100644 app/views/admin/file_managers/index.html.erb create mode 100644 app/views/admin/file_managers/module.html.erb create mode 100644 app/views/admin/file_managers/settings.html.erb create mode 100644 app/views/file_managers/custom_widget_data.html.erb create mode 100644 app/views/layouts/file_manager.html.erb create mode 100644 bin/rails create mode 100644 config/locales/en.yml create mode 100644 config/locales/zh_tw.yml create mode 100644 config/routes.rb create mode 100644 file-manager.gemspec create mode 100644 lib/file-manager.rb create mode 100644 lib/file_manager/engine.rb create mode 100644 lib/file_manager/version.rb create mode 100644 lib/tasks/.keep create mode 100644 lib/tasks/bulletin_tasks.rake create mode 100644 test/controllers/.keep create mode 100644 test/controllers/index_test.rb create mode 100644 test/fixtures/.keep create mode 100644 test/fixtures/files/.keep create mode 100644 test/helpers/.keep create mode 100644 test/integration/.keep create mode 100644 test/test_helper.rb diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ed0ea56 --- /dev/null +++ b/Gemfile @@ -0,0 +1,14 @@ +source "https://rubygems.org" + +# Declare your gem's dependencies in bulletin.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec + +# Declare any dependencies that are still in development here instead of in +# your gemspec. These might include edge Rails or gems from your path or +# Git. Remember to move these dependencies to your gemspec before releasing +# your gem to rubygems.org. + +# To use debugger +# gem 'debugger' \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..e85f913 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative 'config/application' + +Rails.application.load_tasks diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/file_manager/application.js b/app/assets/javascripts/file_manager/application.js new file mode 100644 index 0000000..cf935ff --- /dev/null +++ b/app/assets/javascripts/file_manager/application.js @@ -0,0 +1,13 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. JavaScript code in this file should be added after the last require_* statement. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require_tree . \ No newline at end of file diff --git a/app/assets/javascripts/file_manager/file_manager.js b/app/assets/javascripts/file_manager/file_manager.js new file mode 100644 index 0000000..d42de8e --- /dev/null +++ b/app/assets/javascripts/file_manager/file_manager.js @@ -0,0 +1,563 @@ +var csrf_token = document + .querySelector("meta[name='csrf-token']") + .getAttribute("content"); +$.ajaxSetup({ + headers: { + // 'Content-Type': 'multipart/form-data', + // 使用 multipart/form-data 在此不需要設定 Content-Type。 + 'X-Requested-With': 'XMLHttpRequest', + 'X-CSRF-Token': csrf_token, + } +}); +function replace_explorer_section(file_manager_section, exclude_upload_section){ + var org_file_manager_section = $('#file_manager_section'); + if(org_file_manager_section.find(' > .file-input').length != 0 && file_manager_section.find('> .file-uploader-script').length != 0){ + org_file_manager_section.find(' > *').each(function(i,v){ + if(!($(v).hasClass('file-input') || $(v).hasClass('file-uploader-script'))){ + $(v).replaceWith(file_manager_section.find('>*').eq(i).clone()); + } + }) + if(!exclude_upload_section){ + $("#file-uploader").fileinput('clear'); + var fileinput_data = $("#file-uploader").data('fileinput'); + fileinput_data.uploadUrl = "/xhr/file_manager_upload/" + window.current_path + (window.explorer_setting_id ? ('?setting_id='+window.explorer_setting_id) : ''); + } + }else{ + org_file_manager_section.find('#index_table').html(file_manager_section); + } +} +function reload_explorer_section(url, exclude_upload_section, callback,...args){ + if(url == undefined){ + url = get_path(); + } + $.get(url).done(function(data){ + var $file_manager_section = $(data); + replace_explorer_section($file_manager_section, exclude_upload_section); + if(window.scroll_top){ + $(window).scrollTop(window.scroll_top); + } + if(typeof(callback) == 'function'){ + callback.apply( this, args ); + } + }).fail(function() { + alert('No such file or directory!'); + }); +} +function reload_page(url, is_recycle_bin, extra_params){ + var tmp_url = url, request_url; + if(url == undefined){ + request_url = get_path(undefined,undefined, extra_params); + }else{ + request_url = get_path(url,is_recycle_bin, extra_params); + } + $.get(request_url).done(function(data){ + var $file_manager_section = $(data); + replace_explorer_section($file_manager_section); + if(!window.only_select_folder){ + push_history_url(request_url); + } + if(window.scroll_top){ + $(window).scrollTop(window.scroll_top); + } + }).fail(function() { + alert('No such file or directory!'); + }); +} +function push_history_url(new_url, state){ + if(state == undefined) + state = {body: $('body').prop('outerHTML')}; + if(history.state == null){ + history.replaceState({need_reload: true} ,$('title').text(), window.location.href); + } + window.history.pushState(state ,$('title').text(), new_url); +} +function get_current_url(path, override_recycle_bin, extra_params){ + if(override_recycle_bin == undefined){ + override_recycle_bin = window.is_recycle_bin; + } + var params = {}; + if(override_recycle_bin){ + path = ''; + params['recycle_bin'] = true + } + if(extra_params){ + Object.keys(extra_params).forEach(function(k){ + params[k] = extra_params[k]; + }) + } + var url = ''; + if(window.path_mode == 'params'){ + params["path"] = path; + url = window.location.pathname + }else{ + url = "/xhr/file_manager/" + path; + } + if(window.only_select_folder){ + params['select_mode'] = true; + } + return url + params_to_query(params); +} +function get_path(path, override_recycle_bin, extra_params){ + var params = get_params(); + if(path == undefined){ + path = window.location.pathname; + } + if(override_recycle_bin == undefined){ + override_recycle_bin = window.is_recycle_bin; + } + if(override_recycle_bin){ + path = "" + params["recycle_bin"] = true; + window.is_recycle_bin = true; + }else{ + delete params["recycle_bin"]; + window.is_recycle_bin = false; + } + if(window.only_select_folder){ + params['select_mode'] = true; + }else{ + delete params["select_mode"]; + } + delete params["page"]; + delete params["file_id"]; + if(window.explorer_setting_id){ + params['setting_id'] = window.explorer_setting_id; + } + if(extra_params){ + Object.keys(extra_params).forEach(function(k){ + if (extra_params[k] != null) + params[k] = extra_params[k]; + }) + } + if(window.use_params_request){ + params['path'] = path; + path = ''; + }else{ + delete params['path']; + } + return path + params_to_query(params); +} +function get_basename(file){ + var tmp = file.split('/'); + return tmp[tmp.length - 1] || ''; +} +function pathJoin(parts, sep){ + var separator = sep || '/'; + var replace = new RegExp(separator+'{1,}', 'g'); + if(parts.length > 1){ + parts.forEach(function(p, i){ + if(p[0] == '/'){ + for(var k=0; k= 2 ){ + $(search_split[1].split("&")).each(function(i, s){ + var tmp = s.split("="); + var k = tmp[0], v = tmp[1]; + if(k.search('[]') != -1){ + k = k.split('[]')[0]; + if(params.hasOwnProperty(k)){ + params[k].push(v); + }else{ + params[k] = [v]; + } + }else{ + params[k] = v; + } + }) + } + return params; +} +function params_to_query(params){ + var query_text = ''; + var keys = Object.keys(params); + if(keys.length != 0){ + keys.forEach(function(k, i){ + if(i == 0){ + query_text += '?'; + }else{ + query_text += '&'; + } + var v = params[k]; + if(Array.isArray(v)){ + v.forEach(function(vv, j){ + if(j != 0){ + query_text += '&'; + } + query_text += `${k}[]=${vv}`; + }) + }else{ + query_text += `${k}=${v}`; + } + }) + } + return query_text; +} +$(document).on("click",".delete",function(){ + var that = $(this); + window.scroll_top = $(window).scrollTop(); + if( window.confirm(that.data("tmp-confirm")) ){ + if( window.confirm(that.data("tmp-confirm")) ){ + $.ajax({ + url: that.data("link"), + method: 'DELETE', + contentType: false, //required + processData: false, // required + statusCode: { + 204: reload_explorer_section, + 404: function() { + alert( "Delete failed!\nFile not exist!" ); + } + } + }) + } + } +}) +$(document).on("click",".delete_file",function(){ + var that = $(this); + window.scroll_top = $(window).scrollTop(); + if( window.confirm(that.data("tmp-confirm")) ){ + if( window.confirm(that.data("tmp-confirm")) ){ + $.ajax({ + url: that.data("link"), + method: 'DELETE', + contentType: false, //required + processData: false, // required + dataType: 'json', + statusCode: { + 200: function(data) { + var params = get_params(); + var extra_params; + if (data.id) { + extra_params = {"version": data.version, "file_id": data.id}; + } else { + extra_params = {}; + } + var url = get_path(undefined, undefined, extra_params); + var callback = push_history_url; + reload_explorer_section(url, false, callback, url); + }, + 404: function() { + alert( "Delete failed!\nFile not exist!" ); + } + } + }) + } + } +}) +$(document).on("click",".edit",function(){ + $(this).hide(); + var pre_height = $('#file_manager_section pre').height(); + $('#file_manager_section textarea.edit-area').html($('#file_manager_section pre').html()); + $('#file_manager_section textarea.edit-area').removeClass('hide'); + $('#file_manager_section pre').addClass('hide'); + $('#file_manager_section textarea.edit-area').height(pre_height); + $(".save").removeClass('hide'); +}) +$(document).on("click",".save",function(){ + $(this).hide(); + var data = new FormData(); + data.append("content", $('#file_manager_section textarea.edit-area').val()); + $.ajax({ + url: '/admin/file_managers/' + $(this).data('id') + '/save', + method: 'POST', + data: data, + contentType: false, //required + processData: false, // required + dataType: 'json', + mimeType: 'multipart/form-data', + statusCode: { + 200: function(data) { + console.log(data); + var params = get_params(), url; + var callback = push_history_url; + if(params.version){ + var new_version = Number(params.version) + 1; + url = get_path(undefined, undefined, {"version": new_version, "file_id": data.id}); + params.version = new_version.toString(); + } else { + url = get_path(undefined, undefined, {"file_id": data.id}); + } + reload_explorer_section(url, false, callback, url); + $(".save").addClass('hide'); + $(".edit").removeClass('hide'); + }, + 400: function() { + alert( "Bad Request!\nThere are no content of this file!" ); + } + } + }) +}) +$(document).on("click",".module-key",function(){ + change_folder(null, $(this).data("key")); +}) +$(document).on("click",".directory, .file",function(){ + change_folder($(this).data("id")); +}) +$(document).on("click",".breadcrumb-index",function(){ + var path = window.current_path[0] == '/' ? window.current_path : ('/' + window.current_path); + $("#breadcrumb-relative-url").addClass('hide'); + $("#breadcrumb-editable").text(path).removeClass("hide").focus(); + window.tmp_current_path = path; +}) +$(document).on("click",'#breadcrumb-relative-url .directory, #breadcrumb-editable',function(e){ + e.stopPropagation(); +}) +$(document).on("blur","#breadcrumb-editable",function(){ + if(window.tmp_current_path != $(this).text().trim()){ + change_folder($(this).text().trim()); + } + $("#breadcrumb-relative-url").removeClass('hide'); + $(this).addClass('hide'); +}) +$(document).on("keydown","#breadcrumb-editable",function(evt){ + if(evt.keyCode == 13){ + evt.preventDefault(); + $(this).trigger("blur"); + } +}) +$(document).on("click", ".copyButton", function(){ + var link = $(this).data('link'); + // Copy the link + navigator.clipboard.writeText(link); + if (!($(this).data('org-text'))) + $(this).data('org-text', $(this).find('.tooltiptext').text()); + $(this).find('.tooltiptext').text($(this).data('prompt') + ': ' + link); +}) +$(document).on("mouseout", ".copyButton", function(){ + var org_text = $(this).data('org-text'); + if (org_text) + $(this).find('.tooltiptext').text(org_text); +}) +$(document).on("click", ".redirect_recycle_bin", function(){ + change_folder(null, null, true); +}) +$(document).on("click", ".recycle_bin", function(){ + change_folder(null, $(this).data('key'), true); +}) +$(document).on("click", ".recover_all", function(){ + var that = $(this); + var prompt_message = that.data("prompt"); + $.ajax({ + url: '/admin/file_managers/' + window.module_key + '/get_trash_count', + method: 'POST', + contentType: false, //required + processData: false, // required + dataType: 'json', + mimeType: 'multipart/form-data', + statusCode: { + 200: function(data) { + var count = data["count"] + that.data('unit'); + prompt_message = prompt_message.replace('${num}', count); + if(window.confirm(prompt_message)){ + if(window.confirm(prompt_message)){ + $.ajax({ + url: '/admin/file_managers/' + window.module_key + '/recover_all', + method: 'POST', + contentType: false, //required + processData: false, // required + dataType: 'json', + mimeType: 'multipart/form-data', + statusCode: { + 200: function(data) { + var thread_id = data["id"]; + var thread_title = data["title"]; + reload_explorer_section(get_path(), false, function show_modal(thread_id, thread_title){ + $("#threadModal").data('id', thread_id); + $("#threadModal .modal-header h3").text(thread_title); + $("#threadModal").removeClass('hide').modal('show'); + }, thread_id, thread_title); + } + } + }) + } + } + } + } + }) +}) +$(document).on("click",".clean_up_recycle_bin", function(){ + var that = $(this); + var prompt_message = that.data("prompt"); + $.ajax({ + url: '/admin/file_managers/' + window.module_key + '/get_trash_count', + method: 'POST', + contentType: false, //required + processData: false, // required + dataType: 'json', + mimeType: 'multipart/form-data', + statusCode: { + 200: function(data) { + var count = data["count"] + that.data('unit'); + prompt_message = prompt_message.replace('${num}', count); + if(window.confirm(prompt_message)){ + if(window.confirm(prompt_message)){ + $.ajax({ + url: '/admin/file_managers/' + window.module_key + '/clean_trashes', + method: 'POST', + contentType: false, //required + processData: false, // required + dataType: 'json', + mimeType: 'multipart/form-data', + statusCode: { + 200: function(data) { + var thread_id = data["id"]; + var thread_title = data["title"]; + reload_explorer_section(get_path(), false, function show_modal(thread_id, thread_title){ + $("#threadModal").data('id', thread_id); + $("#threadModal .modal-header h3").text(thread_title); + $("#threadModal").removeClass('hide').modal('show'); + }, thread_id, thread_title); + } + } + }) + } + } + } + } + }) +}) +$(document).on('hidden.bs.modal', "#threadModal", function(){ + window.clearTimeout(window.time_out_id); +}) +$(document).on('shown.bs.modal', "#threadModal", function(){ + var thread_id = $(this).data('id'); + window.time_out_id = window.setTimeout(function(){ + update_thread(thread_id, reload_page); + }, 1000); +}) +$(document).on('click', ".change_version", function(){ + var that = $(this); + var version = that.data('version'); + var file_id = that.data('id'); + reload_page(undefined,undefined,{"version": version, "file_id": file_id}); +}) +$(document).on('click', ".recover", function(){ + var that = $(this); + window.scroll_top = $(window).scrollTop(); + if( window.confirm(that.data("tmp-confirm")) ){ + $.ajax({ + url: that.data("link"), + method: 'POST', + contentType: false, //required + processData: false, // required + statusCode: { + 204: reload_explorer_section, + 404: function() { + alert( "Recover failed!\nFile not exist!" ); + } + } + }) + } +}) + +function update_thread(id, finish_callback, ...args){ + var data = new FormData(); + data.append('id',id); + $.ajax({ + url: "/admin/threads/get_status", + method: 'POST', + data: data, + contentType: false, //required + processData: false, // required + dataType: 'json', + mimeType: 'multipart/form-data', + statusCode: { + 200: function(data){ + var finish_percent = data["finish_percent"]; + var current_count = data["current_count"]; + var all_count = data["all_count"]; + var is_finish = (data["status"] == "finish"); + if(finish_percent){ + $("#threadModal .modal-body .thread-status").text(data["status"]); + if(data["status"] != 'Processing'){ + $("#threadModal .modal-body .thread-current-count").text(current_count); + $("#threadModal .modal-body .thread-all-count").text(all_count); + } + $("#threadModal .modal-body .thread-finish_percent").text(finish_percent); + }else if(is_finish){ + $("#threadModal .modal-body .thread-status").text(data["status"]); + $("#threadModal .modal-body .thread-finish_percent").text(100); + } + var that = this; + if(!is_finish){ + var tmp_arguments = arguments; + window.time_out_id = window.setTimeout(function(){ + update_thread.apply(that, tmp_arguments); + }, 1000); + }else{ + if(window.time_out_id) + window.clearTimeout(window.time_out_id); + var wait_time = 3000; + if(finish_callback) + wait_time = 0; + window.setTimeout(function(){ + $("#threadModal").modal("hide"); + if(finish_callback){ + finish_callback.apply(that, args); + } + alert(data["status"]); + }, wait_time); + return; + } + } + } + }); +} +window.onpopstate = function(event) { + var state = event.state; + if(state != null){ + if(state.need_reload){ + window.location.reload(); + }else if(state.body){ + var $body = $(state.body); + $('.breadcrumb-index').replaceWith($body.find('.breadcrumb-index')); + $('#file_manager_section').replaceWith($body.find('#file_manager_section')); + } + } +}; \ No newline at end of file diff --git a/app/assets/javascripts/file_manager/rename.js b/app/assets/javascripts/file_manager/rename.js new file mode 100644 index 0000000..ced2749 --- /dev/null +++ b/app/assets/javascripts/file_manager/rename.js @@ -0,0 +1,41 @@ +function rename(id, name) { + window.scroll_top = $(window).scrollTop(); + var path = pathJoin([name,".."]); + var basename = get_basename(name); + var new_name = prompt("Enter the new name for this element.", basename); + if (new_name != null) { + new_name = pathJoin([path, new_name]); + var data = new FormData(); + data.append("new_name", new_name); + var csrf_token = document + .querySelector("meta[name='csrf-token']") + .getAttribute("content"); + var csrf_param = document + .querySelector("meta[name='csrf-param']") + .getAttribute("content"); + if (csrf_token && csrf_param) { + data.append(csrf_param, csrf_token); + } + $.ajax({ + url: '/admin/file_managers/' + id + '/rename', + method: 'PUT', + data: data, + headers: { + // 'Content-Type': 'multipart/form-data', + // 使用 multipart/form-data 在此不需要設定 Content-Type。 + 'X-Requested-With': 'XMLHttpRequest', + 'Authorization': `Bearer ${ csrf_token }`, + }, + contentType: false, //required + processData: false, // required + mimeType: 'multipart/form-data', + statusCode: { + 204: reload_explorer_section, + 403: function() { + alert( "Rename failed!\nFile exist!" ); + } + } + }) + } + return false; +} diff --git a/app/assets/javascripts/file_manager/test.js b/app/assets/javascripts/file_manager/test.js new file mode 100644 index 0000000..63600b9 --- /dev/null +++ b/app/assets/javascripts/file_manager/test.js @@ -0,0 +1,3 @@ +function abc(){ + console.log(12341111222444551111111111111111111111111111111111111111) +} \ No newline at end of file diff --git a/app/assets/stylesheets/file_manager/application.scss b/app/assets/stylesheets/file_manager/application.scss new file mode 100644 index 0000000..e0a19d3 --- /dev/null +++ b/app/assets/stylesheets/file_manager/application.scss @@ -0,0 +1,270 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS + * files in this directory. Styles in this file should be added after the last require_* statement. + * It is generally better to create a new file per style scope. + * + *= require_self + *= require fontawesome-5.15.4.min + */ +/* Common */ +input[disabled], select[disabled], textarea[disabled], input[readonly], select[readonly], textarea[readonly] { + cursor: not-allowed; + background-color: #eeeeee; +} +body#file_manager_body, html{ + font-size: 1rem !important; +} +a { + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +#file_manager_section h3 { + float: left; +} +#file_manager_section .btn-wrapper { + float: right; +} +#file_manager_section .btn-wrapper .upload-button { + display: inline-block; +} +#file_manager_section table { + border-collapse: collapse; + width: 100%; + text-align: left; + table-layout: fixed; +} +.modal table { + white-space: unset; +} +.modal.fade:not(.in) { + display: none; +} +.modal-backdrop.fade:not(.in) { + display: none; +} +#file_manager_section th { + font-size: 1.17em; + background-color: rgb(76, 102, 175); + color: white; +} +#file_manager_section tr:hover { + background-color: #ffffff; +} +#file_manager_section th, #file_manager_section td { + padding: 4px 12px; + border: 1px solid; + border-color: #ddd; +} +#file_manager_section td a { + display: block; + width: 100%; + overflow-wrap: break-word; +} +/* Light mode: */ +a.delete, +a.delete:visited { + color: rgb(223, 132, 136); +} +a.rename, a.recover { + color: deepskyblue; +} +.date { + font-family: 'Courier New', Courier, monospace; +} +.name { + width: 100%; + white-space: normal; +} +.fa { + padding: 0 6px 0 0; +} +.download, .create_folder, .edit, .save, .recover_all, .clean_up_recycle_bin, .delete_file, +.download:link, .create_folder:link, .edit:link, .save:link, .recover_all:link, .clean_up_recycle_bin:link, .delete_file:link, +.download:visited, .create_folder:visited, .edit:visited, .save:visited, .clean_up_recycle_bin:visited, .delete_file:visited { + color: white; + display: inline-block; + font-size: 1.17em; + padding: 12px 18px; + text-align: center; + text-decoration: none; + white-space: pre-wrap; + border: none; + cursor: pointer; + box-sizing: border-box; + line-height: 1.0; +} +input[type=file]#file{ + display: inline-block; +} +form { + display: inline-block; +} +#file_manager_section pre,#file_manager_section textarea { + padding: 10px; + white-space: pre-wrap; + word-wrap: break-word; +} +.save.hide{ + display: none; +} +.breadcrumb-index { + display: inline-flex; + margin: 0.67em 0; + font-size: 2em; +} +.breadcrumb-index, #breadcrumb-editable { + width: 100%; +} +breadcrumb-relative-url{ + max-width: 100%; + overflow-wrap: break-word; +} +.breadcrumb-index a { + color: #0366d6; + font-weight: normal; +} +.breadcrumb-index a.base_url { + font-weight: bold; +} +.separator { + padding: 0 10px; +} +.create_folder { + float: right; + background: forestgreen; +} +.recover_all { + background: deepskyblue; +} +.create_folder, .clean_up_recycle_bin { + float: right; + background: red; +} +.fa-folder { + color: rgba(3,47,98,.5); +} +.fa-file { + color: rgb(155, 155, 155); +} +.download { + background-color: rgb(60, 75, 209); +} +.delete_file { + background: #be0606; + color: white; +} +.edit { + background: #a67030; +} +.save{ + background: #00e300; + color: black; +} +#file_manager_section pre,#file_manager_section textarea { + background-color: #d3d3d3; + color: black; +} +#file_manager_section textarea{ + width: calc(100% - 20px); +} +.redirect_recycle_bin{ + float: right; +} +.dropdown-menu.upload-box { + right: 0; + left: auto; +} +.tooltip { + position: relative; + display: inline-block; + opacity: 1; +} + +.tooltip .tooltiptext { + visibility: hidden; + width: 140px; + background-color: #555; + color: #fff; + text-align: center; + border-radius: 6px; + padding: 5px; + position: absolute; + z-index: 1; + bottom: 150%; + left: 50%; + margin-left: -75px; + opacity: 0; + transition: opacity 0.3s; + overflow-wrap: break-word; +} + +.tooltip .tooltiptext::after { + content: ""; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #555 transparent transparent transparent; +} + +.tooltip:hover .tooltiptext { + visibility: visible; + opacity: 1; +} +@media (prefers-color-scheme: dark) { + body#file_manager_body, #file_manager_section tbody { + background-color: black; + color: rgba(249, 249, 250, 0.8); + } + .fa-folder { + color: rgb(2, 69, 146); + } + .fa-file { + color: rgb(177, 177, 177); + } + a .filename { + color: rgb(47, 121, 165); + } + a.delete, a.create_folder, a.clean_up_recycle_bin, a.edit, a.delete_file, + a.delete:link, a.create_folder:link, a.clean_up_recycle_bin:link, a.edit:link, a.delete_file:link, + a.delete:visited, a.create_folder:visited, a.clean_up_recycle_bin:visited, a.edit:visited, a.delete_file:visited { + color: rgb(223, 132, 136); + } + tr:hover { + background-color: #3b3b3b; + } + th, td { + border-color: rgb(138, 138, 138); + } + .download { + background-color: rgb(29, 42, 163); + } + .create_folder { + background: darkgreen; + } + .recover_all { + background: darkred; + } + .edit { + background: #653700; + } + .save { + background: green; + color: #fff; + } + #file_manager_section pre,#file_manager_section textarea { + background-color: #3b3b3b; + color: white; + } +} diff --git a/app/assets/stylesheets/file_manager/default_theme.scss b/app/assets/stylesheets/file_manager/default_theme.scss new file mode 100644 index 0000000..a07d526 --- /dev/null +++ b/app/assets/stylesheets/file_manager/default_theme.scss @@ -0,0 +1,35 @@ +li { + list-style: none; +} +ul.tab_nav { + list-style-type: none; + padding: 0; + display: flex; + flex-wrap: wrap; + font-family: "Roboto", "微軟正黑體", "Helvetica Neue", Helvetica, sans-serif; +} +ul.tab_nav li { + padding: 0.5em 1em; + background: #32D9C3; + margin: 0.2em; + cursor: pointer; + transition: all 0.5s; + -moz-transition: all 0.5s; + -webkit-transition: all 0.5s; + -o-transition: all 0.5s; +} +ul.tab_nav li.active { + background: #19524b; + color: #fff; +} +@media (prefers-color-scheme: dark) { + ul.tab_nav li { + background-color: #f3f3f3; + color: #ccc; + } + ul.tab_nav li.active { + background-color: #969696; + color: #fff; + } + +} \ No newline at end of file diff --git a/app/assets/stylesheets/file_manager/fontawesome-5.15.4.min.css b/app/assets/stylesheets/file_manager/fontawesome-5.15.4.min.css new file mode 100644 index 0000000..bd067b8 --- /dev/null +++ b/app/assets/stylesheets/file_manager/fontawesome-5.15.4.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1);transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-bacteria:before{content:"\e059"}.fa-bacterium:before{content:"\e05a"}.fa-bahai:before{content:"\f666"}.fa-balance-scale:before{content:"\f24e"}.fa-balance-scale-left:before{content:"\f515"}.fa-balance-scale-right:before{content:"\f516"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-battle-net:before{content:"\f835"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-biking:before{content:"\f84a"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bootstrap:before{content:"\f836"}.fa-border-all:before{content:"\f84c"}.fa-border-none:before{content:"\f850"}.fa-border-style:before{content:"\f853"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-box-tissue:before{content:"\e05b"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buy-n-large:before{content:"\f8a6"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caravan:before{content:"\f8ff"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudflare:before{content:"\e07d"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-alt:before{content:"\f422"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-cotton-bureau:before{content:"\f89e"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dailymotion:before{content:"\e052"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-deezer:before{content:"\e077"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-disease:before{content:"\f7fa"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edge-legacy:before{content:"\e078"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-evernote:before{content:"\f839"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-alt:before{content:"\f424"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fan:before{content:"\f863"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-faucet:before{content:"\e005"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-firefox-browser:before{content:"\e007"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-alt:before{content:"\f841"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-pay:before{content:"\e079"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guilded:before{content:"\e07e"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-medical:before{content:"\e05c"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-holding-water:before{content:"\f4c1"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-sparkles:before{content:"\e05d"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-hands-wash:before{content:"\e05e"}.fa-handshake:before{content:"\f2b5"}.fa-handshake-alt-slash:before{content:"\e05f"}.fa-handshake-slash:before{content:"\e060"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-cowboy:before{content:"\f8c0"}.fa-hat-cowboy-side:before{content:"\f8c1"}.fa-hat-wizard:before{content:"\f6e8"}.fa-hdd:before{content:"\f0a0"}.fa-head-side-cough:before{content:"\e061"}.fa-head-side-cough-slash:before{content:"\e062"}.fa-head-side-mask:before{content:"\e063"}.fa-head-side-virus:before{content:"\e064"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hive:before{content:"\e07f"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hospital-user:before{content:"\f80d"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-house-user:before{content:"\e065"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-icons:before{content:"\f86d"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-ideal:before{content:"\e013"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-innosoft:before{content:"\e080"}.fa-instagram:before{content:"\f16d"}.fa-instagram-square:before{content:"\e055"}.fa-instalod:before{content:"\e081"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-house:before{content:"\e066"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lungs:before{content:"\f604"}.fa-lungs-virus:before{content:"\e067"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-mdb:before{content:"\f8ca"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microblog:before{content:"\e01a"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mixer:before{content:"\e056"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse:before{content:"\f8cc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-octopus-deploy:before{content:"\e082"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-orcid:before{content:"\f8d2"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-arrows:before{content:"\e068"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-perbyte:before{content:"\e083"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-alt:before{content:"\f879"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-square-alt:before{content:"\f87b"}.fa-phone-volume:before{content:"\f2a0"}.fa-photo-video:before{content:"\f87c"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-square:before{content:"\e01e"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-plane-slash:before{content:"\e069"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pump-medical:before{content:"\e06a"}.fa-pump-soap:before{content:"\e06b"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-record-vinyl:before{content:"\f8d9"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-remove-format:before{content:"\f87d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-rust:before{content:"\e07a"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-shield-virus:before{content:"\e06c"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopify:before{content:"\e057"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sink:before{content:"\e06d"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-soap:before{content:"\e06e"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-down-alt:before{content:"\f881"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-alpha-up-alt:before{content:"\f882"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-down-alt:before{content:"\f884"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-amount-up-alt:before{content:"\f885"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-down-alt:before{content:"\f886"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-numeric-up-alt:before{content:"\f887"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spell-check:before{content:"\f891"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stackpath:before{content:"\f842"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-stopwatch-20:before{content:"\e06f"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-store-alt-slash:before{content:"\e070"}.fa-store-slash:before{content:"\e071"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swift:before{content:"\f8e1"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-symfony:before{content:"\f83d"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-tiktok:before{content:"\e07b"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toilet-paper-slash:before{content:"\e072"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-trailer:before{content:"\e041"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbraco:before{content:"\f8e8"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-uncharted:before{content:"\e084"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-unity:before{content:"\e049"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-unsplash:before{content:"\e07c"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-users-slash:before{content:"\e073"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-vest:before{content:"\e085"}.fa-vest-patches:before{content:"\e086"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-virus:before{content:"\e074"}.fa-virus-slash:before{content:"\e075"}.fa-viruses:before{content:"\e076"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-voicemail:before{content:"\f897"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-watchman-monitoring:before{content:"\e087"}.fa-water:before{content:"\f773"}.fa-wave-square:before{content:"\f83e"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wodu:before{content:"\e088"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:400;font-display:block;src:url(/assets/fontawesome-5.15.4/fa-brands-400.eot);src:url(/assets/fontawesome-5.15.4/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(/assets/fontawesome-5.15.4/fa-brands-400.woff2) format("woff2"),url(/assets/fontawesome-5.15.4/fa-brands-400.woff) format("woff"),url(/assets/fontawesome-5.15.4/fa-brands-400.ttf) format("truetype"),url(/assets/fontawesome-5.15.4/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:block;src:url(/assets/fontawesome-5.15.4/fa-regular-400.eot);src:url(/assets/fontawesome-5.15.4/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(/assets/fontawesome-5.15.4/fa-regular-400.woff2) format("woff2"),url(/assets/fontawesome-5.15.4/fa-regular-400.woff) format("woff"),url(/assets/fontawesome-5.15.4/fa-regular-400.ttf) format("truetype"),url(/assets/fontawesome-5.15.4/fa-regular-400.svg#fontawesome) format("svg")}.fab,.far{font-weight:400}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:block;src:url(/assets/fontawesome-5.15.4/fa-solid-900.eot);src:url(/assets/fontawesome-5.15.4/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(/assets/fontawesome-5.15.4/fa-solid-900.woff2) format("woff2"),url(/assets/fontawesome-5.15.4/fa-solid-900.woff) format("woff"),url(/assets/fontawesome-5.15.4/fa-solid-900.ttf) format("truetype"),url(/assets/fontawesome-5.15.4/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900} \ No newline at end of file diff --git a/app/controllers/admin/file_managers_controller.rb b/app/controllers/admin/file_managers_controller.rb new file mode 100644 index 0000000..38e0349 --- /dev/null +++ b/app/controllers/admin/file_managers_controller.rb @@ -0,0 +1,499 @@ +class Admin::FileManagersController < OrbitAdminController + include ActionView::Helpers::NumberHelper + before_action :set_base_url, except: [:settings, :update_settings] + def render_403 + render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => 403, :formats => [:html] + end + def render_404 + render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => 404, :formats => [:html] + end + def forbidden_error + render :body => nil, :status => 403 + end + def index + end + + def module + @current_user = current_user + @current_user_id = @current_user.id + @recycle_bin = params[:recycle_bin] == 'true' + @file = nil + if params[:file_id] + upload_item = FileManagerUpload.where(:id=> params[:file_id]).first + @upload_item = upload_item + if upload_item + @active_version = @upload_item.version + @id = @upload_item.id + @is_img = !(@upload_item.filename.match(/\.(jpg|gif|png|webp)$/i).nil?) + if upload_item.is_trash + absolute_path = upload_item.file_manager_trash.trash_path + else + absolute_path = upload_item.get_real_path + end + @all_uploads = get_uploads(upload_item.path, true, {:is_trash=>false}) + if File.file?(absolute_path) + if params[:download] + send_file(absolute_path) + elsif File.size(absolute_path) > 1_000_000 + @file = "File is too big!" + @too_big = true + else + @file = File.read(absolute_path) + @file = fix_encoding(@file) + end + end + end + end + if @recycle_bin + recycle_bin + else + check_path_exist('') + populate_directory(@module_key, '') + end + if request.xhr? + if @file + render :partial => "file" + elsif @recycle_bin + render :partial => "recycle_bin" + else + render :partial => "module" + end + end + end + + def recycle_bin + @thread = Multithread.where(:key=>"clean_trashes_#{@current_user_id}").first + @thread_title = nil + if @thread && @thread.status[:status] == 'finish' + @thread = nil + elsif @thread + @thread_title = I18n.t("file_manager.clean_up_recycle_bin") + end + if @thread.nil? + @thread = Multithread.where(:key=>"recover_all_#{@current_user_id}").first + if @thread && @thread.status[:status] == 'finish' + @thread = nil + elsif @thread + @thread_title = I18n.t("file_manager.recover_all") + end + end + @relative_path = I18n.t("file_manager.recycle_bin") + # @relative_to_pwd = @root_path + query_hash = {is_slave: false} + if @only_editable_for_uploader + query_hash[:user_id] = @current_user_id + end + trashes = get_trashes(query_hash).page(params[:page]).per(10) + @trashes = trashes + @module_info_dict = trashes.map{|trash| trash.module}.uniq.map{|k| [k, FileManagerSetting.get_module_info(k)]}.to_h + @directory = trashes.map do |record| + file = record.trash_path + stat = File.stat(file) rescue nil + next if stat.nil? + is_file = record.is_file + real_path_absolute = File.expand_path(file) + file = file.sub(/^#{Regexp.escape(@root_path)}/,'/') + entry = "#{file}#{is_file ? '': '/'}" + version = (record.record_only ? record.get_version : nil) + org_path = record.path.sub(/^#{Regexp.escape(@root_path)}/,'') + file_name = File.basename(file) + if version + org_path += " (version #{version})" + file_name += " (version #{version})" + end + # is_editable = @default_editable || check_editable("#{@relative_to_pwd}/#{entry}", @current_user_id) + { + size: (is_file ? (number_to_human_size stat.size rescue '-'): '-'), + type: (is_file ? :file : :directory), + date: (stat.mtime.strftime(@format_time) rescue '-'), + relative: my_escape(file).gsub('%2F', '/'), + entry: entry, + absolute: real_path_absolute, + org_path: org_path, + deleted_at: (record.created_at.strftime(@format_time) rescue '-'), + name: file_name, + module: record.module, + id: record.id.to_s, + upload_id: record.file_manager_upload_id.to_s, + version: (record.record_only ? record.get_version : nil) + # is_editable: is_editable + } + end.compact + end + + def recover_all + @current_user_id = current_user.id + thread = Multithread.where(:key=>"recover_all_#{@current_user_id}").first + if thread.nil? + thread = Multithread.create(:key=>"recover_all_#{@current_user_id}",:status=>{:status=>'Processing'}) + else + thread.update(:status=>{:status=>'Processing'}) + end + Thread.new do + query_hash = {is_slave: false} + if @only_editable_for_uploader + query_hash[:user_id] = @current_user_id + end + trashes = get_trashes(query_hash) + all_count = trashes.count + puts_every_count = [all_count * 3 / 100, 1].max + current_count = 0 + finish_percent = 0 + thread.update(:status=>{:status=>'Recovering','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent}) + trashes.each do |trash| + trash.recover_file + current_count += 1 + if current_count % puts_every_count == 0 + finish_percent = (current_count * 100.0 / all_count).round(1) + thread.update(:status=>{:status=>'Recovering','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent}) + end + end + thread.update(:status=>{:status=>'finish','all_count'=>all_count,'current_count'=>all_count,'finish_percent'=>100}) + end + render :json => {id: thread.id.to_s, title: I18n.t("file_manager.recover_all")} + end + + def clean_trashes + @current_user_id = current_user.id + thread = Multithread.where(:key=>"clean_trashes_#{@current_user_id}").first + if thread.nil? + thread = Multithread.create(:key=>"clean_trashes_#{@current_user_id}",:status=>{:status=>'Processing'}) + else + thread.update(:status=>{:status=>'Processing'}) + end + Thread.new do + query_hash = {is_slave: false} + if @only_editable_for_uploader + query_hash[:user_id] = @current_user_id + end + trashes = get_trashes(query_hash) + all_count = trashes.count + puts_every_count = [all_count * 3 / 100, 1].max + current_count = 0 + finish_percent = 0 + thread.update(:status=>{:status=>'Deleting','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent}) + trashes.each do |trash| + trash.delete_file + current_count += 1 + if current_count % puts_every_count == 0 + finish_percent = (current_count * 100.0 / all_count).round(1) + thread.update(:status=>{:status=>'Deleting','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent}) + end + end + thread.update(:status=>{:status=>'finish','all_count'=>all_count,'current_count'=>all_count,'finish_percent'=>100}) + end + render :json => {id: thread.id.to_s, title: I18n.t("file_manager.clean_up_recycle_bin")} + end + + def get_trash_count + @current_user_id = current_user.id + query_hash = {is_slave: false} + if @only_editable_for_uploader + query_hash[:user_id] = @current_user_id + end + trashes = get_trashes(query_hash) + render :json => {count: trashes.count} + end + + def destroy + if params[:permanent] == 'true' + if params[:type] == 'upload' + upload_record = FileManagerUpload.where(:id=>params[:id]).first + upload_record.delete_file_permanent(true) + else + trash = FileManagerTrash.where(:id=>params[:id]).first + trash.delete_file + end + render :body => nil, :status => 204 + else + upload_record = FileManagerUpload.where(:id=>params[:id]).first + if params[:type] == 'upload' + newest_record = upload_record.delete_file(true) + if newest_record + data = {'id': newest_record.id.to_s, 'version': newest_record.version} + else + data = {} + end + render :json => data and return + else + absolute_path = upload_record.path + if FileManagerUpload.check_restricted(absolute_path) + forbidden_error + else + relative_path = absolute_path + is_file = !(File.directory?(absolute_path)) + unless is_file + relative_path += '/' + end + upload_records = get_uploads(relative_path, is_file, {:is_default=>true}) + if is_file + upload_records.each{|record| record.delete_file(false,current_user.id, params[:force_delete] == 'true') } + else + has_matched = false + master_record_idx = upload_records.index{|record| record.path == relative_path} + master_record = upload_records[master_record_idx] + force_delete = (params[:force_delete] == 'true') + master_record.delete_file(false,current_user.id, force_delete) + upload_records.delete_at(master_record_idx) + if upload_records.count != 0 + if master_record.file_manager_trash + trash_path = master_record.file_manager_trash.trash_path + upload_records.each do |record| + record.delete_file(false,current_user.id, force_delete, true, Pathname.new(trash_path).join(record.path.sub(/^#{Regexp.escape(relative_path)}/,'')).to_s) + end + end + end + end + end + end + render :body => nil, :status => 204 + end + end + + def recover + trash = FileManagerTrash.where(:id=> params[:id]).first + if trash + trash.recover_file + render :body => nil, :status => 204 + else + render :body => nil, :status => 404 + end + end + + def rename + upload = FileManagerUpload.where(:id=>params[:id]).first + absolute_path = upload.path + @root_path = File.dirname(absolute_path) + new_path = safe_expand_path(params[:new_name]) + if new_path != absolute_path + if File.exists?(new_path) + render :body => nil, :status => 403 + else + relative_path = absolute_path + new_relative_path = Pathname.new(@root_path).join(params[:new_name]) + parent = new_path.split('/')[0..-2].join('/') + FileUtils.mkdir_p(parent) + upload_records = get_uploads(relative_path) + FileUtils.mv(absolute_path, new_path) + upload_records.each{|r| r.update_path(new_relative_path)} + render :body => nil, :status => 204 + end + else + render :body => nil, :status => 200 + end + end + + def save + if params[:content].present? + upload_item = FileManagerUpload.where(:id=>params[:id]).first + if upload_item.is_trash + absolute_path = upload_item.file_manager_trash.trash_path + else + absolute_path = upload_item.path + end + forbidden_error and return unless File.exist?(absolute_path) + file_relative_path = absolute_path + is_file = true + new_upload = upload_item.generate_new_upload + File.open(absolute_path,"w+"){|f| f.write(params[:content])} + render :json => {id: new_upload.id.to_s} + else + render :body => nil, :status => 400 + end + end + + def upload_file + input_file = params[:file] + if input_file + if params[:type] == 'update' + upload_item = FileManagerUpload.where(:id=>params[:id]).first + relative_path = upload_item.path + if input_file.original_filename != upload_item.filename + new_relative_path = Pathname.new(File.dirname(relative_path)).join(input_file.original_filename) + upload_records = get_uploads(relative_path) + FileUtils.mv(relative_path, new_relative_path) + upload_records.each{|r| r.update_path(new_relative_path)} + upload_item.reload + else + new_relative_path = relative_path + end + upload_item = upload_item.generate_new_upload + File.open(new_relative_path, 'wb') do |file| + file.write(input_file.read) + end + else + if params[:id] != 'asset' + forbidden_error and return + end + asset = current_user.assets.new + asset.data = input_file + asset.title_translations = I18n.available_locales.map{|l| [l, input_file.original_filename]}.to_h + asset.save! + upload_item = FileManagerUpload.where(:model=> "Asset", :related_id=> asset.id).first + params[:remote] = true + end + end + if params[:remote].nil? + redirect_to params[:url] + else + render :json => { + id: upload_item.id.to_s, + filename: input_file.original_filename, + size: number_to_human_size(input_file.size), + date: upload_item.created_at.strftime(@format_time) + } + end + end + + def settings + FileManagerRoot.create if FileManagerRoot.count == 0 + @root = FileManagerRoot.first + end + + def update_settings + @root = FileManagerRoot.first + @root.update_attributes(file_manager_root_params) + redirect_to admin_file_managers_settings_path + end + + def file_manager_root_params + params.require(:file_manager_root).permit! + end + + private + def get_trashes(query_hash={}) + query_hash[:file_manager_setting_id] = @setting_id ? @setting_id : FileManagerRoot.first.id + if @module_key && @module_key != 'all' + query_hash[:module] = @module_key + end + @trashes = FileManagerTrash.where(query_hash).order(:created_at=>-1) + end + + def get_uploads(tmp_path=nil, is_file=nil, extra_condition={}, order_hash={:version=>-1}) + query_hash = {} + if tmp_path != nil + query_hash[:path] = tmp_path + end + if is_file != nil + query_hash[:is_file] = is_file + query_hash[:path] = /^#{Regexp.escape(query_hash[:path].to_s)}/ if query_hash[:path] + end + query_hash[:file_manager_setting_id] = @setting_id if @setting_id + FileManagerUpload.where(query_hash.merge(extra_condition)).order(order_hash).to_a + end + + def fix_encoding(str) + if str.valid_encoding? + str + else + try_list = ["utf-8","utf-16", "big-5"] + success_flag = false + try_list.each do |enc| + begin + str.encode!(str.encoding, enc) + if str.valid_encoding? + success_flag = true + break + end + rescue => e + next + end + end + unless success_flag + str = "unknown encoding!" + @unknown_encoding = true + end + str + end + end + + def check_editable(path=nil, current_user_id=nil) + query_hash = {:path=>path,:user_id=>current_user_id} + query_hash[:file_manager_setting_id] = @setting_id + FileManagerUpload.where(query_hash).count != 0 + end + + def my_escape(string) + string.gsub(/([^ a-zA-Z0-9_.-]+)/) do + '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase + end + end + + def populate_directory(module_key, current_url) + if module_key == 'all' + @uploads = FileManagerUpload.where(:is_default=> true) + else + @uploads = FileManagerUpload.where(:module=> module_key, :is_default=> true) + end + @uploads = @uploads.where(:is_trash=> false) + if params[:keywords].present? + @uploads = @uploads.where(:filename=> /#{::Regexp.escape(params[:keywords])}/) + end + @uploads = @uploads.order_by(:created_at => :desc) + @uploads = @uploads.page(params[:page]).per(10) + current_url = '' if current_url == '/' + @module_info_dict = @uploads.map{|upload_item| upload_item.module}.uniq.map{|k| [k, FileManagerSetting.get_module_info(k)]}.to_h + @directory = @uploads.map do |upload_item| + file = upload_item.filename + real_path_absolute = upload_item.path + stat = (File.exist?(real_path_absolute) ? File.stat(real_path_absolute) : nil) + next if stat.nil? + is_file = stat.file? + entry = "#{file}#{is_file ? '': '/'}" + file_relative_path = upload_item.path + is_editable = @default_editable || check_editable(file_relative_path, @current_user_id) + { + module: upload_item.module, + is_file: is_file, + size: ((is_file && stat) ? number_to_human_size(stat.size) : '-'), + type: (is_file ? :file : :directory), + date: (stat ? stat.mtime.strftime(@format_time) : '-'), + relative: my_escape("#{current_url}#{file}").gsub('%2F', '/'), + entry: entry, + absolute: real_path_absolute, + is_editable: is_editable, + id: (upload_item ? upload_item.id.to_s : nil) + } + end.compact + end + + def safe_expand_path(path) + current_directory = File.expand_path(@root_path) + tested_path = File.expand_path(path, @root_path) + if @disable_path_traversal && !(tested_path.starts_with?(current_directory)) + raise ArgumentError, 'Should not be parent of root' + end + tested_path + end + + def check_path_exist(path) + @absolute_path = safe_expand_path(path) + @relative_path = path + raise ActionController::RoutingError, 'Not Found' unless File.exists?(@absolute_path) + @absolute_path + end + + def set_base_url + @base_url = ENV['BASE_URL'] || 'root' + @root_path = ENV['BASE_DIRECTORY'] || FileManagerRoot::RootPath + @root = FileManagerRoot.first + @disable_path_traversal = @root.disable_path_traversal + @format_time = I18n.locale.to_s == 'zh_tw' ? '%Y/%m/%d %H:%M' : '%d %b %Y %H:%M' + @setting = FileManagerSetting.first + @only_editable_for_uploader = false + @setting_id = nil + if @setting + @setting_id = @setting.id + @root_path = Pathname.new(@root_path).join(@setting.root_path).to_s + @only_editable_for_uploader = @setting.only_editable_for_uploader + end + @default_editable = !@only_editable_for_uploader + @module_key = params[:id] + @display_module_name = (@module_key == 'all') + @display_uploader_region = (@module_key == 'asset') + @module = ModuleApp.where(:key=> @module_key).first + module_info = FileManagerSetting.get_module_info(@module_key) + @module_title = (module_info ? module_info[:title] : nil) + @only_select_folder = (params[:select_mode] == 'true') + end +end diff --git a/app/controllers/file_managers_controller.rb b/app/controllers/file_managers_controller.rb new file mode 100644 index 0000000..c0cd603 --- /dev/null +++ b/app/controllers/file_managers_controller.rb @@ -0,0 +1,97 @@ +class FileManagersController < ApplicationController + include ActionView::Helpers::NumberHelper + before_action :check_login? , :set_base_url, except: [:download] + layout "file_manager" + def render_403 + render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => 403, :formats => [:html] + end + def render_404 + render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => 404, :formats => [:html] + end + def forbidden_error + render :body => nil, :status => 403 + end + def self.custom_widget_data + @root = FileManagerRoot.first + @settings = @root.file_manager_settings rescue [] + ac = ActionController::Base.new + ac.render_to_string("file_managers/custom_widget_data",:locals=>{:@custom_data_field=>@custom_data_field,:@field_name=>@field_name,:@settings=>@settings}) + end + def check_login? + @current_user = current_user + @current_user_id = current_user.id + if @current_user + if ['index_backend','path'].include?( params[:action] ) && params[:setting_id].blank? + module_app = ModuleApp.where(:key=>'file_manager').first + unless (@current_user.is_admin_for_module?(module_app) rescue true) + render_403 and return + end + end + else + render_403 and return + end + end + def download + upload = FileManagerUpload.where(:id=>params[:id]).first + if upload + if upload.is_trash + if upload.file_manager_trash + send_file(upload.file_manager_trash.trash_path) + else + render_404 + end + else + options = {} + if params[:preview] + options[:disposition] = 'inline' + end + send_file(upload.get_real_path, options) + end + else + render_404 + end + end + + private + def check_editable(path=nil, current_user_id=nil) + query_hash = {:path=>path,:user_id=>current_user_id} + query_hash[:file_manager_setting_id] = @setting_id + FileManagerUpload.where(query_hash).count != 0 + end + + def safe_expand_path(path) + current_directory = File.expand_path(@root_path) + tested_path = File.expand_path(path, @root_path) + if @disable_path_traversal && !(tested_path.starts_with?(current_directory)) + raise ArgumentError, 'Should not be parent of root' + end + tested_path + end + + def check_path_exist(path) + @absolute_path = safe_expand_path(path) + @relative_path = path + raise ActionController::RoutingError, 'Not Found' unless File.exists?(@absolute_path) + @absolute_path + end + + def set_base_url(tmp_params=params) + @base_url = ENV['BASE_URL'] || 'root' + @root_path = ENV['BASE_DIRECTORY'] || FileManagerRoot::RootPath + @root = FileManagerRoot.first + @disable_path_traversal = @root.disable_path_traversal + @format_time = I18n.locale.to_s == 'zh_tw' ? '%Y/%m/%d %H:%M' : '%d %b %Y %H:%M' + if tmp_params[:setting_id].present? + @setting = FileManagerSetting.find(tmp_params[:setting_id]) rescue nil + end + @only_editable_for_uploader = false + @setting_id = nil + if @setting + @setting_id = @setting.id + @root_path = Pathname.new(@root_path).join(@setting.root_path).to_s + @only_editable_for_uploader = @setting.only_editable_for_uploader + end + @default_editable = !@only_editable_for_uploader + @only_select_folder = (tmp_params[:select_mode] == 'true') + end +end diff --git a/app/helpers/file_managers_helper.rb b/app/helpers/file_managers_helper.rb new file mode 100644 index 0000000..891b6d1 --- /dev/null +++ b/app/helpers/file_managers_helper.rb @@ -0,0 +1,54 @@ +module FileManagersHelper + def fa_icon(icon_name, text="") + "#{text}".html_safe + end + def generate_breadcrumb + breadcrumb_contents = "" + url_infos = [ + { + type: "key", + key: "all", + trans: I18n.t(:all) + } + ] + if @module_key != 'all' + url_infos << { + type: "key", + key: @module_key, + trans: @module_title + } + end + if @recycle_bin || (@upload_item && @upload_item.is_trash) + url_infos << { + type: "recycle", + key: (@upload_item ? @upload_item.module : nil), + trans: I18n.t("file_manager.recycle_bin") + } + end + if @file + filename = @upload_item.filename + version = @upload_item.version + if @upload_item.is_trash && @upload_item.file_manager_trash.record_only + filename += " (version #{version})" + end + url_infos << { + type: "file", + trans: filename + } + end + last_idx = url_infos.count - 1 + url_infos.each_with_index do |info, i| + if i == last_idx + breadcrumb_contents += info[:trans] + else + if info[:type] == 'recycle' + breadcrumb_contents += "#{info[:trans]}" + else + breadcrumb_contents += "#{info[:trans]}" + end + breadcrumb_contents += "/" + end + end + breadcrumb_contents.html_safe + end +end diff --git a/app/models/file_manager_root.rb b/app/models/file_manager_root.rb new file mode 100644 index 0000000..415f9a5 --- /dev/null +++ b/app/models/file_manager_root.rb @@ -0,0 +1,8 @@ +class FileManagerRoot + include Mongoid::Document + include Mongoid::Timestamps + RootPath = "public/" + field :disable_path_traversal, :type => Boolean, :default => true + has_many :file_manager_settings, :autosave => true, :dependent => :destroy + accepts_nested_attributes_for :file_manager_settings, :allow_destroy => true +end \ No newline at end of file diff --git a/app/models/file_manager_setting.rb b/app/models/file_manager_setting.rb new file mode 100644 index 0000000..2b7a4ad --- /dev/null +++ b/app/models/file_manager_setting.rb @@ -0,0 +1,284 @@ +class FileManagerSetting + include Mongoid::Document + include Mongoid::Timestamps + field :only_editable_for_uploader, type: Boolean, default: false + field :root_path, type: String, default: "" + field :modules_saved_info, type: Hash, default: {} + field :modules_keys, type: Array, default: [] + belongs_to :file_manager_root + has_many :file_manager_uploads + has_many :file_manager_trashes + + @@mutex = Mutex.new + @@resource = ConditionVariable.new + + def self.get_models_uploaders + if !self.class_variable_defined?(:@@get_models_uploaders) + @@get_models_uploaders = false + end + if @@get_models_uploaders + @@mutex.synchronize { + @@resource.wait(@@mutex) + } + end + @@get_models_uploaders = true + if self.class_variable_defined?(:@@modules_info) + @@get_models_uploaders = false + return @@modules_info + end + setting = self.first + if setting.nil? + setting = self.create + end + modules_info = {} + file_only_models = [] + user_id_fields = ['user_id', 'create_user_id', 'update_user_id'] + user_id_field_info = {} + Rails::Engine.descendants.each do |engine| + unless engine.abstract_railtie? || engine.initializers.blank? + module_name = engine.initializers[0].name + if ModuleApp.where(:key=> module_name).count > 0 + models_path = Dir.glob("#{engine.root}/app/models/*") + uploaders = {} + models_path.each do |path| + begin + require File.basename(path) + m = File.basename(path).sub(/\..+/, '').camelize.constantize + if m.uploaders.count > 0 + user_id_field = nil + user_id_fields.each do |f| + if m.fields.include?(f) + user_id_field = f + break + end + end + if user_id_field.nil? + user_id_field = m.fields.select{|f| f.include?('user_id')}.first + end + user_id_field_info[m] = user_id_field + uploaders_info = {} + obj = m.new(:id=>nil) + m.uploaders.each do |field, uploader_klass| + uploaders_info[field] = { + uploader_klass => "public/" + obj.send(field).store_dir + } + end + self.set_record_callback(setting, module_name, m, user_id_field) + uploaders[m] = uploaders_info + m_str = m.to_s + if m_str.match(/(File|Image)$/) + file_only_models << m_str + else + belongs_to_fields = m.relations.select{|k,v| v.macro == :belongs_to}.keys + if belongs_to_fields.count > 0 && (m.relations.count - belongs_to_fields.count) == 0 + fields = m.fields.keys - belongs_to_fields.map{|s| "#{s}_id"} + fields = fields - ["_id", "created_at", "updated_at", "description", "title", "title_translations", "rss2_id", "order", "choose_lang", "privacy_type", "should_destroy", "file_title", "download_count", "sort_number"] + if (fields - m.uploaders.keys.map(&:to_s)).count == 0 + file_only_models << m_str + end + end + end + end + rescue LoadError + end + end + if uploaders.count > 0 + modules_info[module_name] = uploaders + end + end + end + end + begin + require 'asset' + module_name = 'asset' + m = Asset + uploaders = {} + if m.uploaders.count > 0 + uploaders_info = {} + obj = m.new(:id=>nil) + m.uploaders.each do |field, uploader_klass| + uploaders_info[field] = { + uploader_klass => "public/" + obj.send(field).store_dir + } + end + uploaders[m] = uploaders_info + user_id_field = nil + user_id_fields.each do |f| + if m.fields.include?(f) + user_id_field = f + break + end + end + if user_id_field.nil? + user_id_field = m.fields.select{|f| f.include?('user_id')}.first + end + user_id_field_info[m] = user_id_field + self.set_record_callback(setting, module_name, m, user_id_field) + user_id_field + end + modules_info[module_name] = uploaders + file_only_models << m.to_s + rescue LoadError + end + @@file_only_models = file_only_models + @@user_id_field_info = user_id_field_info + @@modules_info = modules_info + @@mutex.synchronize { + @@get_models_uploaders = false + @@resource.signal + } + modules_info + end + + def self.set_record_callback(setting, module_name, m, user_id_field) + uploader_fields = m.uploaders.keys + m_str = m.to_s + m.before_save do |record| + uploader_fields.each{|f| record.instance_variable_set("@#{f}_changed", record.send("#{f}_changed?"))} + true + end + m.after_save do |record| + uploader_fields.each do |f| + f_changed = "@#{f}_changed" + if record.instance_variable_get(f_changed) + store_path = "public#{URI.decode(record.send(f).url)}" + if user_id_field + user_id = record.send(user_id_field) + else + user_id = nil + end + basic_info = {:module=> module_name, :model=>m_str, :related_field=> f, :related_id => record.id} + other_info = {:path=> store_path, :user_id=> user_id, :is_default=>true, :created_at => record.created_at, :updated_at => record.updated_at} + full_info = other_info.merge(basic_info) + old_record = setting.file_manager_uploads.where(basic_info).first + if old_record.nil? + setting.file_manager_uploads.create(full_info) + else + old_record.update_attributes(other_info) + end + end + record.remove_instance_variable(f_changed) unless record.instance_variable_get(f_changed).nil? + end + true + end + m.after_destroy do |record| + unless record.instance_variable_get(:@skip_remove_callback) + setting.file_manager_uploads.where(:model=>m_str, :related_id => record.id).destroy + end + true + end + end + + def self.file_only_models + unless self.class_variable_defined?(:@@file_only_models) + self.get_models_uploaders + end + return @@file_only_models + end + + def self.get_module_info(key) + if key == 'all' + title = I18n.t("file_manager.all_files") + link = nil + icon_class = 'icons-disk' + sidebar = nil + elsif key == 'asset' + title = I18n.t('filemanager') + link = Rails.application.routes.url_helpers.admin_assets_path + icon_class = 'icons-folder' + sidebar = nil + else + module_app = ModuleApp.where(:key=>key).first + return if module_app.nil? + t = module_app.get_registration + return if t.nil? + sidebar = t.get_side_bar + if sidebar + t = sidebar + icon_class = t.get_icon_class + module_label = t.instance_variable_get(:@head_label) + link = t.instance_variable_get(:@head_link) + if link + link = Rails.application.routes.url_helpers.send(link) + end + else + icon_class = module_app.icon_class_no_sidebar + module_label = t.instance_variable_get(:@module_label) + plugin_t = OrbitApp::Plugin::Registration.find_by_module_app_name(module_app.title) + link = plugin_t.admin_partial_path if plugin_t + end + title = I18n.t(module_label) + end + { + :title => title, + :link => link, + :icon_class => icon_class, + :sidebar => sidebar + } + end + + def create_records + modules_info = self.class.get_models_uploaders + models_dict = self.modules_saved_info + modules_info.each do |module_key, uploaders| + uploaders.each do |m, uploaders_info| + m_str = m.to_s + if models_dict[m_str].nil? + models_dict[m_str] = nil + end + end + end + self.modules_saved_info = models_dict + self.modules_keys = modules_info.keys + self.save + modules_info.each do |module_key, uploaders| + # module_app = ModuleApp.where(:key=> module_key).first + # I18n.t("module_name.#{module_key}") + uploaders.each do |m, uploaders_info| + user_id_field = @@user_id_field_info[m] + uploader_fields = uploaders_info.keys + records = m.any_of(uploader_fields.map{|f| {f => {"$ne" => nil}}}) + m_str = m.to_s + if self.modules_saved_info[m_str] + records = records.where(:created_at.gte=> (self.modules_saved_info[m_str] - 1)) + end + records = records.order_by(:created_at=> :asc).to_a + records_last_idx = records.length - 1 + records.each_with_index do |r, i| + uploader_fields.each do |f| + f_value = r.send(f) + if f_value.present? + store_path = "public#{URI.decode(f_value.url)}" + unless File.exist?(store_path) + next + end + if user_id_field + user_id = r.send(user_id_field) + else + user_id = nil + end + basic_info = {:module=> module_key, :model=> m.to_s, :related_field=> f, :related_id => r.id, :is_default=> true} + other_info = {:path=> store_path, :user_id=> user_id, :created_at => r.created_at, :updated_at => r.updated_at} + full_info = other_info.merge(basic_info) + old_record = self.file_manager_uploads.where(basic_info).first + if old_record.nil? + self.file_manager_uploads.create(full_info) + else + old_record.update_attributes(other_info) + end + end + end + if i % 10 || i == records_last_idx + puts "#{m} updated at #{r.created_at}" + self.class.where(:id=>self.id).update_all("modules_saved_info.#{m}" => r.created_at.to_i) + end + end + end + end + end + + def get_modules_keys + _modules_keys = self.modules_keys.sort + _modules_keys = ["all"] + ["asset"] + (_modules_keys - ["asset"]) + end +end \ No newline at end of file diff --git a/app/models/file_manager_trash.rb b/app/models/file_manager_trash.rb new file mode 100644 index 0000000..45dd06b --- /dev/null +++ b/app/models/file_manager_trash.rb @@ -0,0 +1,83 @@ +class FileManagerTrash + include Mongoid::Document + include Mongoid::Timestamps + Restrict_dirs = ["/", "/home/", "/etc/", "/var/*/", "/root/", "/usr/*/"] + field :is_file, type: Boolean, default: true + field :module, type: String, default: "" + field :path, type: String, default: "" + field :trash_path, type: String, default: "" + field :user_id + field :is_slave, type: Boolean, default: false + field :record_only, type: Boolean, default: false + belongs_to :file_manager_upload, index: true + belongs_to :file_manager_setting + index({module: 1}, { unique: false, background: true }) + index({created_at: -1}, { unique: false, background: true }) + before_create do + if self.trash_path.blank? + self.trash_path = Pathname.new("#{FileManagerRoot::RootPath}").join(self.file_manager_setting && self.file_manager_setting.class == FileManagerSetting ? self.file_manager_setting.root_path : '').join(".trash/#{self.file_manager_setting_id}/#{self.id}/#{File.basename(self.path)}") + trash_dir = File.dirname(self.trash_path) + FileUtils.mkdir_p(trash_dir) + upload = self.file_manager_upload + if File.exist?(upload.get_real_path) + FileUtils.mv(upload.get_real_path, self.trash_path) + end + end + end + before_destroy do + upload = self.file_manager_upload + if upload + if upload.is_default + upload.remove_file_callback + end + if self.record_only + upload.destroy + else + FileManagerUpload.where(:path=> upload.path).destroy + end + end + true + end + def get_version + return (self.file_manager_upload ? self.file_manager_upload.version : 1) + end + def delete_file + self.class.delete_file_permanent(self.path, File.dirname(self.trash_path), self.record_only) + unless self.is_file + self.class.where(:trash_path=>/^#{::Regexp.escape(self.trash_path)}/,:is_slave=>true).destroy + end + self.destroy + end + def self.check_restricted(path) + return Restrict_dirs.map{|d| path.match("^#{d.gsub('/*/','/.*')}[^/]+(/|)$")}.compact.length > 0 + end + def self.delete_file_permanent(path, trash_path=nil, only_self=false) + unless self.check_restricted(path) + dir = File.dirname(path) + basename = File.basename(path) + if trash_path + FileUtils.rm_rf(trash_path) + else + FileUtils.rm_rf(path) + end + unless only_self + Dir.glob("#{dir}/.versions/*/#{basename}").each{|f| FileUtils.rm_rf(f)} + end + else + puts "Path: #{path}" + puts "File or Directory restricted!" + end + end + def recover_file + if File.exist?(self.trash_path) + dir = File.dirname(self.path) + FileUtils.mkdir_p(dir) + FileUtils.mv(self.trash_path, self.path) + end + self.file_manager_upload.update(:is_trash=>false) if self.file_manager_upload + unless self.is_file + self.class.where(:trash_path=>/^#{::Regexp.escape(self.trash_path)}/,:is_slave=>true).delete + end + self.delete + end +end \ No newline at end of file diff --git a/app/models/file_manager_upload.rb b/app/models/file_manager_upload.rb new file mode 100644 index 0000000..e650feb --- /dev/null +++ b/app/models/file_manager_upload.rb @@ -0,0 +1,172 @@ +class FileManagerUpload + include Mongoid::Document + include Mongoid::Timestamps + Restrict_dirs = ["/", "/home/", "/etc/", "/var/*/", "/root/", "/usr/*/"] + field :module, type: String, default: "" + field :model, type: String, default: "" + field :related_field, type: String, default: "" + field :related_id, type: BSON::ObjectId + field :is_file, type: Boolean, default: true + field :filename, type: String, default: "" + field :path, type: String, default: "" + field :version, type: Integer, default: 1 + field :is_default, type: Boolean, default: false + field :user_id + field :is_trash, type: Boolean, default: false + belongs_to :file_manager_setting + has_one :file_manager_trash + index({model: 1, related_field: 1, related_id: 1}, { unique: false, background: true }) + index({module: 1}, { unique: false, background: true }) + index({version: -1}, { unique: false, background: true }) + index({created_at: -1}, { unique: false, background: true }) + index({path: 1}, { unique: false, background: true }) + index({filename: 1}, { unique: false, background: true }) + index({is_trash: 1}, { unique: false, background: true }) + + before_save do + self.filename = File.basename(self.path) + if self.filename_changed? && self.related_id.present? + m = self.model.constantize + info = {self.related_field => self.filename} + if self.model == 'Asset' + I18n.available_locales.each do |l| + info["title.#{l}"] = self.filename + end + end + m.where(:id=> self.related_id).update_all(info) + end + true + end + + def self.check_restricted(path) + return Restrict_dirs.map{|d| path.match("^#{d.gsub('/*/','/.*')}[^/]+(/|)$")}.compact.length > 0 + end + + def get_related + begin + m = self.model.constantize + related = m.where(:id=> self.related_id).first + rescue => e + related = nil + puts "get_related: #{e}" + end + related + end + + def generate_new_upload + clone_record = self.clone + clone_record.is_trash = false + clone_record.created_at = Time.now + clone_record.updated_at = Time.now + self.update_path(self.path, self.is_default ,true) + clone_record.version += 1 + clone_record.save + clone_record + end + def delete_file(record_only=false,override_user_id=nil, real_delete=false, is_slave=false, trash_path=nil) + if !real_delete + unless self.is_trash + unless self.is_file + if !is_slave && Dir.glob(Pathname.new(self.path).join("*").to_s).count == 0 #remove empty dir + self.delete_file_permanent + return + end + end + override_user_id = self.user_id if override_user_id.nil? + unless self.class.check_restricted(self.path) + setting = self.file_manager_setting + setting = FileManagerRoot.first if setting.nil? + self.file_manager_trash = FileManagerTrash.create(:record_only=>record_only,:file_manager_upload=>self,:is_file=>is_file,:user_id=>override_user_id,:module=>self.module,:path=>self.path,:file_manager_setting=>setting,:is_slave=>is_slave, :trash_path=>trash_path) + self.update(:is_trash => true) + if record_only + other_records = self.class.where(:path=>self.path,:id.ne=>self.id,:is_trash=>false).order_by(:version=>-1).to_a + if other_records.count != 0 + newest_record = other_records[0] + if self.is_default + newest_record.update_path(self.path, true) + end + newest_record + else + nil + end + end + else + puts "Path: #{path}" + puts "File or Directory restricted!" + end + end + else + self.delete_file_permanent + end + end + def delete_file_permanent(only_self=false) + if only_self + real_path = self.get_real_path + FileManagerTrash.delete_file_permanent(real_path, nil, true) + unless self.is_default + dir = File.dirname(real_path) + if Dir.entries(dir).empty? + FileUtils.rm_rf(dir) + end + end + related = self.get_related + if self.is_default + other_records = self.class.where(:file_manager_setting=>self.file_manager_setting,:path=>self.path,:id.ne=>self.id).order_by(:version=>-1) + if other_records.count != 0 + newest_record = other_records[0] + real_old_path = newest_record.get_real_path(self.path) + newest_record.update_path(self.path, true) + dir = File.dirname(real_old_path) + if (Dir.entries(dir) - ['.','..']).empty? + FileUtils.rm_rf(dir) + end + self.update(:is_default => false) + end + end + self.destroy + else + FileManagerTrash.delete_file_permanent(self.path) + self.class.where(:file_manager_setting=>self.file_manager_setting,:path=>self.path,:is_trash=>false).destroy + end + end + def get_real_path(tmp_path=self.path, override_default=self.is_default) + return (override_default ? tmp_path : "#{File.dirname(tmp_path)}/.versions/v#{self.version}/#{File.basename(tmp_path)}#{self.is_file ? '' : '/'}") + end + def update_path(new_path, override_default = nil, move_to_old_version=false, copy_mode=false) + override_default = self.is_default if override_default.nil? + real_old_path = self.get_real_path(self.path) + if move_to_old_version + real_new_path = self.get_real_path(new_path, false) + self.is_default = false + else + self.is_default = override_default + real_new_path = self.get_real_path(new_path, override_default) + end + if File.exist?(real_old_path) + dir = File.dirname(real_new_path) + FileUtils.mkdir_p(dir) + if real_old_path != real_new_path + FileUtils.mv(real_old_path, real_new_path) + end + end + self.path = new_path + self.save + if self.is_default && self.related_id.present? + m = self.model.constantize + m.where(:id=>self.related_id).update_all(self.related_field => self.filename) + end + self + end + + def remove_file_callback + m = self.model.constantize + if FileManagerSetting.file_only_models.include?(self.model) + m.where(:id=>self.related_id).to_a.each do |record| + record.instance_variable_set(:@skip_remove_callback, true) + record.destroy + end + else + m.where(:id=>self.related_id).update_all(self.related_field => nil) + end + end +end \ No newline at end of file diff --git a/app/views/admin/file_managers/_file.html.erb b/app/views/admin/file_managers/_file.html.erb new file mode 100644 index 0000000..4a2e182 --- /dev/null +++ b/app/views/admin/file_managers/_file.html.erb @@ -0,0 +1,95 @@ +

<%= generate_breadcrumb %>

+
+ + <% if !@upload_item.is_trash && @all_uploads && @all_uploads.count > 1 %> + <%= link_to "javascript:void(0)", class: 'delete_file', data: { "tmp-confirm"=> "Are you sure you want to delete `#{URI.decode(@relative_path) + ' - Version ' + @active_version.to_s}`?", "link"=> admin_file_manager_path(@upload_item.id, :type=> 'upload'), "version"=> @active_version } do %> + <%= fa_icon 'trash' %> <%= t("file_manager.delete") %> + <% end %> + <% end %> + <%= link_to "/xhr/file_manager_download?id=#{@upload_item.id}", class: 'download' do %> + <%= fa_icon 'download' %> Download + <% end %> + <% if !@upload_item.is_trash %> + <% if !@is_img && !@too_big && !@unknown_encoding %> + <%= link_to "javascript:void(0)", class: 'edit' do %> + <%= fa_icon 'edit' %> Edit + <% end %> + <%= link_to "javascript:void(0)", class: 'save hide', data: {id: @upload_item.id.to_s} do %> + <%= fa_icon 'save' %> Save + <% end %> + <% end %> +
+ + +
+ <% end %> +
+<% if @all_uploads && @all_uploads.count > 1 %> + +<% end %> +
+<% if @is_img %> +
+ +<% elsif File.extname(@upload_item.path) == '.pdf' %> +