# 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, left: 0, top: 0}, table: { type: :table, left: 0, top: 0, option: {}}, # 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: 39, height: 39, apply: [:box_color], left: 0, top: 0 }, # intuition: { type: :intuition, width: 39, height: 39, # apply: [:box_color], # left: 0, top: 0, preset: :intuition }, vector: { type: :vector, width: 39, height: 39, left: 0, top: 0, preset: :vector, definition: corp }, # circle: { type: :shape, width: 39, height: 39, smooth: '100%', # apply: [:circle_color], # left: 0, top: 0, preset: :circle }, shape: { type: :shape, width: 39, height: 39, apply: [:shape_color], left: 0, top: 0 }, text: { type: :text, component: { size: 12 },left: 0, top: 0, apply: [:text_color], width: :auto, height: :auto, language: :english }, drm: { type: :drm, attach: :black_matter }, shadow: { type: :shadow, red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 }, border: { type: :border, red: 0, green: 0, blue: 0, alpha: 0, pattern: :solid, thickness: 6 }, 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