Skip to content

Commit 7dfe00a

Browse files
committed
Rename section to dom_section, raise errors on invalid routes.
1 parent addb697 commit 7dfe00a

File tree

8 files changed

+19
-13
lines changed

8 files changed

+19
-13
lines changed

lib/volt/models/url.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,13 @@ def assign_query_hash_to_params
130130
query_hash = self.query_hash
131131

132132
# Get the params that are in the route
133-
query_hash.merge!(@router.url_to_params(@path))
133+
new_params = @router.url_to_params(@path)
134+
135+
if new_params == false
136+
raise "no routes match path: #{@path}"
137+
end
138+
139+
query_hash.merge!(new_params)
134140

135141
# Loop through the .params we already have assigned.
136142
assign_from_old(@params, query_hash)

lib/volt/page/bindings/base_binding.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ def initialize(page, target, context, binding_name)
2020
@@binding_number ||= 10000
2121
end
2222

23-
def section
24-
@section ||= target.section(@binding_name)
23+
def dom_section
24+
@dom_section ||= target.dom_section(@binding_name)
2525
end
2626

2727
def remove
28-
section.remove if @section
28+
@dom_section.remove if @dom_section
2929

3030
# Clear any references
3131
@target = nil
3232
@context = nil
33-
@section = nil
33+
@dom_section = nil
3434
end
3535

3636
def remove_anchors
37-
section.remove_anchors
37+
@dom_section.remove_anchors if @dom_section
3838
end
3939

4040
def queue_update

lib/volt/page/bindings/content_binding.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def update
2323

2424
# Update the html in this section
2525
# TODO: Move the formatter into another class.
26-
section.html = value.gsub("\n", "<br />\n")
26+
dom_section.html = value.gsub("\n", "<br />\n")
2727
end
2828

2929
def remove

lib/volt/page/bindings/each_binding.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ def item_added(position)
5656

5757
if position >= @templates.size
5858
# Setup new bindings in the spot we want to insert the item
59-
section.insert_anchor_before_end(binding_name)
59+
dom_section.insert_anchor_before_end(binding_name)
6060
else
6161
# Insert the item before an existing item
62-
section.insert_anchor_before(binding_name, @templates[position].binding_name)
62+
dom_section.insert_anchor_before(binding_name, @templates[position].binding_name)
6363
end
6464

6565
index = ReactiveValue.new(position)

lib/volt/page/bindings/template_binding.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def call_ready
174174
# Set the current section on the controller if it wants so it can manipulate
175175
# the dom if needed
176176
if @controller.respond_to?(:section=)
177-
@controller.section = @current_template.section
177+
@controller.dom_section = @current_template.dom_ection
178178
end
179179

180180
if @controller.respond_to?(:dom_ready)

lib/volt/page/targets/attribute_target.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class AttributeTarget < ComponentNode
1010

11-
def section(*args)
11+
def dom_section(*args)
1212
return AttributeSection.new(self, *args)
1313
end
1414
end

lib/volt/page/targets/dom_target.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the dom. Currently only one "dom" is supported, but multiple
66
# may be allowed in the future (iframes?)
77
class DomTarget < BaseSection
8-
def section(*args)
8+
def dom_section(*args)
99
return DomSection.new(*args)
1010
end
1111
end

lib/volt/page/template_renderer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def initialize(page, target, context, binding_name, template_name)
77

88
@sub_bindings = []
99

10-
bindings = self.section.set_content_to_template(page, template_name)
10+
bindings = self.dom_section.set_content_to_template(page, template_name)
1111

1212
bindings.each_pair do |id,bindings_for_id|
1313
bindings_for_id.each do |binding|

0 commit comments

Comments
 (0)