diff --git a/gxg/web/gxg_augments.rb b/gxg/web/gxg_augments.rb index 47eb10b..26d2841 100644 --- a/gxg/web/gxg_augments.rb +++ b/gxg/web/gxg_augments.rb @@ -1,3 +1,4 @@ +# backtick_javascript: true # Alteration to Opal's Buffer::Array class Buffer class Array @@ -645,23 +646,20 @@ class Hash end last_container = container end - if selector.is_a?(Symbol) - safe_key = (":" + selector.to_s) - else - safe_key = selector.to_s - end + safe_key = selector.to_s + # xxx + # if selector.is_a?(Symbol) + # safe_key = (":" + selector.to_s) + # else + # safe_key = selector.to_s + # end + # xxx safe_key = safe_key.gsub("/","%2f") path_stack.unshift(safe_key) # compare the_value found = false - if the_value.is_a?(::GxG::Database::Field) - if (the_value.content == the_object) - found = true - end - else - if (the_value == the_object) - found = true - end + if (the_value == the_object) + found = true end if found search_results << ("/" + path_stack.reverse.join("/")) @@ -695,9 +693,7 @@ class Hash else element = path_element element = element.gsub("%2f","/") - if element[0] == ":" - element = element[(1..-1)].to_sym - end + element = element.to_sym end end if element @@ -729,9 +725,7 @@ class Hash else selector = raw_selector selector = selector.gsub("%2f","/") - if selector[0] == ":" - selector = selector[(1..-1)].to_sym - end + selector = selector.to_sym end end if selector @@ -1036,23 +1030,20 @@ class Array end last_container = container end - if selector.is_a?(Symbol) - safe_key = (":" + selector.to_s) - else - safe_key = selector.to_s - end + safe_key = selector.to_s + # xxx + # if selector.is_a?(Symbol) + # safe_key = (":" + selector.to_s) + # else + # safe_key = selector.to_s + # end + # xxx safe_key = safe_key.gsub("/","%2f") path_stack.unshift(safe_key) # compare the_value found = false - if the_value.is_a?(::GxG::Database::Field) - if (the_value.content == the_object) - found = true - end - else - if (the_value == the_object) - found = true - end + if (the_value == the_object) + found = true end if found search_results << ("/" + path_stack.reverse.join("/")) @@ -1090,9 +1081,7 @@ class Array else element = path_element element = element.gsub("%2f","/") - if element[0] == ":" - element = element[(1..-1)].to_sym - end + element = element.to_sym end end if element @@ -1124,9 +1113,7 @@ class Array else selector = raw_selector selector = selector.gsub("%2f","/") - if selector[0] == ":" - selector = selector[(1..-1)].to_sym - end + selector = selector.to_sym end end if selector diff --git a/gxg/web/gxg_comm.rb b/gxg/web/gxg_comm.rb index 0cc8c30..ac997fa 100644 --- a/gxg/web/gxg_comm.rb +++ b/gxg/web/gxg_comm.rb @@ -1,4 +1,4 @@ -# +# backtick_javascript: true #require 'gxg_uri' # module GxG diff --git a/gxg/web/gxg_database.rb b/gxg/web/gxg_database.rb index 726a3b2..9bf202e 100644 --- a/gxg/web/gxg_database.rb +++ b/gxg/web/gxg_database.rb @@ -1080,11 +1080,7 @@ module GxG end last_container = container end - if selector.is_a?(Symbol) - safe_key = (":" + selector.to_s) - else - safe_key = selector.to_s - end + safe_key = selector.to_s safe_key.gsub!("/","%2f") path_stack.unshift(safe_key) # compare the_value @@ -1122,11 +1118,9 @@ module GxG if (path_element =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0 element = path_element.to_i else - element = path_element + element = path_element.to_s element.gsub!("%2f","/") - if element[0] == ":" - element = element[(1..-1)].to_sym - end + element = element.to_sym end end if element @@ -1156,11 +1150,9 @@ module GxG if (raw_selector =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0 selector = raw_selector.to_i else - selector = raw_selector + selector = raw_selector.to_s selector.gsub!("%2f","/") - if selector[0] == ":" - selector = selector[(1..-1)].to_sym - end + selector = selector.to_sym end end if selector @@ -2080,11 +2072,7 @@ module GxG end last_container = container end - if selector.is_a?(Symbol) - safe_key = (":" + selector.to_s) - else - safe_key = selector.to_s - end + safe_key = selector.to_s safe_key.gsub!("/","%2f") path_stack.unshift(safe_key) # compare the_value @@ -2126,11 +2114,9 @@ module GxG if (path_element =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0 element = path_element.to_i else - element = path_element + element = path_element.to_s element.gsub!("%2f","/") - if element[0] == ":" - element = element[(1..-1)].to_sym - end + element = element.to_sym end end if element @@ -2160,11 +2146,9 @@ module GxG if (raw_selector =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0 selector = raw_selector.to_i else - selector = raw_selector + selector = raw_selector.to_s selector.gsub!("%2f","/") - if selector[0] == ":" - selector = selector[(1..-1)].to_sym - end + selector = selector.to_sym end end if selector diff --git a/gxg/web/gxg_events.rb b/gxg/web/gxg_events.rb index 37245fc..4267bfc 100644 --- a/gxg/web/gxg_events.rb +++ b/gxg/web/gxg_events.rb @@ -1,7 +1,7 @@ # Events Section: # backtick_javascript: true module GxG - GXG_FEDERATION = {:title => "Untitled", :uuid => nil, :available => {}, :connections => {}} + GXG_FEDERATION = {:title => "Untitled", :uuid => nil, :access_url => nil, :available => {}, :connections => {}} # ::GxG::SOCKET_MONITOR module Messages class Channel diff --git a/gxg/web/gxg_gui.rb b/gxg/web/gxg_gui.rb index d665fc9..66ad95e 100644 --- a/gxg/web/gxg_gui.rb +++ b/gxg/web/gxg_gui.rb @@ -132,7 +132,7 @@ module GxG end # def update_appearance(data=nil) - # TODO ?? + # TODO ??? end # Selection / Processing: def set_processor(the_type=nil, &block) diff --git a/gxg/web/gxg_vdom.rb b/gxg/web/gxg_vdom.rb index fb5c4a3..9c8e1e2 100644 --- a/gxg/web/gxg_vdom.rb +++ b/gxg/web/gxg_vdom.rb @@ -1927,15 +1927,22 @@ module GxG # @param [String] parent The parent Ruby element # @param [Hash] options Any options for the creation process def initialize(parent, options={}, other_data={}) + # ??? uuid is stored in @settings[:template] 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 - @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 @title = options.title.to_s end 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 end @component = (options[:component] || :unknown).to_s.downcase.to_sym @@ -1950,6 +1957,11 @@ module GxG @settings = {} end end + if options.respond_to?(:uuid) + @settings[:template] = options.uuid.to_s.to_sym + else + @settings[:template] = nil + end # if other_data[:application] @application = other_data[:application]