vendor/assets/src/medias/rubies/examples/_table2.rb in atome-0.5.3.4 vs vendor/assets/src/medias/rubies/examples/_table2.rb in atome-0.5.3.7.2

- old
+ new

@@ -1,38 +1,108 @@ # frozen_string_literal: true -params = { +generator = Genesis.generator - id: :my_table, left: 0, top: 0, width: 500, height: 399, smooth: 8, color: :yellowgreen, - columns: { count: 8, - titles: { 1 => :col1, 3 => :mycol }, - data: { 3 => :col_content }, - actions: { 2 => { touch: :the_action } }, - particles: { color: :blue } - }, - rows: { count: 6, - titles: { 1 => :my_first_row, 5 => :other_row }, - data: { 0 => :col_content }, - actions: {}, - particles: { shadows: :black } - }, - cells: { - # data: { 0 => :here, 2 => "hello", 4 => :hi, 5 => :good, 7 => :super }, - # actions: { 2 => { touch: :my_lambda } }, - particles: { margin: 9, color: :blue, smooth: 9, shadow: { blur: 9, left: 3, top: 3 } } - }, - exceptions: { - columns: { - # divided: { 2 => 3 }, - fusion: { 1 => [3, 5], 7 => [2, 5] } - }, - rows: { - divided: { 1 => 3 }, - fusion: { 2 => [0, 3], 5 => [2, 5] } - } - } -} +# generator.build_atome(:collector) +class Atome + # + def cells(cells_number) + # collector({id: :toto, renderers: [], children: [], parents: []}) + # collector_object = collector({}) + collector_object = collector + collected_atomes = [] + cells_number.each do |cell_found| + atome_found = grab("#{id}_#{cell_found}") + collected_atomes << atome_found + end + # collector_object.data(collected_atomes) + # collector_object + end -matrix(params) -# matrix({ id: :totot,columns: { count: 24 } }) -# matrix + def cell(cell_nb) + grab("#{id}_#{cell_nb}") + end + +end + +# class Batch +# +# def each(&proc) +# value.each do |val| +# instance_exec(val, &proc) if proc.is_a?(Proc) +# end +# end +# +# def id(val = nil) +# if val +# @id = val +# else +# @id +# end +# end +# +# def initialize(params) +# @id = params[:id] || "batch_#{Universe.atomes.length}" +# Universe.add_to_atomes(@id, self) +# end +# +# def dispatch (method, *args, &block) +# @data.each do |atome_found| +# atome_found.send(method, *args, &block) +# end +# end +# +# # TODO: automatise collector methods creation when creato,g a new atome type +# def color(args, &block) +# +# dispatch(:color, args, &block) +# end +# +# def shadow(args, &block) +# dispatch(:color, args, &block) +# end +# +# def method_missing(method, *args, &block) +# dispatch(method, args, &block) +# end +# +# def data(collection) +# @data = collection +# end +# +# end + +generator = Genesis.generator +generator.build_atome(:collector) do |params = {}, &bloc| + atome_type = :collector + generated_render = params[:renderers] || [] + generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}" + generated_parents = params[:parents] || [id.value] + generated_children = params[:children] || [] + params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params) + Batch.new({ atome_type => params }, &bloc) +end + + +generator.build_atome(:barnabe) +# # +# # TODO : make the code below works +# # alert 'solve this' +# # b=box({width: 600, height: 600}) +# # b.matrix({width: '100%', height: '100%'}) +# +# # matrix({ id: :totot,columns: { count: 24 } }) +# m = matrix +# # m.collector({id: :toto, renderers: [], children: [], parents: []}) +# m.cells([20, 5]) +# # m.cells([20, 5]).color(:red) +# # m.columns(≈6).data[0..3].color(:green) +# # alert :plp +# ####### +# b=box +# c=b.collector + # c.data +# alert c.data +b=barnabe.id(:ttot) +alert b.id +# alert b.data(33) \ No newline at end of file