minimal 0.0.22 → 0.0.23

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minimal (0.0.21)
4
+ minimal (0.0.22)
5
5
  actionpack (>= 3.0.0)
6
6
  activesupport (>= 3.0.0)
7
7
 
@@ -9,31 +9,31 @@ GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
11
  abstract (1.0.0)
12
- actionpack (3.0.0)
13
- activemodel (= 3.0.0)
14
- activesupport (= 3.0.0)
12
+ actionpack (3.0.3)
13
+ activemodel (= 3.0.3)
14
+ activesupport (= 3.0.3)
15
15
  builder (~> 2.1.2)
16
16
  erubis (~> 2.6.6)
17
- i18n (~> 0.4.1)
17
+ i18n (~> 0.4)
18
18
  rack (~> 1.2.1)
19
- rack-mount (~> 0.6.12)
20
- rack-test (~> 0.5.4)
19
+ rack-mount (~> 0.6.13)
20
+ rack-test (~> 0.5.6)
21
21
  tzinfo (~> 0.3.23)
22
- activemodel (3.0.0)
23
- activesupport (= 3.0.0)
22
+ activemodel (3.0.3)
23
+ activesupport (= 3.0.3)
24
24
  builder (~> 2.1.2)
25
- i18n (~> 0.4.1)
26
- activesupport (3.0.0)
25
+ i18n (~> 0.4)
26
+ activesupport (3.0.3)
27
27
  builder (2.1.2)
28
28
  erubis (2.6.6)
29
29
  abstract (>= 1.0.0)
30
- i18n (0.4.1)
30
+ i18n (0.5.0)
31
31
  rack (1.2.1)
32
32
  rack-mount (0.6.13)
33
33
  rack (>= 1.0.0)
34
34
  rack-test (0.5.6)
35
35
  rack (>= 1.0)
36
- test_declarative (0.0.3)
36
+ test_declarative (0.0.4)
37
37
  tzinfo (0.3.23)
38
38
 
39
39
  PLATFORMS
data/NOTES ADDED
@@ -0,0 +1,55 @@
1
+ name_field.bind_to song, :title
2
+
3
+ http://www.rawblock.com/2007/02/07/transparent-property-change-listeners-in-ruby/
4
+ http://www.rawblock.com/2007/02/15/jruby-can-save-swing/
5
+
6
+ class PostForm < Minimal::Component
7
+ depends_on [:post, :categories]
8
+
9
+ def build
10
+ fieldset(:main) do
11
+ input :title
12
+ input :body
13
+ end
14
+
15
+ fieldset(:sidebar) do
16
+ checkbox_group :categories, post.categories
17
+ end
18
+ end
19
+
20
+ def to_html
21
+ component.render(:object => post, :categories => categories)
22
+ end
23
+ end
24
+
25
+ class Input
26
+ def initialize(name, binding = name)
27
+ @name, @binding = name, binding
28
+ build
29
+ end
30
+
31
+ def build
32
+ @template = %(<input type="text" name="#{name}" value="[value]">)
33
+ end
34
+
35
+ def render(object)
36
+ template.sub('[value]', object.send(binding))
37
+ end
38
+ end
39
+
40
+ class CheckboxGroup
41
+ def initialize(name, collection, binding = :id)
42
+ build
43
+ end
44
+
45
+ def build
46
+ @tags = collection.map do |element|
47
+ Checkbox.new(name, :value => element.send(binding))
48
+ end
49
+ end
50
+
51
+ def render(collection)
52
+ values = collection.map(binding)
53
+ tags.map { |tag| tag.render(values.include?(tag.value)) }
54
+ end
55
+ end
@@ -3,7 +3,7 @@ class Minimal::Template
3
3
  autoload :Handler, 'minimal/template/handler'
4
4
  autoload :TranslatedTags, 'minimal/template/translated_tags'
5
5
 
6
- AUTO_BUFFER = %r(render|tag|error_message_|select|debug|_to|[^l]_for)
6
+ AUTO_BUFFER = %r(^render|^error_message_|_select$|tag$|_to$|[^l]_for$|debug) # TODO explicitely whitelist helpers that return tags
7
7
  TAG_NAMES = %w(abbr a body div em fieldset h1 h2 h3 h4 h5 h6 head html img input label li
8
8
  link ol option p pre script select span strong table thead tbody tfoot td title th tr ul)
9
9
 
@@ -1,3 +1,3 @@
1
1
  module Minimal
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimal
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease: false
4
+ hash: 49
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 22
10
- version: 0.0.22
9
+ - 23
10
+ version: 0.0.23
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sven Fuchs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-21 00:00:00 +02:00
18
+ date: 2011-01-11 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -81,6 +81,7 @@ files:
81
81
  - lib/minimal.rb
82
82
  - Gemfile
83
83
  - Gemfile.lock
84
+ - NOTES
84
85
  - Rakefile
85
86
  - README.textile
86
87
  has_rdoc: true
@@ -115,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  requirements: []
116
117
 
117
118
  rubyforge_project: "[none]"
118
- rubygems_version: 1.3.7
119
+ rubygems_version: 1.4.2
119
120
  signing_key:
120
121
  specification_version: 3
121
122
  summary: Minimal templating engine inspired by Markaby & Erector