pakyow-presenter 0.6.1 → 0.6.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,16 @@
1
+ = 0.6.3 / 2011-09-13
2
+
3
+ * Fixes binding to bindings defined by HTML 'name' attribute
4
+
5
+ = 0.6.2 / 2011-08-20
6
+
7
+ * Fixes issue binding object to root nodes
8
+ * JRuby Support
9
+
10
+ = 0.6.1 / 2011-08-20
11
+
12
+ * Fixes gemspec problem
13
+
1
14
  = 0.6.0 / 2011-08-20
2
15
 
3
16
  * Initial gem release of 0.6.0 codebase
@@ -94,15 +94,11 @@ module Pakyow
94
94
  def bind(object, type = nil)
95
95
  type = type || StringUtils.underscore(object.class.name)
96
96
 
97
- # This works: .//*
98
- # Not this: .//*[@itemprop or @name]
99
- # WTF!
100
- #
101
- @doc.xpath('.//*').each do |o|
97
+ @doc.traverse do |o|
102
98
  if attribute = o.get_attribute('itemprop')
103
99
  selector = attribute
104
- elsif name = o.get_attribute('name')
105
- selector = name
100
+ elsif attribute = o.get_attribute('name')
101
+ selector = attribute
106
102
  else
107
103
  next
108
104
  end
@@ -145,15 +141,17 @@ module Pakyow
145
141
  end
146
142
 
147
143
  def reset_container(container)
148
- if @doc && o = @doc.css("*[id='#{container}']").first
149
- o.inner_html = ''
150
- end
144
+ return unless @doc
145
+ return unless o = @doc.css("*[id='#{container}']").first
146
+ return if o.blank?
147
+
148
+ o.inner_html = ''
151
149
  end
152
150
 
153
151
  def title=(title)
154
152
  if @doc
155
153
  if o = @doc.css('title').first
156
- o.inner_html = title
154
+ o.inner_html = Nokogiri::HTML::fragment(title)
157
155
  else
158
156
  if o = @doc.css('head').first
159
157
  o.add_child(Nokogiri::HTML::fragment("<title>#{title}</title>"))
@@ -215,6 +213,7 @@ module Pakyow
215
213
  end
216
214
 
217
215
  def clear
216
+ return if self.doc.blank?
218
217
  self.doc.inner_html = ''
219
218
  end
220
219
 
@@ -230,13 +229,13 @@ module Pakyow
230
229
 
231
230
  def content=(content)
232
231
  return unless content
233
- self.doc.inner_html = content.to_s
232
+ self.doc.inner_html = Nokogiri::HTML.fragment(content.to_s)
234
233
  end
235
234
 
236
235
  alias :html= :content=
237
236
 
238
237
  def append(content)
239
- self.doc.inner_html += content.to_s
238
+ self.doc.add_child(Nokogiri::HTML.fragment(content.to_s))
240
239
  end
241
240
 
242
241
  alias :render :append
@@ -372,7 +371,7 @@ module Pakyow
372
371
 
373
372
  html << "</optgroup>" if is_group
374
373
 
375
- binding[:element].inner_html = html
374
+ binding[:element].inner_html = Nokogiri::HTML::fragment(html)
376
375
  end
377
376
  end
378
377
 
@@ -380,7 +379,7 @@ module Pakyow
380
379
  opt['selected'] = 'selected'
381
380
  end
382
381
  else
383
- binding[:element].inner_html = value.to_s
382
+ binding[:element].inner_html = Nokogiri::HTML.fragment(value.to_s)
384
383
  end
385
384
  elsif binding[:element].name == 'input' && binding[:element][:type] == 'checkbox'
386
385
  if value == true || binding[:element].attributes['value'].value == value.to_s
@@ -95,11 +95,13 @@ module Pakyow
95
95
  end
96
96
 
97
97
  def repeat_for(objects, &block)
98
- # Repeat for first match
99
- self.first.repeat_for(objects, &block)
98
+ first_found = self.first
100
99
 
101
100
  # Remove other matches
102
- self.each {|e| e.doc.remove}
101
+ self.drop(1).each {|found| found.remove}
102
+
103
+ # Repeat for first match
104
+ first_found.repeat_for(objects, &block)
103
105
  end
104
106
 
105
107
  def bind(object)
metadata CHANGED
@@ -1,21 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakyow-presenter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 113
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
+ - 3
9
10
  - 1
10
- version: 0.6.1
11
+ version: 0.6.3.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Bryan Powell
15
+ - Bret Young
14
16
  autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2011-08-20 00:00:00 Z
20
+ date: 2011-09-13 00:00:00 -05:00
21
+ default_executable:
19
22
  dependencies:
20
23
  - !ruby/object:Gem::Dependency
21
24
  name: pakyow-core
@@ -25,12 +28,13 @@ dependencies:
25
28
  requirements:
26
29
  - - "="
27
30
  - !ruby/object:Gem::Version
28
- hash: 5
31
+ hash: 113
29
32
  segments:
30
33
  - 0
31
34
  - 6
35
+ - 3
32
36
  - 1
33
- version: 0.6.1
37
+ version: 0.6.3.1
34
38
  type: :runtime
35
39
  version_requirements: *id001
36
40
  - !ruby/object:Gem::Dependency
@@ -39,13 +43,13 @@ dependencies:
39
43
  requirement: &id002 !ruby/object:Gem::Requirement
40
44
  none: false
41
45
  requirements:
42
- - - ">="
46
+ - - ~>
43
47
  - !ruby/object:Gem::Version
44
- hash: 7
48
+ hash: 5
45
49
  segments:
46
50
  - 1
47
- - 4
48
- version: "1.4"
51
+ - 5
52
+ version: "1.5"
49
53
  type: :runtime
50
54
  version_requirements: *id002
51
55
  description: pakyow-presenter
@@ -72,6 +76,7 @@ files:
72
76
  - pakyow-presenter/lib/presenter/view_context.rb
73
77
  - pakyow-presenter/lib/presenter/view_lookup_store.rb
74
78
  - pakyow-presenter/lib/presenter/views.rb
79
+ has_rdoc: true
75
80
  homepage: http://pakyow.com
76
81
  licenses: []
77
82
 
@@ -103,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
108
  requirements: []
104
109
 
105
110
  rubyforge_project: pakyow-presenter
106
- rubygems_version: 1.8.8
111
+ rubygems_version: 1.6.2
107
112
  signing_key:
108
113
  specification_version: 3
109
114
  summary: pakyow-presenter