# frozen_string_literal: true # use to sanitize and secure user input module Essentials corp = <<~STR STR @default_params = { # Warning : type must be define first render_engines: [:html], image: { type: :image }, # FIXME : look at build_atome FIXME to resolve default parent attachment problem video: { type: :video }, animation: { type: :animation, attach: :black_matter }, element: { type: :element, renderers: [], attach: :black_matter }, box: { type: :shape, width: 99, height: 99, apply: [:box_color], left: 100, top: 100, preset: :box }, vector: { type: :vector, width: 99, height: 99, left: 100, top: 100, preset: :vector, definition: corp }, circle: { type: :shape, width: 99, height: 99, smooth: '100%', apply: [:circle_color], left: 100, top: 100, preset: :circle }, shape: { type: :shape, width: 99, height: 99, apply: [:shape_color], left: 100, top: 100 }, text: { type: :text, component: { size: 18 }, apply: [:text_color], width: :auto, height: :auto }, drm: { type: :drm, attach: :black_matter }, shadow: { type: :shadow, red: 0, green: 0, blue: 0, alpha: 0 }, color: { type: :color, red: 0, green: 0, blue: 0, alpha: 1} } def self.default_params @default_params end def self.new_default_params(new_default) @default_params.merge!(new_default) end def validation(atome_instance_var) # TODO: write validation scheme true if atome_instance_var end def add_essential_drm(params) essential_drm = { authorisation: { read: [Atome.current_user], write: [Atome.current_user] }, atome: { read: [:all], write: [:me] } } params[:drm] = if params[:drm] essential_drm.merge(params[:drm]) else essential_drm end end end