mirror of
https://github.com/mistergibson/gxg-web-client.git
synced 2026-08-15 03:26:00 -07:00
altered Hash/Array/Detached/Persisted path system
This commit is contained in:
parent
c80e2ca6a5
commit
26827a4b36
6 changed files with 53 additions and 70 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
# backtick_javascript: true
|
||||||
# Alteration to Opal's Buffer::Array
|
# Alteration to Opal's Buffer::Array
|
||||||
class Buffer
|
class Buffer
|
||||||
class Array
|
class Array
|
||||||
|
|
@ -645,23 +646,20 @@ class Hash
|
||||||
end
|
end
|
||||||
last_container = container
|
last_container = container
|
||||||
end
|
end
|
||||||
if selector.is_a?(Symbol)
|
safe_key = selector.to_s
|
||||||
safe_key = (":" + selector.to_s)
|
# xxx
|
||||||
else
|
# if selector.is_a?(Symbol)
|
||||||
safe_key = selector.to_s
|
# safe_key = (":" + selector.to_s)
|
||||||
end
|
# else
|
||||||
|
# safe_key = selector.to_s
|
||||||
|
# end
|
||||||
|
# xxx
|
||||||
safe_key = safe_key.gsub("/","%2f")
|
safe_key = safe_key.gsub("/","%2f")
|
||||||
path_stack.unshift(safe_key)
|
path_stack.unshift(safe_key)
|
||||||
# compare the_value
|
# compare the_value
|
||||||
found = false
|
found = false
|
||||||
if the_value.is_a?(::GxG::Database::Field)
|
if (the_value == the_object)
|
||||||
if (the_value.content == the_object)
|
found = true
|
||||||
found = true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if (the_value == the_object)
|
|
||||||
found = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if found
|
if found
|
||||||
search_results << ("/" + path_stack.reverse.join("/"))
|
search_results << ("/" + path_stack.reverse.join("/"))
|
||||||
|
|
@ -695,9 +693,7 @@ class Hash
|
||||||
else
|
else
|
||||||
element = path_element
|
element = path_element
|
||||||
element = element.gsub("%2f","/")
|
element = element.gsub("%2f","/")
|
||||||
if element[0] == ":"
|
element = element.to_sym
|
||||||
element = element[(1..-1)].to_sym
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if element
|
if element
|
||||||
|
|
@ -729,9 +725,7 @@ class Hash
|
||||||
else
|
else
|
||||||
selector = raw_selector
|
selector = raw_selector
|
||||||
selector = selector.gsub("%2f","/")
|
selector = selector.gsub("%2f","/")
|
||||||
if selector[0] == ":"
|
selector = selector.to_sym
|
||||||
selector = selector[(1..-1)].to_sym
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if selector
|
if selector
|
||||||
|
|
@ -1036,23 +1030,20 @@ class Array
|
||||||
end
|
end
|
||||||
last_container = container
|
last_container = container
|
||||||
end
|
end
|
||||||
if selector.is_a?(Symbol)
|
safe_key = selector.to_s
|
||||||
safe_key = (":" + selector.to_s)
|
# xxx
|
||||||
else
|
# if selector.is_a?(Symbol)
|
||||||
safe_key = selector.to_s
|
# safe_key = (":" + selector.to_s)
|
||||||
end
|
# else
|
||||||
|
# safe_key = selector.to_s
|
||||||
|
# end
|
||||||
|
# xxx
|
||||||
safe_key = safe_key.gsub("/","%2f")
|
safe_key = safe_key.gsub("/","%2f")
|
||||||
path_stack.unshift(safe_key)
|
path_stack.unshift(safe_key)
|
||||||
# compare the_value
|
# compare the_value
|
||||||
found = false
|
found = false
|
||||||
if the_value.is_a?(::GxG::Database::Field)
|
if (the_value == the_object)
|
||||||
if (the_value.content == the_object)
|
found = true
|
||||||
found = true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if (the_value == the_object)
|
|
||||||
found = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if found
|
if found
|
||||||
search_results << ("/" + path_stack.reverse.join("/"))
|
search_results << ("/" + path_stack.reverse.join("/"))
|
||||||
|
|
@ -1090,9 +1081,7 @@ class Array
|
||||||
else
|
else
|
||||||
element = path_element
|
element = path_element
|
||||||
element = element.gsub("%2f","/")
|
element = element.gsub("%2f","/")
|
||||||
if element[0] == ":"
|
element = element.to_sym
|
||||||
element = element[(1..-1)].to_sym
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if element
|
if element
|
||||||
|
|
@ -1124,9 +1113,7 @@ class Array
|
||||||
else
|
else
|
||||||
selector = raw_selector
|
selector = raw_selector
|
||||||
selector = selector.gsub("%2f","/")
|
selector = selector.gsub("%2f","/")
|
||||||
if selector[0] == ":"
|
selector = selector.to_sym
|
||||||
selector = selector[(1..-1)].to_sym
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if selector
|
if selector
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#
|
# backtick_javascript: true
|
||||||
#require 'gxg_uri'
|
#require 'gxg_uri'
|
||||||
#
|
#
|
||||||
module GxG
|
module GxG
|
||||||
|
|
|
||||||
|
|
@ -1080,11 +1080,7 @@ module GxG
|
||||||
end
|
end
|
||||||
last_container = container
|
last_container = container
|
||||||
end
|
end
|
||||||
if selector.is_a?(Symbol)
|
safe_key = selector.to_s
|
||||||
safe_key = (":" + selector.to_s)
|
|
||||||
else
|
|
||||||
safe_key = selector.to_s
|
|
||||||
end
|
|
||||||
safe_key.gsub!("/","%2f")
|
safe_key.gsub!("/","%2f")
|
||||||
path_stack.unshift(safe_key)
|
path_stack.unshift(safe_key)
|
||||||
# compare the_value
|
# compare the_value
|
||||||
|
|
@ -1122,11 +1118,9 @@ module GxG
|
||||||
if (path_element =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
|
if (path_element =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
|
||||||
element = path_element.to_i
|
element = path_element.to_i
|
||||||
else
|
else
|
||||||
element = path_element
|
element = path_element.to_s
|
||||||
element.gsub!("%2f","/")
|
element.gsub!("%2f","/")
|
||||||
if element[0] == ":"
|
element = element.to_sym
|
||||||
element = element[(1..-1)].to_sym
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if element
|
if element
|
||||||
|
|
@ -1156,11 +1150,9 @@ module GxG
|
||||||
if (raw_selector =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
|
if (raw_selector =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
|
||||||
selector = raw_selector.to_i
|
selector = raw_selector.to_i
|
||||||
else
|
else
|
||||||
selector = raw_selector
|
selector = raw_selector.to_s
|
||||||
selector.gsub!("%2f","/")
|
selector.gsub!("%2f","/")
|
||||||
if selector[0] == ":"
|
selector = selector.to_sym
|
||||||
selector = selector[(1..-1)].to_sym
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if selector
|
if selector
|
||||||
|
|
@ -2080,11 +2072,7 @@ module GxG
|
||||||
end
|
end
|
||||||
last_container = container
|
last_container = container
|
||||||
end
|
end
|
||||||
if selector.is_a?(Symbol)
|
safe_key = selector.to_s
|
||||||
safe_key = (":" + selector.to_s)
|
|
||||||
else
|
|
||||||
safe_key = selector.to_s
|
|
||||||
end
|
|
||||||
safe_key.gsub!("/","%2f")
|
safe_key.gsub!("/","%2f")
|
||||||
path_stack.unshift(safe_key)
|
path_stack.unshift(safe_key)
|
||||||
# compare the_value
|
# compare the_value
|
||||||
|
|
@ -2126,11 +2114,9 @@ module GxG
|
||||||
if (path_element =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
|
if (path_element =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
|
||||||
element = path_element.to_i
|
element = path_element.to_i
|
||||||
else
|
else
|
||||||
element = path_element
|
element = path_element.to_s
|
||||||
element.gsub!("%2f","/")
|
element.gsub!("%2f","/")
|
||||||
if element[0] == ":"
|
element = element.to_sym
|
||||||
element = element[(1..-1)].to_sym
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if element
|
if element
|
||||||
|
|
@ -2160,11 +2146,9 @@ module GxG
|
||||||
if (raw_selector =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
|
if (raw_selector =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
|
||||||
selector = raw_selector.to_i
|
selector = raw_selector.to_i
|
||||||
else
|
else
|
||||||
selector = raw_selector
|
selector = raw_selector.to_s
|
||||||
selector.gsub!("%2f","/")
|
selector.gsub!("%2f","/")
|
||||||
if selector[0] == ":"
|
selector = selector.to_sym
|
||||||
selector = selector[(1..-1)].to_sym
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if selector
|
if selector
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Events Section:
|
# Events Section:
|
||||||
# backtick_javascript: true
|
# backtick_javascript: true
|
||||||
module GxG
|
module GxG
|
||||||
GXG_FEDERATION = {:title => "Untitled", :uuid => nil, :available => {}, :connections => {}}
|
GXG_FEDERATION = {:title => "Untitled", :uuid => nil, :access_url => nil, :available => {}, :connections => {}}
|
||||||
# ::GxG::SOCKET_MONITOR
|
# ::GxG::SOCKET_MONITOR
|
||||||
module Messages
|
module Messages
|
||||||
class Channel
|
class Channel
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ module GxG
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def update_appearance(data=nil)
|
def update_appearance(data=nil)
|
||||||
# TODO ??
|
# TODO ???
|
||||||
end
|
end
|
||||||
# Selection / Processing:
|
# Selection / Processing:
|
||||||
def set_processor(the_type=nil, &block)
|
def set_processor(the_type=nil, &block)
|
||||||
|
|
|
||||||
|
|
@ -1927,15 +1927,22 @@ module GxG
|
||||||
# @param [String] parent The parent Ruby element
|
# @param [String] parent The parent Ruby element
|
||||||
# @param [Hash] options Any options for the creation process
|
# @param [Hash] options Any options for the creation process
|
||||||
def initialize(parent, options={}, other_data={})
|
def initialize(parent, options={}, other_data={})
|
||||||
|
# ??? uuid is stored in @settings[:template]
|
||||||
if options.is_a?(GxG::Database::DetachedHash)
|
if options.is_a?(GxG::Database::DetachedHash)
|
||||||
@uuid = options.uuid.to_s.to_sym
|
# ??? @uuid = options.uuid.to_s.to_sym
|
||||||
|
@uuid = ::GxG::uuid_generate().to_s.to_sym
|
||||||
if options[:title].to_s.size > 0
|
if options[:title].to_s.size > 0
|
||||||
@title = options[:title].to_s
|
if options[:title].to_s.include("Untitled ")
|
||||||
|
@title = "Untitled Component #{@uuid.to_s}"
|
||||||
|
else
|
||||||
|
@title = options[:title].to_s
|
||||||
|
end
|
||||||
else
|
else
|
||||||
@title = options.title.to_s
|
@title = options.title.to_s
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@uuid = (options[:uuid] || ::GxG::uuid_generate()).to_s.to_sym
|
# ??? @uuid = (options[:uuid] || ::GxG::uuid_generate()).to_s.to_sym
|
||||||
|
@uuid = ::GxG::uuid_generate().to_s.to_sym
|
||||||
@title = (options[:title] || "Untitled Component #{@uuid.to_s}").to_s
|
@title = (options[:title] || "Untitled Component #{@uuid.to_s}").to_s
|
||||||
end
|
end
|
||||||
@component = (options[:component] || :unknown).to_s.downcase.to_sym
|
@component = (options[:component] || :unknown).to_s.downcase.to_sym
|
||||||
|
|
@ -1950,6 +1957,11 @@ module GxG
|
||||||
@settings = {}
|
@settings = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if options.respond_to?(:uuid)
|
||||||
|
@settings[:template] = options.uuid.to_s.to_sym
|
||||||
|
else
|
||||||
|
@settings[:template] = nil
|
||||||
|
end
|
||||||
#
|
#
|
||||||
if other_data[:application]
|
if other_data[:application]
|
||||||
@application = other_data[:application]
|
@application = other_data[:application]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue