arbre 1.0.0 → 1.0.2

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,71 +0,0 @@
1
- = Arbre - Ruby Object Oriented HTML Views
2
-
3
- Arbre is the DOM implemented in Ruby. This project is primarily used as
4
- the object oriented view layer in Active Admin.
5
-
6
- {<img src="https://secure.travis-ci.org/gregbell/arbre.png?branch=master" alt="Build Status" />}[http://travis-ci.org/gregbell/arbre]
7
-
8
- == Simple Usage
9
-
10
- A simple example of setting up an Arbre context and creating some html
11
-
12
- html = Arbre::Context.new do
13
- h2 "Why Arbre is awesome?"
14
-
15
- ul do
16
- li "The DOM is implemented in ruby"
17
- li "You can create object oriented views"
18
- li "Templates suck"
19
- end
20
- end
21
-
22
- puts html.to_s #=> <h2>Why</h2><ul><li></li></ul>
23
-
24
-
25
- == The DOM in Ruby
26
-
27
- The purpose of Arbre is to leave the view as ruby objects as long
28
- as possible. This allows OO Design to be used to implement the view layer.
29
-
30
-
31
- html = Arbre::Context.new do
32
- h2 "Why Arbre is awesome?"
33
- end
34
-
35
- html.children.size #=> 1
36
- html.children.first #=> #<Arbre::HTML::H2>
37
-
38
- == Components
39
-
40
- The purpose of Arbre is to be able to create shareable and extendable HTML
41
- components. To do this, you create a subclass of Arbre::Component.
42
-
43
- For example:
44
-
45
- class Panel < Arbre::Component
46
- builder_method :panel
47
-
48
- def build(title, attributes = {})
49
- super(attributes)
50
-
51
- h3(title, :class => "panel-title")
52
- end
53
- end
54
-
55
- The builder_method defines the method that will be called to build this component
56
- when using the DSL. The arguments passed into the builder_method will be passed
57
- into the #build method for you.
58
-
59
- You can now use this panel in any Arbre context:
60
-
61
- html = Arbre::Context.new do
62
- panel "Hello World", :id => "my-panel" do
63
- span "Inside the panel"
64
- end
65
- end
66
-
67
- html.to_s #=>
68
- # <div class='panel' id="my-panel">
69
- # <h3 class='panel-title'>Hello World</h3>
70
- # <span>Inside the panel</span>
71
- # </div>