Sha256: 224bdabea93cccb0549e239f034f5ebdb671998af2111e350448993eee81abf0

Contents?: true

Size: 707 Bytes

Versions: 6

Compression:

Stored size: 707 Bytes

Contents

require "thecore_backend_commons"
require "haml"
require "haml-rails"
# require "serviceworker-rails"
require "groupdate"
require "apexcharts"

require "thecore_ui_commons/engine"

module ThecoreUiCommons
	def self.save_files files
		files.each do |pic|
			upload_dir = Rails.root.join(Settings.ns(:importer).import_from_folder, 'uploads')
			FileUtils.mkdir_p upload_dir
			file_to_upload = Rails.root.join(upload_dir, "uploaded-#{Time.now.strftime("%Y%m%d%H%M%S%L")}-#{pic.original_filename}")
			
			File.open(file_to_upload, 'wb') { |file| file.write(pic.read) } if Regexp.new("\\.#{Settings.ns(:importer).extension.gsub(/ +/, "").split(",").join("|\\.")}$").match? pic.original_filename
		end
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
thecore_ui_commons-3.1.9 lib/thecore_ui_commons.rb
thecore_ui_commons-3.1.8 lib/thecore_ui_commons.rb
thecore_ui_commons-3.1.7 lib/thecore_ui_commons.rb
thecore_ui_commons-3.1.6 lib/thecore_ui_commons.rb
thecore_ui_commons-3.1.5 lib/thecore_ui_commons.rb
thecore_ui_commons-3.1.4 lib/thecore_ui_commons.rb