Sha256: 88966e0bb0a9dc0aa620c6c4a043976dd4ccee959d79f1a15e6edc2fff81b340

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

require 'thecore_background_jobs' # This brings backend commons also.
# Rails
require 'serviceworker-rails'
require "groupdate"
require "apexcharts"
# require "gtk3"
# require "cairo"
# require "poppler"
require "image_processing"

require 'concerns/thecore_ui_commons_user'

# require 'helpers/thecore_ui_commons_helper'
# require 'helpers/charts_helper'

require "thecore_ui_commons/engine"

module ThecoreUiCommons
  # Your code goes here...

	def self.save_files files
		Rails.logger.debug "AAAAAAAAAAA: POST?"
		files.each do |pic|
			# Rails.logger.debug "AAAAAAAAAAA: EACH PIC: #{pic.inspect}"
			upload_dir = Rails.root.join(Settings.ns(:importer).import_from_folder, 'uploads')
			FileUtils.mkdir_p upload_dir
			# Rails.logger.debug "AAAAAAAAAAA: Fatto MKDIR di #{upload_dir}"
			file_to_upload = Rails.root.join(upload_dir, "uploaded-#{Time.now.strftime("%Y%m%d%H%M%S%L")}-#{pic.original_filename}")
			# Rails.logger.debug "AAAAAAAAAAA: File da uploadare #{file_to_upload}"
			# Rails.logger.debug "AAAAAAAAAAA: File da uploadare esiste? #{File.exists?(file_to_upload)}"
			File.open(file_to_upload, 'wb') do |file|
				# Rails.logger.debug "AAAAAAAAAAAAAAAAAA: Dentro alla scrittura"
				file.write(pic.read)
			end if Regexp.new("\\.#{Settings.ns(:importer).extension.gsub(/ +/, "").split(",").join("|\\.")}$").match? pic.original_filename
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thecore_ui_commons-2.5.2 lib/thecore_ui_commons.rb
thecore_ui_commons-2.5.1 lib/thecore_ui_commons.rb