ramaze 2011.01.30 → 2011.07.25
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.mailmap +2 -0
- data/.rvmrc +1 -0
- data/README.md +119 -197
- data/Rakefile +14 -97
- data/bin/ramaze +6 -14
- data/doc/AUTHORS +8 -4
- data/doc/CHANGELOG +3784 -3339
- data/examples/app/chat/start.rb +2 -2
- data/lib/proto/app.rb +2 -3
- data/lib/proto/config.ru +4 -5
- data/lib/proto/controller/init.rb +11 -4
- data/lib/proto/controller/main.rb +12 -7
- data/lib/proto/layout/default.xhtml +56 -23
- data/lib/proto/model/init.rb +3 -1
- data/lib/proto/public/css/grid.css +107 -0
- data/lib/proto/public/css/layout.css +81 -0
- data/lib/proto/public/css/reset.css +123 -0
- data/lib/proto/public/css/text.css +109 -0
- data/lib/proto/public/images/bg.png +0 -0
- data/lib/proto/spec/main.rb +2 -2
- data/lib/proto/start.rb +11 -1
- data/lib/proto/view/index.xhtml +27 -23
- data/lib/ramaze.rb +0 -1
- data/lib/ramaze/app.rb +85 -12
- data/lib/ramaze/app_graph.rb +107 -0
- data/lib/ramaze/bin/console.rb +87 -0
- data/lib/ramaze/bin/create.rb +94 -0
- data/lib/ramaze/bin/helper.rb +107 -0
- data/lib/ramaze/bin/restart.rb +95 -0
- data/lib/ramaze/bin/runner.rb +141 -0
- data/lib/ramaze/bin/start.rb +206 -0
- data/lib/ramaze/bin/status.rb +152 -0
- data/lib/ramaze/bin/stop.rb +112 -0
- data/lib/ramaze/cache.rb +9 -4
- data/lib/ramaze/cache/localmemcache.rb +10 -13
- data/lib/ramaze/cache/lru.rb +49 -7
- data/lib/ramaze/cache/memcache.rb +170 -92
- data/lib/ramaze/cache/sequel.rb +301 -118
- data/lib/ramaze/controller.rb +108 -9
- data/lib/ramaze/controller/default.rb +15 -2
- data/lib/ramaze/current.rb +14 -2
- data/lib/ramaze/dependencies.rb +46 -0
- data/lib/ramaze/files.rb +38 -3
- data/lib/ramaze/gestalt.rb +12 -12
- data/lib/ramaze/helper.rb +0 -2
- data/lib/ramaze/helper/auth.rb +30 -23
- data/lib/ramaze/helper/blue_form.rb +175 -126
- data/lib/ramaze/helper/csrf.rb +76 -91
- data/lib/ramaze/helper/email.rb +105 -0
- data/lib/ramaze/helper/erector.rb +16 -15
- data/lib/ramaze/helper/gestalt.rb +2 -2
- data/lib/ramaze/helper/layout.rb +89 -73
- data/lib/ramaze/helper/link.rb +7 -6
- data/lib/ramaze/helper/localize.rb +6 -5
- data/lib/ramaze/helper/markaby.rb +25 -23
- data/lib/ramaze/helper/maruku.rb +3 -3
- data/lib/ramaze/helper/paginate.rb +19 -27
- data/lib/ramaze/helper/remarkably.rb +3 -3
- data/lib/ramaze/helper/request_accessor.rb +3 -3
- data/lib/ramaze/helper/send_file.rb +12 -8
- data/lib/ramaze/helper/simple_captcha.rb +5 -6
- data/lib/ramaze/helper/stack.rb +7 -4
- data/lib/ramaze/helper/tagz.rb +10 -11
- data/lib/ramaze/helper/thread.rb +19 -16
- data/lib/ramaze/helper/ultraviolet.rb +7 -4
- data/lib/ramaze/helper/user.rb +40 -21
- data/lib/ramaze/helper/xhtml.rb +29 -20
- data/lib/ramaze/log.rb +3 -11
- data/lib/ramaze/log/analogger.rb +5 -4
- data/lib/ramaze/log/growl.rb +9 -7
- data/lib/ramaze/log/hub.rb +3 -5
- data/lib/ramaze/log/informer.rb +15 -12
- data/lib/ramaze/log/knotify.rb +3 -5
- data/lib/ramaze/log/logger.rb +3 -5
- data/lib/ramaze/log/logging.rb +6 -8
- data/lib/ramaze/log/rotatinginformer.rb +27 -17
- data/lib/ramaze/log/syslog.rb +7 -7
- data/lib/ramaze/log/xosd.rb +3 -5
- data/lib/ramaze/middleware_compiler.rb +27 -4
- data/lib/ramaze/reloader.rb +50 -12
- data/lib/ramaze/reloader/watch_inotify.rb +4 -5
- data/lib/ramaze/reloader/watch_stat.rb +3 -3
- data/lib/ramaze/request.rb +18 -8
- data/lib/ramaze/response.rb +38 -7
- data/lib/ramaze/rest.rb +36 -0
- data/lib/ramaze/setup.rb +101 -31
- data/lib/ramaze/spec.rb +1 -1
- data/lib/ramaze/spec/bacon.rb +6 -3
- data/lib/ramaze/spec/helper/bacon.rb +0 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/ramaze/view.rb +2 -11
- data/lib/ramaze/view/erector.rb +46 -31
- data/lib/ramaze/view/erubis.rb +7 -3
- data/lib/ramaze/view/ezamar.rb +7 -3
- data/lib/ramaze/view/gestalt.rb +9 -3
- data/lib/ramaze/view/haml.rb +7 -3
- data/lib/ramaze/view/liquid.rb +3 -3
- data/lib/ramaze/view/lokar.rb +7 -3
- data/lib/ramaze/view/mustache.rb +11 -5
- data/lib/ramaze/view/nagoro.rb +3 -3
- data/lib/ramaze/view/sass.rb +1 -1
- data/lib/ramaze/view/slippers.rb +40 -13
- data/lib/ramaze/view/tagz.rb +9 -5
- data/ramaze.gemspec +23 -128
- data/spec/helper.rb +5 -0
- data/spec/ramaze/bin/app/config.ru +11 -0
- data/spec/ramaze/bin/create.rb +28 -0
- data/spec/ramaze/bin/runner.rb +30 -0
- data/spec/ramaze/bin/start.rb +38 -0
- data/spec/ramaze/cache/memcache.rb +10 -3
- data/spec/ramaze/cache/sequel.rb +7 -0
- data/spec/ramaze/controller/provide_inheritance.rb +0 -10
- data/spec/ramaze/dispatcher/file.rb +19 -15
- data/spec/ramaze/helper/auth.rb +10 -9
- data/spec/ramaze/helper/blue_form.rb +121 -68
- data/spec/ramaze/helper/email.rb +69 -0
- data/spec/ramaze/helper/layout.rb +12 -15
- data/spec/ramaze/helper/layout/alternative.xhtml +5 -0
- data/spec/ramaze/helper/user.rb +2 -0
- data/spec/ramaze/log/growl.rb +14 -1
- data/spec/{contrib → ramaze}/rest.rb +1 -1
- data/spec/ramaze/session/memcache.rb +2 -2
- data/spec/ramaze/view/sass.rb +1 -1
- data/tasks/bacon.rake +3 -3
- data/tasks/gem.rake +17 -18
- data/tasks/rcov.rake +2 -3
- data/tasks/release.rake +8 -65
- data/tasks/setup.rake +10 -8
- data/tasks/todo.rake +9 -5
- data/tasks/yard.rake +3 -2
- metadata +105 -397
- data/MANIFEST +0 -532
- data/TODO.md +0 -19
- data/benchmark/bench_templates/bench.rb +0 -67
- data/benchmark/bench_templates/view/large.erb +0 -79
- data/benchmark/bench_templates/view/large.haml +0 -41
- data/benchmark/bench_templates/view/large.lok +0 -79
- data/benchmark/bench_templates/view/large.xhtml +0 -79
- data/benchmark/bench_templates/view/small.erb +0 -21
- data/benchmark/bench_templates/view/small.haml +0 -12
- data/benchmark/bench_templates/view/small.lok +0 -21
- data/benchmark/bench_templates/view/small.xhtml +0 -21
- data/benchmark/results.txt +0 -131
- data/benchmark/run.rb +0 -355
- data/benchmark/suite/minimal.rb +0 -11
- data/benchmark/suite/no_informer.rb +0 -7
- data/benchmark/suite/no_sessions.rb +0 -9
- data/benchmark/suite/no_template.rb +0 -7
- data/benchmark/suite/simple.rb +0 -5
- data/benchmark/suite/template_erubis.rb +0 -8
- data/benchmark/suite/template_etanni.rb +0 -8
- data/benchmark/suite/template_ezamar.rb +0 -8
- data/benchmark/suite/template_haml.rb +0 -13
- data/benchmark/suite/template_liquid.rb +0 -11
- data/benchmark/suite/template_markaby.rb +0 -9
- data/benchmark/suite/template_nagoro.rb +0 -8
- data/benchmark/suite/template_redcloth.rb +0 -13
- data/benchmark/suite/template_tenjin.rb +0 -8
- data/benchmark/test.rb +0 -35
- data/doc/FAQ +0 -92
- data/doc/INSTALL +0 -92
- data/doc/TODO +0 -29
- data/doc/meta/announcement.txt +0 -119
- data/doc/meta/configuration.txt +0 -163
- data/doc/meta/internals.txt +0 -278
- data/doc/meta/users.kml +0 -64
- data/doc/tutorial/todolist.html +0 -1512
- data/doc/tutorial/todolist.txt +0 -920
- data/examples/app/sourceview/public/coderay.css +0 -104
- data/examples/app/sourceview/public/images/file.gif +0 -0
- data/examples/app/sourceview/public/images/folder.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item.gif +0 -0
- data/examples/app/sourceview/public/jquery.js +0 -11
- data/examples/app/sourceview/public/jquery.treeview.css +0 -48
- data/examples/app/sourceview/public/jquery.treeview.js +0 -223
- data/examples/app/sourceview/public/sourceview.js +0 -52
- data/examples/app/sourceview/start.rb +0 -79
- data/examples/app/sourceview/view/index.haml +0 -59
- data/examples/helpers/httpdigest.rb +0 -107
- data/lib/proto/public/css/screen.css +0 -30
- data/lib/proto/public/js/jquery.js +0 -7179
- data/lib/ramaze/contrib/addressable_route.rb +0 -56
- data/lib/ramaze/contrib/app_graph.rb +0 -64
- data/lib/ramaze/contrib/email.rb +0 -88
- data/lib/ramaze/contrib/facebook.rb +0 -23
- data/lib/ramaze/contrib/facebook/facebook.rb +0 -171
- data/lib/ramaze/contrib/gettext.rb +0 -113
- data/lib/ramaze/contrib/gettext/mo.rb +0 -155
- data/lib/ramaze/contrib/gettext/parser.rb +0 -46
- data/lib/ramaze/contrib/gettext/po.rb +0 -109
- data/lib/ramaze/contrib/gzip_filter.rb +0 -1
- data/lib/ramaze/contrib/maruku_uv.rb +0 -59
- data/lib/ramaze/contrib/profiling.rb +0 -36
- data/lib/ramaze/contrib/rest.rb +0 -23
- data/lib/ramaze/contrib/sequel/create_join.rb +0 -26
- data/lib/ramaze/contrib/sequel/form_field.rb +0 -129
- data/lib/ramaze/contrib/sequel/image.rb +0 -196
- data/lib/ramaze/contrib/sequel/relation.rb +0 -98
- data/lib/ramaze/helper/httpdigest.rb +0 -96
- data/lib/ramaze/tool/bin.rb +0 -340
- data/lib/ramaze/tool/create.rb +0 -48
- data/lib/ramaze/tool/project_creator.rb +0 -120
- data/lib/ramaze/view/less.rb +0 -12
- data/lib/ramaze/view/maruku.rb +0 -15
- data/lib/ramaze/view/redcloth.rb +0 -21
- data/spec/contrib/addressable_route.rb +0 -30
- data/spec/examples/helpers/httpdigest.rb +0 -64
- data/spec/examples/templates/template_redcloth.rb +0 -13
- data/spec/ramaze/bin/ramaze.rb +0 -96
- data/spec/ramaze/helper/httpdigest.rb +0 -176
- data/spec/ramaze/view/less.rb +0 -60
- data/spec/ramaze/view/less/file.css.less +0 -8
- data/spec/ramaze/view/redcloth.rb +0 -66
- data/spec/ramaze/view/redcloth/external.redcloth +0 -8
- data/tasks/copyright.rake +0 -21
- data/tasks/gem_setup.rake +0 -112
- data/tasks/git.rake +0 -46
- data/tasks/grancher.rake +0 -12
- data/tasks/jquery.rake +0 -15
- data/tasks/manifest.rake +0 -4
- data/tasks/metric_changes.rake +0 -24
- data/tasks/reversion.rake +0 -8
- data/tasks/traits.rake +0 -21
@@ -5,7 +5,7 @@ Bacon.summary_at_exit
|
|
5
5
|
|
6
6
|
describe BF = Ramaze::Helper::BlueForm do
|
7
7
|
extend BF
|
8
|
-
|
8
|
+
|
9
9
|
# Generate some dummy data
|
10
10
|
@data = Class.new do
|
11
11
|
attr_reader :username
|
@@ -16,7 +16,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
16
16
|
attr_reader :servers_hash
|
17
17
|
attr_reader :servers_array
|
18
18
|
attr_accessor :errors
|
19
|
-
|
19
|
+
|
20
20
|
def initialize
|
21
21
|
@username = 'mrfoo'
|
22
22
|
@password = 'super-secret-password'
|
@@ -39,7 +39,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
39
39
|
right = output.to_s.gsub(/\s+/, ' ').gsub(/>\s+</, '><').strip
|
40
40
|
left.scan(/./).sort.should == right.scan(/./).sort
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
# ------------------------------------------------
|
44
44
|
# Basic forms
|
45
45
|
|
@@ -75,11 +75,11 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
75
75
|
|
76
76
|
it 'Make a form with a fieldset and a legend' do
|
77
77
|
out = form_for(@data, :method => :get) do |f|
|
78
|
-
f.
|
78
|
+
f.fieldset do
|
79
79
|
f.legend('The Form')
|
80
80
|
end
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
assert(<<-FORM, out)
|
84
84
|
<form method="get">
|
85
85
|
<fieldset>
|
@@ -88,7 +88,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
88
88
|
</form>
|
89
89
|
FORM
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
# ------------------------------------------------
|
93
93
|
# Text fields
|
94
94
|
|
@@ -96,7 +96,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
96
96
|
out = form_for(@data, :method => :get) do |f|
|
97
97
|
f.input_text 'Username', :username
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
assert(<<-FORM, out)
|
101
101
|
<form method="get">
|
102
102
|
<p>
|
@@ -106,12 +106,12 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
106
106
|
</form>
|
107
107
|
FORM
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
it 'Make a form with input_text(username, label, value)' do
|
111
111
|
out = form_for(@data, :method => :get) do |f|
|
112
112
|
f.input_text 'Username', :username, :value => 'mrboo'
|
113
113
|
end
|
114
|
-
|
114
|
+
|
115
115
|
assert(<<-FORM, out)
|
116
116
|
<form method="get">
|
117
117
|
<p>
|
@@ -121,12 +121,12 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
121
121
|
</form>
|
122
122
|
FORM
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
it 'Make a form with input_text(label, name, size, id)' do
|
126
126
|
out = form_for(@data, :method => :get) do |f|
|
127
127
|
f.input_text 'Username', :username, :size => 10, :id => 'my_id'
|
128
128
|
end
|
129
|
-
|
129
|
+
|
130
130
|
assert(<<-FORM, out)
|
131
131
|
<form method="get">
|
132
132
|
<p>
|
@@ -136,15 +136,15 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
136
136
|
</form>
|
137
137
|
FORM
|
138
138
|
end
|
139
|
-
|
139
|
+
|
140
140
|
# ------------------------------------------------
|
141
141
|
# Password fields
|
142
|
-
|
142
|
+
|
143
143
|
it 'Make a form with input_password(label, name)' do
|
144
144
|
out = form_for(nil , :method => :get) do |f|
|
145
145
|
f.input_password 'Password', :password
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
148
|
assert(<<-FORM, out)
|
149
149
|
<form method="get">
|
150
150
|
<p>
|
@@ -154,7 +154,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
154
154
|
</form>
|
155
155
|
FORM
|
156
156
|
end
|
157
|
-
|
157
|
+
|
158
158
|
it 'Make a form with input_password(label, name, value, class)' do
|
159
159
|
out = form_for(@data, :method => :get) do |f|
|
160
160
|
f.input_password 'Password', :password, :value => 'super-secret-password', :class => 'password_class'
|
@@ -166,18 +166,18 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
166
166
|
<label for="form_password">Password</label>
|
167
167
|
<input class="password_class" type="password" name="password" id="form_password" value="super-secret-password" />
|
168
168
|
</p>
|
169
|
-
</form>
|
169
|
+
</form>
|
170
170
|
FORM
|
171
171
|
end
|
172
|
-
|
172
|
+
|
173
173
|
# ------------------------------------------------
|
174
174
|
# Submit buttons
|
175
|
-
|
175
|
+
|
176
176
|
it 'Make a form with input_submit()' do
|
177
177
|
out = form_for(@data, :method => :get) do |f|
|
178
178
|
f.input_submit
|
179
179
|
end
|
180
|
-
|
180
|
+
|
181
181
|
assert(<<-FORM, out)
|
182
182
|
<form method="get">
|
183
183
|
<p>
|
@@ -191,7 +191,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
191
191
|
out = form_for(@data, :method => :get) do |f|
|
192
192
|
f.input_submit 'Send'
|
193
193
|
end
|
194
|
-
|
194
|
+
|
195
195
|
assert(<<-FORM, out)
|
196
196
|
<form method="get">
|
197
197
|
<p>
|
@@ -200,10 +200,10 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
200
200
|
</form>
|
201
201
|
FORM
|
202
202
|
end
|
203
|
-
|
203
|
+
|
204
204
|
# ------------------------------------------------
|
205
205
|
# Checkboxes
|
206
|
-
|
206
|
+
|
207
207
|
it 'Make a form with input_checkbox(label, name)' do
|
208
208
|
out = form_for(@data, :method => :get) do |f|
|
209
209
|
f.input_checkbox 'Assigned', :assigned
|
@@ -213,7 +213,6 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
213
213
|
<form method="get">
|
214
214
|
<p>
|
215
215
|
<label for="form_assigned_0">Assigned</label>
|
216
|
-
<input type="hidden" name="assigned" value="0" />
|
217
216
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_0" value="bacon" /> bacon</span>
|
218
217
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_1" value="steak" /> steak</span>
|
219
218
|
</p>
|
@@ -225,12 +224,11 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
225
224
|
out = form_for(@data, :method => :get) do |f|
|
226
225
|
f.input_checkbox 'Assigned', :assigned, 'bacon'
|
227
226
|
end
|
228
|
-
|
227
|
+
|
229
228
|
assert(<<-FORM, out)
|
230
229
|
<form method="get">
|
231
230
|
<p>
|
232
231
|
<label for="form_assigned_0">Assigned</label>
|
233
|
-
<input type="hidden" name="assigned" value="0" />
|
234
232
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_0" checked="checked" value="bacon" /> bacon</span>
|
235
233
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_1" value="steak" /> steak</span>
|
236
234
|
</p>
|
@@ -240,23 +238,53 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
240
238
|
|
241
239
|
it 'Make a form with input_checkbox(label, name, checked, values, default)' do
|
242
240
|
out = form_for(@data, :method => :get) do |f|
|
243
|
-
f.input_checkbox 'Assigned', :assigned, 'boo', :values => ['boo']
|
241
|
+
f.input_checkbox 'Assigned', :assigned, 'boo', :values => ['boo']
|
244
242
|
end
|
245
243
|
|
246
244
|
assert(<<-FORM, out)
|
247
245
|
<form method="get">
|
248
246
|
<p>
|
249
247
|
<label for="form_assigned_0">Assigned</label>
|
250
|
-
<input type="hidden" name="assigned" value="ramaze" />
|
251
248
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_0" checked="checked" value="boo" /> boo</span>
|
252
249
|
</p>
|
253
250
|
</form>
|
254
251
|
FORM
|
255
252
|
end
|
256
|
-
|
253
|
+
|
254
|
+
it 'Make a form with input_checkbox(label, name) but hide the value of the checkbox' do
|
255
|
+
out = form_for(@data, :method => :get) do |f|
|
256
|
+
f.input_checkbox 'Assigned', :assigned, nil, :show_value => false
|
257
|
+
end
|
258
|
+
|
259
|
+
assert(<<-FORM, out)
|
260
|
+
<form method="get">
|
261
|
+
<p>
|
262
|
+
<label for="form_assigned_0">Assigned</label>
|
263
|
+
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_0" value="bacon" /></span>
|
264
|
+
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_1" value="steak" /></span>
|
265
|
+
</p>
|
266
|
+
</form>
|
267
|
+
FORM
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'Make a form with input_checkbox(label, name) but hide thelabel' do
|
271
|
+
out = form_for(@data, :method => :get) do |f|
|
272
|
+
f.input_checkbox 'Assigned', :assigned, nil, :show_label => false
|
273
|
+
end
|
274
|
+
|
275
|
+
assert(<<-FORM, out)
|
276
|
+
<form method="get">
|
277
|
+
<p>
|
278
|
+
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_0" value="bacon" /> bacon</span>
|
279
|
+
<span class="checkbox_wrap"><input type="checkbox" name="assigned[]" id="form_assigned_1" value="steak" /> steak</span>
|
280
|
+
</p>
|
281
|
+
</form>
|
282
|
+
FORM
|
283
|
+
end
|
284
|
+
|
257
285
|
# ------------------------------------------------
|
258
286
|
# Checkboxes using a hash
|
259
|
-
|
287
|
+
|
260
288
|
it 'Make a form with input_checkbox(label, name) using a hash' do
|
261
289
|
out = form_for(@data, :method => :get) do |f|
|
262
290
|
f.input_checkbox 'Assigned', :assigned_hash
|
@@ -266,7 +294,6 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
266
294
|
<form method="get">
|
267
295
|
<p>
|
268
296
|
<label for="form_assigned_hash_0">Assigned</label>
|
269
|
-
<input type="hidden" name="assigned_hash" value="0" />
|
270
297
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned_hash[]" id="form_assigned_hash_0" value="bacon" /> Bacon</span>
|
271
298
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned_hash[]" id="form_assigned_hash_1" value="steak" /> Steak</span>
|
272
299
|
</p>
|
@@ -283,7 +310,6 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
283
310
|
<form method="get">
|
284
311
|
<p>
|
285
312
|
<label for="form_assigned_hash_0">Assigned</label>
|
286
|
-
<input type="hidden" name="assigned_hash" value="0" />
|
287
313
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned_hash[]" id="form_assigned_hash_0" checked="checked" value="bacon" /> Bacon</span>
|
288
314
|
<span class="checkbox_wrap"><input type="checkbox" name="assigned_hash[]" id="form_assigned_hash_1" value="steak" /> Steak</span>
|
289
315
|
</p>
|
@@ -293,17 +319,16 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
293
319
|
|
294
320
|
# ------------------------------------------------
|
295
321
|
# Radio buttons
|
296
|
-
|
322
|
+
|
297
323
|
it 'Make a form with input_radio(label, name)' do
|
298
324
|
out = form_for(@data, :method => :get) do |f|
|
299
325
|
f.input_radio 'Assigned', :assigned
|
300
326
|
end
|
301
|
-
|
327
|
+
|
302
328
|
assert(<<-FORM, out)
|
303
329
|
<form method="get">
|
304
330
|
<p>
|
305
331
|
<label for="form_assigned_0">Assigned</label>
|
306
|
-
<input type="hidden" name="assigned" value="0" />
|
307
332
|
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_0" value="bacon" /> bacon</span>
|
308
333
|
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_1" value="steak" /> steak</span>
|
309
334
|
</p>
|
@@ -320,33 +345,63 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
320
345
|
<form method="get">
|
321
346
|
<p>
|
322
347
|
<label for="form_assigned_0">Assigned</label>
|
323
|
-
<input type="hidden" name="assigned" value="0" />
|
324
348
|
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_0" checked="checked" value="bacon" /> bacon</span>
|
325
349
|
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_1" value="steak" /> steak</span>
|
326
350
|
</p>
|
327
351
|
</form>
|
328
352
|
FORM
|
329
353
|
end
|
330
|
-
|
354
|
+
|
331
355
|
it 'Make a form with input_radio(label, name, checked, values, default)' do
|
332
356
|
out = form_for(@data, :method => :get) do |f|
|
333
|
-
f.input_radio 'Assigned', :assigned, 'boo', :values => ['boo']
|
357
|
+
f.input_radio 'Assigned', :assigned, 'boo', :values => ['boo']
|
334
358
|
end
|
335
359
|
|
336
360
|
assert(<<-FORM, out)
|
337
361
|
<form method="get">
|
338
362
|
<p>
|
339
363
|
<label for="form_assigned_0">Assigned</label>
|
340
|
-
<input type="hidden" name="assigned" value="ramaze" />
|
341
364
|
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_0" checked="checked" value="boo" /> boo</span>
|
342
365
|
</p>
|
343
366
|
</form>
|
344
367
|
FORM
|
345
368
|
end
|
346
|
-
|
369
|
+
|
370
|
+
it 'Make a form with input_radio(label, name) but hide the value' do
|
371
|
+
out = form_for(@data, :method => :get) do |f|
|
372
|
+
f.input_radio 'Assigned', :assigned, nil, :show_value => false
|
373
|
+
end
|
374
|
+
|
375
|
+
assert(<<-FORM, out)
|
376
|
+
<form method="get">
|
377
|
+
<p>
|
378
|
+
<label for="form_assigned_0">Assigned</label>
|
379
|
+
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_0" value="bacon" /></span>
|
380
|
+
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_1" value="steak" /></span>
|
381
|
+
</p>
|
382
|
+
</form>
|
383
|
+
FORM
|
384
|
+
end
|
385
|
+
|
386
|
+
it 'Make a form with input_radio(label, name) but hide the label' do
|
387
|
+
out = form_for(@data, :method => :get) do |f|
|
388
|
+
f.input_radio 'Assigned', :assigned, nil, :show_label => false
|
389
|
+
end
|
390
|
+
|
391
|
+
assert(<<-FORM, out)
|
392
|
+
<form method="get">
|
393
|
+
<p>
|
394
|
+
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_0" value="bacon" /> bacon</span>
|
395
|
+
<span class="radio_wrap"><input type="radio" name="assigned" id="form_assigned_1" value="steak" /> steak</span>
|
396
|
+
</p>
|
397
|
+
</form>
|
398
|
+
FORM
|
399
|
+
end
|
400
|
+
|
401
|
+
|
347
402
|
# ------------------------------------------------
|
348
403
|
# Radio buttons using a hash
|
349
|
-
|
404
|
+
|
350
405
|
it 'Make a form with input_radio(label, name) using a hash' do
|
351
406
|
out = form_for(@data, :method => :get) do |f|
|
352
407
|
f.input_radio 'Assigned', :assigned_hash
|
@@ -356,7 +411,6 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
356
411
|
<form method="get">
|
357
412
|
<p>
|
358
413
|
<label for="form_assigned_hash_0">Assigned</label>
|
359
|
-
<input type="hidden" name="assigned_hash" value="0" />
|
360
414
|
<span class="radio_wrap"><input type="radio" name="assigned_hash" id="form_assigned_hash_0" value="bacon" /> Bacon</span>
|
361
415
|
<span class="radio_wrap"><input type="radio" name="assigned_hash" id="form_assigned_hash_1" value="steak" /> Steak</span>
|
362
416
|
</p>
|
@@ -373,7 +427,6 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
373
427
|
<form method="get">
|
374
428
|
<p>
|
375
429
|
<label for="form_assigned_hash_0">Assigned</label>
|
376
|
-
<input type="hidden" name="assigned_hash" value="0" />
|
377
430
|
<span class="radio_wrap"><input type="radio" name="assigned_hash" id="form_assigned_hash_0" checked="checked" value="bacon" /> Bacon</span>
|
378
431
|
<span class="radio_wrap"><input type="radio" name="assigned_hash" id="form_assigned_hash_1" value="steak" /> Steak</span>
|
379
432
|
</p>
|
@@ -383,12 +436,12 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
383
436
|
|
384
437
|
# ------------------------------------------------
|
385
438
|
# File uploading
|
386
|
-
|
439
|
+
|
387
440
|
it 'Make a form with input_file(label, name)' do
|
388
441
|
out = form_for(@data, :method => :get) do |f|
|
389
442
|
f.input_file 'File', :file
|
390
443
|
end
|
391
|
-
|
444
|
+
|
392
445
|
assert(<<-FORM, out)
|
393
446
|
<form method="get">
|
394
447
|
<p>
|
@@ -403,7 +456,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
403
456
|
out = form_for(@data, :method => :get) do |f|
|
404
457
|
f.input_file 'File', :file, :id => 'awesome_file'
|
405
458
|
end
|
406
|
-
|
459
|
+
|
407
460
|
assert(<<-FORM, out)
|
408
461
|
<form method="get">
|
409
462
|
<p>
|
@@ -413,10 +466,10 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
413
466
|
</form>
|
414
467
|
FORM
|
415
468
|
end
|
416
|
-
|
469
|
+
|
417
470
|
# ------------------------------------------------
|
418
471
|
# Hidden fields
|
419
|
-
|
472
|
+
|
420
473
|
it 'Make a form with input_hidden(name, value)' do
|
421
474
|
out = form_for(@data, :method => :get) do |f|
|
422
475
|
f.input_hidden :username, 'Bob Ross'
|
@@ -428,7 +481,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
428
481
|
</form>
|
429
482
|
FORM
|
430
483
|
end
|
431
|
-
|
484
|
+
|
432
485
|
it 'Make a form with input_hidden(name, value, id)' do
|
433
486
|
out = form_for(@data, :method => :get) do |f|
|
434
487
|
f.input_hidden :username, 'Bob Ross', :id => 'test'
|
@@ -440,10 +493,10 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
440
493
|
</form>
|
441
494
|
FORM
|
442
495
|
end
|
443
|
-
|
496
|
+
|
444
497
|
# ------------------------------------------------
|
445
498
|
# Textarea elements
|
446
|
-
|
499
|
+
|
447
500
|
it 'Make a form with textarea(label, name)' do
|
448
501
|
out = form_for(@data, :method => :get) do |f|
|
449
502
|
f.textarea 'Message', :message
|
@@ -463,7 +516,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
463
516
|
out = form_for(@data, :method => :get) do |f|
|
464
517
|
f.textarea 'Message', :message, :value => 'stuff'
|
465
518
|
end
|
466
|
-
|
519
|
+
|
467
520
|
assert(<<-FORM, out)
|
468
521
|
<form method="get">
|
469
522
|
<p>
|
@@ -473,7 +526,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
473
526
|
</form>
|
474
527
|
FORM
|
475
528
|
end
|
476
|
-
|
529
|
+
|
477
530
|
# ------------------------------------------------
|
478
531
|
# Select elements
|
479
532
|
|
@@ -514,12 +567,12 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
514
567
|
</form>
|
515
568
|
FORM
|
516
569
|
end
|
517
|
-
|
570
|
+
|
518
571
|
it 'Make a form with select(label, name) from an array' do
|
519
572
|
out = form_for(@data, :method => :get) do |f|
|
520
573
|
f.select 'Server', :servers_array
|
521
574
|
end
|
522
|
-
|
575
|
+
|
523
576
|
assert(<<-FORM, out)
|
524
577
|
<form method="get">
|
525
578
|
<p>
|
@@ -538,7 +591,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
538
591
|
out = form_for(@data, :method => :get) do |f|
|
539
592
|
f.select 'Server', :servers_array, :selected => 'Mongrel'
|
540
593
|
end
|
541
|
-
|
594
|
+
|
542
595
|
assert(<<-FORM, out)
|
543
596
|
<form method="get">
|
544
597
|
<p>
|
@@ -552,10 +605,10 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
552
605
|
</form>
|
553
606
|
FORM
|
554
607
|
end
|
555
|
-
|
608
|
+
|
556
609
|
# ------------------------------------------------
|
557
610
|
# Select elements with custom values
|
558
|
-
|
611
|
+
|
559
612
|
it 'Make a form with select(label, name) from a hash using custom values' do
|
560
613
|
out = form_for(@data, :method => :get) do |f|
|
561
614
|
f.select 'People', :people_hash, :values => {:chuck => 'Chuck', :bob => 'Bob'}
|
@@ -591,7 +644,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
591
644
|
</form>
|
592
645
|
FORM
|
593
646
|
end
|
594
|
-
|
647
|
+
|
595
648
|
it 'Make a form with select(label, name) from an array using custom values' do
|
596
649
|
out = form_for(@data, :method => :get) do |f|
|
597
650
|
f.select 'People', :people_array, :values => ['Chuck', 'Bob']
|
@@ -627,12 +680,12 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
627
680
|
</form>
|
628
681
|
FORM
|
629
682
|
end
|
630
|
-
|
683
|
+
|
631
684
|
it 'Make a form with multiple select(label, name) from a hash' do
|
632
685
|
out = form_for(@data, :method => :get) do |f|
|
633
686
|
f.select 'Server', :servers_hash, :multiple => :multiple
|
634
687
|
end
|
635
|
-
|
688
|
+
|
636
689
|
assert(<<-FORM, out)
|
637
690
|
<form method="get">
|
638
691
|
<p>
|
@@ -646,12 +699,12 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
646
699
|
</form>
|
647
700
|
FORM
|
648
701
|
end
|
649
|
-
|
702
|
+
|
650
703
|
it 'Make a form with multiple select(label, name, selected) from a hash' do
|
651
704
|
out = form_for(@data, :method => :get) do |f|
|
652
705
|
f.select 'Server', :servers_hash, :multiple => :multiple, :selected => :webrick
|
653
706
|
end
|
654
|
-
|
707
|
+
|
655
708
|
assert(<<-FORM, out)
|
656
709
|
<form method="get">
|
657
710
|
<p>
|
@@ -665,12 +718,12 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
665
718
|
</form>
|
666
719
|
FORM
|
667
720
|
end
|
668
|
-
|
721
|
+
|
669
722
|
it 'Make a form with multiple select(label, name, selected) from a hash' do
|
670
723
|
out = form_for(@data, :method => :get) do |f|
|
671
724
|
f.select 'Server', :servers_hash, :multiple => :multiple, :selected => [:webrick, :mongrel]
|
672
725
|
end
|
673
|
-
|
726
|
+
|
674
727
|
assert(<<-FORM, out)
|
675
728
|
<form method="get">
|
676
729
|
<p>
|
@@ -684,7 +737,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
684
737
|
</form>
|
685
738
|
FORM
|
686
739
|
end
|
687
|
-
|
740
|
+
|
688
741
|
# ------------------------------------------------
|
689
742
|
# Error messages
|
690
743
|
|
@@ -693,7 +746,7 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
693
746
|
out = form_for(@data, :method => :get) do |f|
|
694
747
|
f.input_text 'Username', :username
|
695
748
|
end
|
696
|
-
|
749
|
+
|
697
750
|
assert(<<-FORM, out)
|
698
751
|
<form method="get">
|
699
752
|
<p>
|
@@ -707,11 +760,11 @@ describe BF = Ramaze::Helper::BlueForm do
|
|
707
760
|
it 'Retrieve all errors messages from the model' do
|
708
761
|
@data.errors = {:username => "May not be empty"}
|
709
762
|
form_errors_from_model(@data)
|
710
|
-
|
763
|
+
|
711
764
|
out = form_for(@data, :method => :get) do |f|
|
712
765
|
f.input_text 'Username', :username
|
713
766
|
end
|
714
|
-
|
767
|
+
|
715
768
|
assert(<<-FORM, out)
|
716
769
|
<form method="get">
|
717
770
|
<p>
|