masterview 0.1.5 → 0.2.0
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/CHANGELOG +17 -0
- data/README +36 -504
- data/RELEASE_NOTES +126 -45
- data/Rakefile +215 -86
- data/TODO +8 -3
- data/doc/configuration.html +485 -0
- data/doc/directives.html +1085 -0
- data/doc/guide.html +243 -0
- data/doc/index.html +287 -0
- data/doc/installation.html +376 -0
- data/doc/stylesheets/masterview.css +206 -0
- data/doc/stylesheets/mv-config.css +23 -0
- data/doc/stylesheets/mv-directives.css +18 -0
- data/doc/stylesheets/mv-installation.css +10 -0
- data/doc/troubleshooting.html +18 -0
- data/examples/product.html +256 -0
- data/examples/product.html.old +107 -0
- data/examples/rails_app_config/masterview/environment/development.rb +22 -0
- data/examples/rails_app_config/masterview/environment/production.rb +9 -0
- data/examples/rails_app_config/masterview/settings.rb +59 -0
- data/examples/test.import +80 -0
- data/init.rb +26 -12
- data/lib/masterview/analyzer.rb +25 -15
- data/lib/masterview/directive_base.rb +4 -0
- data/lib/masterview/directive_helpers.rb +7 -5
- data/lib/masterview/directives/import_render.rb +6 -0
- data/lib/masterview/directives/insert_generated_comment.rb +8 -8
- data/lib/masterview/extras/app/controllers/masterview_controller.rb +154 -2
- data/lib/masterview/extras/app/views/masterview/admin/create.rhtml +4 -4
- data/lib/masterview/extras/app/views/masterview/admin/empty.rhtml +1 -1
- data/lib/masterview/extras/app/views/masterview/admin/list.rhtml +14 -9
- data/lib/masterview/extras/app/views/masterview/admin/view_rhtml.rhtml +70 -0
- data/lib/masterview/extras/init_logger.rb +102 -0
- data/lib/masterview/extras/init_rails_erb_mv_direct.rb +117 -0
- data/lib/masterview/extras/init_rails_reparse_checking.rb +59 -0
- data/lib/masterview/extras/watcher.rb +17 -23
- data/lib/masterview/filter_helpers.rb +26 -0
- data/lib/masterview/initializer.rb +912 -0
- data/lib/masterview/io.rb +352 -0
- data/lib/masterview/keyword_expander.rb +116 -0
- data/lib/masterview/masterview_version.rb +2 -2
- data/lib/masterview/mtime_tracking_hash.rb +44 -0
- data/lib/masterview/parser.rb +64 -92
- data/lib/masterview/pathname_extensions.rb +33 -0
- data/lib/masterview/template_spec.rb +49 -56
- data/lib/masterview.rb +40 -85
- data/test/fixtures/configs/fake_rails_app_with_config/config/masterview/environments/development.rb +12 -0
- data/test/fixtures/configs/fake_rails_app_with_config/config/masterview/environments/production.rb +11 -0
- data/test/fixtures/configs/fake_rails_app_with_config/config/masterview/settings.rb +23 -0
- data/test/fixtures/templates/product.html +256 -0
- data/test/fixtures/templates/test.import +80 -0
- data/test/test_helper.rb +5 -3
- data/test/tmp/template/foo.txt +1 -0
- data/test/tmp/templates_src/product.html +256 -0
- data/test/tmp/views/layouts/product.rhtml +35 -0
- data/test/tmp/views/product/_form.rhtml +30 -0
- data/test/tmp/views/product/_product.rhtml +14 -0
- data/test/tmp/views/product/_show.rhtml +27 -0
- data/test/tmp/views/product/destroy.rhtml +27 -0
- data/test/tmp/views/product/edit.rhtml +26 -0
- data/test/tmp/views/product/list.rhtml +31 -0
- data/test/tmp/views/product/new.rhtml +29 -0
- data/test/tmp/views/product/show.rhtml +16 -0
- data/test/unit/config_settings_test.rb +172 -0
- data/test/{attr_test.rb → unit/directive_attr_test.rb} +2 -2
- data/test/{block_test.rb → unit/directive_block_test.rb} +2 -2
- data/test/{content_test.rb → unit/directive_content_test.rb} +2 -2
- data/test/{else_test.rb → unit/directive_else_test.rb} +2 -2
- data/test/{elsif_test.rb → unit/directive_elsif_test.rb} +2 -2
- data/test/{form_test.rb → unit/directive_form_test.rb} +2 -2
- data/test/{global_inline_erb_test.rb → unit/directive_global_inline_erb_test.rb} +2 -2
- data/test/{hidden_field_test.rb → unit/directive_hidden_field_test.rb} +2 -2
- data/test/{if_test.rb → unit/directive_if_test.rb} +2 -2
- data/test/unit/directive_import_render_test.rb +62 -0
- data/test/{import_test.rb → unit/directive_import_test.rb} +2 -2
- data/test/{javascript_include_test.rb → unit/directive_javascript_include_test.rb} +2 -2
- data/test/{link_to_if_test.rb → unit/directive_link_to_if_test.rb} +2 -2
- data/test/{link_to_test.rb → unit/directive_link_to_test.rb} +2 -2
- data/test/{omit_tag_test.rb → unit/directive_omit_tag_test.rb} +2 -2
- data/test/{password_field_test.rb → unit/directive_password_field_test.rb} +2 -2
- data/test/{replace_test.rb → unit/directive_replace_test.rb} +2 -2
- data/test/{stylesheet_link_test.rb → unit/directive_stylesheet_link_test.rb} +2 -2
- data/test/{submit_test.rb → unit/directive_submit_test.rb} +2 -2
- data/test/{text_area_test.rb → unit/directive_text_area_test.rb} +2 -2
- data/test/{text_field_test.rb → unit/directive_text_field_test.rb} +2 -2
- data/test/{example_test.rb → unit/example_test.rb} +1 -1
- data/test/unit/file_mio_test.rb +368 -0
- data/test/{filter_helpers_test.rb → unit/filter_helpers_test.rb} +1 -1
- data/test/unit/keyword_expander_test.rb +95 -0
- data/test/unit/mio_test.rb +110 -0
- data/test/unit/mtime_string_hash_mio_tree_test.rb +289 -0
- data/test/unit/mtime_tracking_hash_test.rb +38 -0
- data/test/{parser_test.rb → unit/parser_test.rb} +19 -1
- data/test/unit/pathname_extensions_test.rb +46 -0
- data/test/{run_parser_test.rb → unit/run_parser_test.rb} +7 -3
- data/test/unit/string_hash_mio_test.rb +320 -0
- data/test/unit/template_file_watcher_test.rb +107 -0
- data/test/{template_spec_test.rb → unit/template_spec_test.rb} +57 -21
- data/test/{template_test.rb → unit/template_test.rb} +123 -22
- data/test/xtras/config-mv-logger_config.rb +109 -0
- data/test/xtras/config_initialize_standalone.rb +53 -0
- metadata +111 -38
- data/lib/masterview/extras/rails_init.rb +0 -72
- data/test/import_render_test.rb +0 -30
- data/test/template_file_watcher_test.rb +0 -50
data/doc/directives.html
ADDED
@@ -0,0 +1,1085 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
|
9
|
+
<title>MasterView - Directives Reference</title>
|
10
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
11
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
12
|
+
|
13
|
+
<link href="./stylesheets/masterview.css" rel="stylesheet" type="text/css" />
|
14
|
+
<link href="./stylesheets/mv-directives.css" rel="stylesheet" type="text/css" />
|
15
|
+
</head>
|
16
|
+
|
17
|
+
<body>
|
18
|
+
|
19
|
+
<div id="pageHeader">
|
20
|
+
<div>MasterView Template Engine</div>
|
21
|
+
<div class="description">Rails-optimized (x)html friendly template engine</div>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div id="pageBody">
|
25
|
+
<div id="bodyContent" mv:generate="{template_path}" mv:omit_tag="">
|
26
|
+
|
27
|
+
<h1>MasterView - Directives Reference</h1>
|
28
|
+
|
29
|
+
<p>MasterView template processing directives are encoded in an (x)html template
|
30
|
+
using attribute markup. A MasterView directive is an element attribute
|
31
|
+
in the <span class="directiveName">mv:</span> namespace.
|
32
|
+
By convention, Masterview directive attribute names use lower-case letters with
|
33
|
+
underscore as a separator, e.g., <span class="directiveName">mv:generate</span>, <span class="directiveName">mv:link_to</span>.
|
34
|
+
</p>
|
35
|
+
|
36
|
+
<p class="explanation">
|
37
|
+
<b>Note:</b> use of the <span class="directiveName">mv:</span> namespace
|
38
|
+
used for MasterView directives in an (x)html template can be modified
|
39
|
+
by a configuration setting. See the <a href="configuration.html">MasterView Configuration Guide</a> for details. However, we recommend that you do not change this namespace convention unless truly necessary - it's easier to understand your templates when they follow the standard markup convention.
|
40
|
+
</p>
|
41
|
+
|
42
|
+
<p>MasterView provides a number of built-in directives for general use.
|
43
|
+
You can also create your own custom directives to extend the power of the
|
44
|
+
MasterView template processing with markup notation and processing directives
|
45
|
+
that support standard uses for your particular application.
|
46
|
+
<!--TODO: add link the Directive Developer's Guide-->
|
47
|
+
</p>
|
48
|
+
|
49
|
+
<h3>Keyword Substitution in Directives</h3>
|
50
|
+
<p>
|
51
|
+
MasterView supports several standard keywords derived from information about the template
|
52
|
+
file being processed that can be used in attribute values for the
|
53
|
+
<span class="directiveName">mv:generate</span> and
|
54
|
+
<span class="directiveName">mv:gen_partial</span> directives.
|
55
|
+
</p>
|
56
|
+
<pre class="code">
|
57
|
+
{template_path} == use original masterview template path with default output extension (one/foo/bar.rhtml)
|
58
|
+
{template_path}.ext == use original masterview template path with the specified extension (one/foo/bar.ext)
|
59
|
+
{template_dir_path} == direct_parent_dirname (one/foo)
|
60
|
+
{template_basename} == base filename (bar)
|
61
|
+
{extension} == filename extension (.html)
|
62
|
+
</pre>
|
63
|
+
|
64
|
+
<p>A typical use would be to specify the generated output for the main content
|
65
|
+
of a template <code>one/two/foo.html</code> with the directive
|
66
|
+
<code>mv:generate="{template_path}"</code>.
|
67
|
+
This keyword notation avoids the need to replicate the template's own file name or
|
68
|
+
it's relative path within the Rails <code>app/views</code> directory in the
|
69
|
+
directive markup in the template.
|
70
|
+
</p>
|
71
|
+
|
72
|
+
|
73
|
+
<h2>Directives Summary</h2>
|
74
|
+
<table class="toc" summary="summary of directives, grouped by functional area">
|
75
|
+
<tbody>
|
76
|
+
<tr class="subheader">
|
77
|
+
<td colspan="2"><a href="#processing_directives">Template Processing Directives</a></td>
|
78
|
+
</tr>
|
79
|
+
<tr>
|
80
|
+
<td class="directive"><a href="#mv_generate">mv:generate</a></td>
|
81
|
+
<td>Generate output containing this element and its children</td>
|
82
|
+
</tr>
|
83
|
+
<tr>
|
84
|
+
<td class="directive"><a href="#mv_import">mv:import</a></td>
|
85
|
+
<td>Design-time directive to mark a snapshot of generated code</td>
|
86
|
+
</tr>
|
87
|
+
<tr>
|
88
|
+
<td class="directive"><a href="#mv_gen_partial">mv:gen_partial</a></td>
|
89
|
+
<td>Generate a Rails partial</td>
|
90
|
+
</tr>
|
91
|
+
<tr>
|
92
|
+
<td class="directive"><a href="#mv_import_render">mv:import_render</a></td>
|
93
|
+
<td>Design-time directive to mark a snapshot of generated partial code</td>
|
94
|
+
</tr>
|
95
|
+
<tr>
|
96
|
+
<td class="directive"><a href="#mv_gen_replace">mv:gen_replace</a></td>
|
97
|
+
<td>Used with <span class="directiveName">mv:generate</span> to replace the content of this element in the generated output with the value of the attribute</td>
|
98
|
+
</tr>
|
99
|
+
|
100
|
+
<tr class="subheader">
|
101
|
+
<td colspan="2"><a href="#general_directives">General Processing Directives</a></td>
|
102
|
+
</tr>
|
103
|
+
<tr>
|
104
|
+
<td class="directive"><a href="#mv_attr">mv:attr</a></td>
|
105
|
+
<td>Replaces attribute value(s) on this element with the value of an expression</td>
|
106
|
+
</tr>
|
107
|
+
<tr>
|
108
|
+
<td class="directive"><a href="#mv_content">mv:content</a></td>
|
109
|
+
<td>Replaces the content of this element with the value of the expression</td>
|
110
|
+
</tr>
|
111
|
+
<tr>
|
112
|
+
<td class="directive"><a href="#mv_omit_tag">mv:omit_tag</a></td>
|
113
|
+
<td>Omits this element from the generated output if the value is empty or evaluates to true</td>
|
114
|
+
</tr>
|
115
|
+
<tr>
|
116
|
+
<td class="directive"><a href="#mv_replace">mv:replace</a></td>
|
117
|
+
<td>Replaces this element and its content with the value of the expression</td>
|
118
|
+
</tr>
|
119
|
+
|
120
|
+
<tr class="subheader">
|
121
|
+
<td colspan="2"><a href="#erb_control_directives">Erb and Control Flow Directives</a></td>
|
122
|
+
</tr>
|
123
|
+
<tr>
|
124
|
+
<td class="directive"><a href="#mv_block">mv:block</a></td>
|
125
|
+
<td>Expands to the equivalent rhtml (erb) block code around this element</td>
|
126
|
+
</tr>
|
127
|
+
<tr>
|
128
|
+
<td class="directive"><a href="#mv_if">mv:if</a></td>
|
129
|
+
<td>Wraps this element with an <code>if... end</code> block using the attribute contents for the condition</td>
|
130
|
+
</tr>
|
131
|
+
<tr>
|
132
|
+
<td class="directive"><a href="#mv_elsif">mv:elsif</a></td>
|
133
|
+
<td>Used in conjunction with the <span class="directiveName">mv:if</span> directive to allow you to create <code>if... elsif... end</code> blocks</td>
|
134
|
+
</tr>
|
135
|
+
<tr>
|
136
|
+
<td class="directive"><a href="#mv_else">mv:else</a></td>
|
137
|
+
<td>Used in conjunction with the <span class="directiveName">mv:if</span> and <span class="directiveName">mv:elsif</span> directives to allow you to create <code>if... elsif... else... end</code> blocks</td>
|
138
|
+
</tr>
|
139
|
+
<tr>
|
140
|
+
<td class="directive"><a href="#mv_inline_erb">Inline Erb substitutions </a></td>
|
141
|
+
<td>Inline substitution notation for Erb expressions</td>
|
142
|
+
</tr>
|
143
|
+
|
144
|
+
<tr class="subheader">
|
145
|
+
<td colspan="2"><a href="#asset_link_directives">Rails Asset and Link Helper Directives</a></td>
|
146
|
+
</tr>
|
147
|
+
<tr>
|
148
|
+
<td class="directive"><a href="#mv_javascript_include">mv:javascript_include</a></td>
|
149
|
+
<td>Replaces this element using the Rails <code>javascript_include_tag</code> helper.
|
150
|
+
<span class="explanation">(
|
151
|
+
Used on <code><script></code> element in html header section
|
152
|
+
)</span>
|
153
|
+
</td>
|
154
|
+
</tr>
|
155
|
+
<tr>
|
156
|
+
<td class="directive"><a href="#mv_link_to">mv:link_to</a></td>
|
157
|
+
<td>Replaces this element using the Rails <code>link_to</code> helper.
|
158
|
+
<span class="explanation">(
|
159
|
+
Used on <code><a></code> link elements
|
160
|
+
)</span>
|
161
|
+
</td>
|
162
|
+
</tr>
|
163
|
+
<tr>
|
164
|
+
<td class="directive"><a href="#mv_link_to_if">mv:link_to_if</a></td>
|
165
|
+
<td>Replaces this element using the Rails <code>link_to_if</code> helper
|
166
|
+
<span class="explanation">(
|
167
|
+
Used on <code><a></code> link elements
|
168
|
+
)</span>
|
169
|
+
</td>
|
170
|
+
</tr>
|
171
|
+
<tr>
|
172
|
+
<td class="directive"><a href="#mv_link_to_remote">mv:link_to_remote</a></td>
|
173
|
+
<td>Replaces this element using the Rails <code>link_to_remote</code> helper
|
174
|
+
<span class="explanation">(
|
175
|
+
Used on <code><a></code> link elements
|
176
|
+
)</span>
|
177
|
+
</td>
|
178
|
+
</tr>
|
179
|
+
<tr>
|
180
|
+
<td class="directive"><a href="#mv_stylesheet_link">mv:stylesheet_link</a></td>
|
181
|
+
<td>Replaces this element using the Rails <code>stylesheet_link_tag</code> helper
|
182
|
+
<span class="explanation">(
|
183
|
+
Used on stylesheet <code><link></code> elements in html header section
|
184
|
+
)</span>
|
185
|
+
</td>
|
186
|
+
</tr>
|
187
|
+
|
188
|
+
<tr class="subheader">
|
189
|
+
<td colspan="2"><a href="#form_directives">Rails Form Helper Directives</a></td>
|
190
|
+
</tr>
|
191
|
+
<tr>
|
192
|
+
<td class="directive"><a href="#mv_form">mv:form</a></td>
|
193
|
+
<td>Replaces the start and end tags of this element using the Rails <code>form_tag</code> and <code>form_tag</code> helpers</td>
|
194
|
+
</tr>
|
195
|
+
<tr>
|
196
|
+
<td class="directive"><a href="#mv_hidden_field">mv:hidden_field</a></td>
|
197
|
+
<td>Replaces this element with a <code>hidden</code> input element using the Rails <code>hidden_tag</code> helper.
|
198
|
+
<span class="explanation">(
|
199
|
+
Used on <code><input></code> form elements
|
200
|
+
)</span>
|
201
|
+
</td>
|
202
|
+
</tr>
|
203
|
+
<tr>
|
204
|
+
<td class="directive"><a href="#mv_password_field">mv:password_field</a></td>
|
205
|
+
<td>Replaces this element with a <code>password</code> input element using the Rails <code>password_field</code> helper.
|
206
|
+
<span class="explanation">(
|
207
|
+
Used on <code><input></code> form elements
|
208
|
+
)</span>
|
209
|
+
</td>
|
210
|
+
</tr>
|
211
|
+
<tr>
|
212
|
+
<td class="directive"><a href="#mv_submit">mv:submit</a></td>
|
213
|
+
<td>Replaces this element with a <code>submit</code> input element using the Rails <code>submit_tag</code> helper.
|
214
|
+
<span class="explanation">(
|
215
|
+
Used on <code><input></code> form elements
|
216
|
+
)</span>
|
217
|
+
</td>
|
218
|
+
</tr>
|
219
|
+
|
220
|
+
<tr>
|
221
|
+
<td class="directive"><a href="#mv_text_area">mv:text_area</a></td>
|
222
|
+
<td>Replaces this element with a <code>textarea</code> input element using the Rails <code>text_area</code> helper.
|
223
|
+
<span class="explanation">(
|
224
|
+
Used on <code><textarea></code> form elements
|
225
|
+
)</span>
|
226
|
+
</td>
|
227
|
+
</tr>
|
228
|
+
<tr>
|
229
|
+
<td class="directive"><a href="#mv_text_field">mv:text_field</a></td>
|
230
|
+
<td>Replaces this element with a <code>text</code> input element using the Rails <code>text_field</code> helper.
|
231
|
+
<span class="explanation">(
|
232
|
+
Used on <code><input></code> form elements
|
233
|
+
)</span>
|
234
|
+
</td>
|
235
|
+
</tr>
|
236
|
+
|
237
|
+
<!--
|
238
|
+
<tr>
|
239
|
+
<td class="directive"><a href="#mv_NAME">mv:NAME</a></td>
|
240
|
+
<td>DESCR</td>
|
241
|
+
</tr>
|
242
|
+
-->
|
243
|
+
</tbody>
|
244
|
+
</table>
|
245
|
+
|
246
|
+
<p class="explanation"><a href="#directives_index">Directives Index</a> (alphabetical)</p>
|
247
|
+
|
248
|
+
<hr />
|
249
|
+
<h2>Directives Reference</h2>
|
250
|
+
|
251
|
+
<a name="processing_directives"></a>
|
252
|
+
<h3>Template Processing Directives</h3>
|
253
|
+
<a name="mv_generate"></a>
|
254
|
+
<h4>mv:generate</h4>
|
255
|
+
<p>
|
256
|
+
mv:generate="layouts/product.rhtml"
|
257
|
+
</p>
|
258
|
+
<pre>
|
259
|
+
When the generate directive is encountered it creates a new output rhtml file where this element and its
|
260
|
+
children will be rendered. It also will suspend outputting to any previous output file until it is done with this
|
261
|
+
one (nested). MasterView will not output any rhtml files unless it encouters one of these or mv:gen_partial directive
|
262
|
+
below. Typically you will have one of these in the very top html element to generate the layout, and you will have
|
263
|
+
additional directives further inside to output different view partials and forms. MasterView takes this one html
|
264
|
+
file and generates all the other layout, forms, and partials that you would do manually. for example...
|
265
|
+
|
266
|
+
<html mv:generate="layouts/product.rhtml">
|
267
|
+
<title>Hello</title>
|
268
|
+
<body>
|
269
|
+
<div mv:replace="@content_for_layout">
|
270
|
+
<div mv:generate="product/new.rhtml">
|
271
|
+
<form></form>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
</body>
|
275
|
+
</html>
|
276
|
+
|
277
|
+
outputs to two files
|
278
|
+
|
279
|
+
app/views/layouts/product.rhtml
|
280
|
+
<html>
|
281
|
+
<title>Hello</title>
|
282
|
+
<body>
|
283
|
+
<%= @content_for_layout %>
|
284
|
+
</body>
|
285
|
+
</html>
|
286
|
+
|
287
|
+
app/views/product/new.rhtml
|
288
|
+
<div>
|
289
|
+
<form></form>
|
290
|
+
</div>
|
291
|
+
</pre>
|
292
|
+
|
293
|
+
<a name="mv_import"></a>
|
294
|
+
<h4>mv:import</h4>
|
295
|
+
<p>
|
296
|
+
mv:import="layouts/product.rhtml"
|
297
|
+
</p>
|
298
|
+
<pre>
|
299
|
+
When the import directive is used, it is a mirror image of the generate directive, except that this directive
|
300
|
+
doesn't generate any output, it is only used for design time editing. The code inside this tag represents a point
|
301
|
+
in time capture of the real generated code and if it ever gets out of sync it can easily be sync'd back up by
|
302
|
+
visiting the MasterView admin page or using rake mv:rebuild_all
|
303
|
+
</pre>
|
304
|
+
|
305
|
+
<a name="mv_gen_partial"></a>
|
306
|
+
<h4>mv:gen_partial</h4>
|
307
|
+
<p>
|
308
|
+
mv:gen_partial=":partial => ‘product/form’"
|
309
|
+
</p>
|
310
|
+
<pre>
|
311
|
+
This directive does two things it creates a partial and it outputs the appropriate code to render this
|
312
|
+
partial in the parent output file before beginning output of the partial. It calculates the file name from the
|
313
|
+
:partial value and appends .rhtml for example...
|
314
|
+
|
315
|
+
<html mv:generate="layouts/product.rhtml">
|
316
|
+
<body>
|
317
|
+
<div mv:gen_partial=":partial => 'product/show'">
|
318
|
+
Name: <span class="static" mv:content="h @product.send(:name)">product Name dummy text</span>
|
319
|
+
Description: <span class="static" mv:content="h @product.send(:description)">product description dummy text</span>
|
320
|
+
</div>
|
321
|
+
</body>
|
322
|
+
</html>
|
323
|
+
|
324
|
+
outputs two files
|
325
|
+
|
326
|
+
app/views/layouts/product.rhtml
|
327
|
+
<html>
|
328
|
+
<body>
|
329
|
+
<%= render :partial => 'product/show' %>
|
330
|
+
</body>
|
331
|
+
</html>
|
332
|
+
|
333
|
+
app/views/product/_show.rhtml
|
334
|
+
<div>
|
335
|
+
Name: <span class="static"><%= h @product.send(:name) %></span>
|
336
|
+
Description: <span class="static"><%= h @product.send(:description) %></span>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
You can also use collections with your partials like
|
340
|
+
|
341
|
+
<div mv:gen_partial=":partial => 'shared/product', :collection => @products">
|
342
|
+
|
343
|
+
which will create the partial shared/_product.rhtml and will render this partial over a collection
|
344
|
+
</pre>
|
345
|
+
|
346
|
+
|
347
|
+
<a name="mv_import_render"></a>
|
348
|
+
<h4>mv:import_render</h4>
|
349
|
+
<p>
|
350
|
+
mv:import_render="partial => ‘product/form’"
|
351
|
+
</p>
|
352
|
+
<pre>
|
353
|
+
Similar to how import directive is a mirror to generate, import_render is a mirror to gen_partial. This directive
|
354
|
+
generates the appropriate render partial helper, but doesn't generate any additional output, it is only used for
|
355
|
+
design time editing and can be easily sync'd up if it ever gets out of sync with the original code.
|
356
|
+
</pre>
|
357
|
+
<p>
|
358
|
+
|
359
|
+
<a name="mv_gen_replace"></a>
|
360
|
+
<h4>mv:gen_replace</h4>
|
361
|
+
<p>
|
362
|
+
mv:gen_replace="whatToLeave"
|
363
|
+
</p>
|
364
|
+
<pre>
|
365
|
+
When used in conjunction with mv:generate directive it causes the value of the attribute to be erb
|
366
|
+
executed output in the parent file before transferring to the child (nested) output file. for example...
|
367
|
+
|
368
|
+
<html mv:generate="layouts/product.rhtml">
|
369
|
+
<title>Hello</title>
|
370
|
+
<body>
|
371
|
+
<div mv:generate="product/new.rhtml" mv:gen_replace="@content_for_layout>
|
372
|
+
<form></form>
|
373
|
+
</div>
|
374
|
+
</body>
|
375
|
+
</html>
|
376
|
+
|
377
|
+
outputs two files
|
378
|
+
|
379
|
+
app/views/layouts/product.rhtml
|
380
|
+
<html>
|
381
|
+
<title>Hello</title>
|
382
|
+
<body>
|
383
|
+
<%= @content_for_layout %>
|
384
|
+
</body>
|
385
|
+
</html>
|
386
|
+
|
387
|
+
app/views/product/new.rhtml
|
388
|
+
<div>
|
389
|
+
<form></form>
|
390
|
+
</div>
|
391
|
+
</pre>
|
392
|
+
|
393
|
+
<a name="general_directives"></a>
|
394
|
+
<h3>General Processing Directives</h3>
|
395
|
+
|
396
|
+
<a name="mv_attr"></a>
|
397
|
+
<h4>mv:attr</h4>
|
398
|
+
<p>
|
399
|
+
mv:attr=":foo => ‘bar’, :cat => #{h
|
400
|
+
product.name}"
|
401
|
+
</p>
|
402
|
+
<pre>
|
403
|
+
At runtime this sets attribute values on the element this directive is defined on, for example...
|
404
|
+
|
405
|
+
<div mv:attr=":foo => 'bar', :hi => 'cat'">hello</div>
|
406
|
+
|
407
|
+
becomes
|
408
|
+
|
409
|
+
<div foo="bar" hi="cat">hello</div>
|
410
|
+
|
411
|
+
You can put erb evaluated code in #{ } like in this example
|
412
|
+
|
413
|
+
<div mv:attr=":foo => #{h product.name}, :hi => 'cat'">hello</div>
|
414
|
+
|
415
|
+
becomes
|
416
|
+
|
417
|
+
<div foo="<%= h product.name %>" hi="cat">hello</div>
|
418
|
+
</pre>
|
419
|
+
|
420
|
+
<a name="mv_content"></a>
|
421
|
+
<h4>mv:content</h4>
|
422
|
+
<p>
|
423
|
+
mv:content="foo"
|
424
|
+
</p>
|
425
|
+
<pre>
|
426
|
+
Replaces the content of the tag with the erb output of foo, for example...
|
427
|
+
|
428
|
+
<div mv:content="foo">some dummy html here</div>
|
429
|
+
|
430
|
+
becomes
|
431
|
+
|
432
|
+
<div><%= foo %></div>
|
433
|
+
</pre>
|
434
|
+
|
435
|
+
<a name="mv_omit_tag"></a>
|
436
|
+
<h4>mv:omit_tag</h4>
|
437
|
+
<p>
|
438
|
+
mv:omit_tag="evalString"
|
439
|
+
</p>
|
440
|
+
<pre>
|
441
|
+
Omit the element tag if the evalString is empty or evaluates to true. For example...
|
442
|
+
|
443
|
+
<span mv:omit_tag="">hello</span>
|
444
|
+
|
445
|
+
becomes
|
446
|
+
|
447
|
+
hello
|
448
|
+
|
449
|
+
<span mv:omit_tag="@test">hello</span>
|
450
|
+
|
451
|
+
becomes
|
452
|
+
|
453
|
+
<% if @test %><span><% end %>hello<% if @test %></span><% end %>
|
454
|
+
</pre>
|
455
|
+
<a name="mv_replace"></a>
|
456
|
+
<h4>mv:replace</h4>
|
457
|
+
<p>
|
458
|
+
mv:replace="foo bar"
|
459
|
+
</p>
|
460
|
+
<pre>
|
461
|
+
Replaces the tag and contents with the erb executed output of the attribute. If the attribute
|
462
|
+
value is an empty string then the tag is simply removed and nothing is output, for example...
|
463
|
+
|
464
|
+
<span mv:replace="h product.name">dummy product name</span>
|
465
|
+
|
466
|
+
becomes
|
467
|
+
|
468
|
+
<%= h product.name %>
|
469
|
+
|
470
|
+
and similarly, you can use this to remove dummy html which was there for prototyping/demoing
|
471
|
+
|
472
|
+
<table>
|
473
|
+
other rows here
|
474
|
+
<tr mv:replace="">
|
475
|
+
<td>foo</td>
|
476
|
+
<td>bar</td>
|
477
|
+
</tr>
|
478
|
+
</table>
|
479
|
+
|
480
|
+
becomes
|
481
|
+
|
482
|
+
<table>
|
483
|
+
other rows here
|
484
|
+
</table>
|
485
|
+
|
486
|
+
Passing in an empty attribute simply eliminated the tag, children, and contents
|
487
|
+
</pre>
|
488
|
+
|
489
|
+
<a name="erb_control_directives"></a>
|
490
|
+
<h3>Erb and Control Flow Directives</h3>
|
491
|
+
|
492
|
+
<a name="mv_block"></a>
|
493
|
+
<h4>mv:block</h4>
|
494
|
+
<p>
|
495
|
+
mv:block="rubyBlockCodeHere"
|
496
|
+
</p>
|
497
|
+
<pre>
|
498
|
+
At runtime this expands to the equivalent rhtml (erb) block code around this element, for example...
|
499
|
+
|
500
|
+
<div mv:block="products.each do |product|">foobar</div>
|
501
|
+
|
502
|
+
becomes
|
503
|
+
|
504
|
+
<% products.each do |product| %>
|
505
|
+
<div>foobar</div>
|
506
|
+
<% end %>
|
507
|
+
|
508
|
+
Note how MasterView automatically put in the 'end' after the closing tag.
|
509
|
+
Another example using the brace form of a block
|
510
|
+
|
511
|
+
<div mv:block="products.each { |product|">foobar</div>
|
512
|
+
|
513
|
+
becomes
|
514
|
+
|
515
|
+
<% products.each { |product| %>
|
516
|
+
<div>foobar</div>
|
517
|
+
<% } %>
|
518
|
+
|
519
|
+
Its all based on the ruby and rails syntax while keeping things xhtml and designer friendly.
|
520
|
+
</pre>
|
521
|
+
|
522
|
+
<a name="mv_if"></a>
|
523
|
+
<h4>mv:if</h4>
|
524
|
+
<p>
|
525
|
+
mv:if="yourIfConditionHere"
|
526
|
+
</p>
|
527
|
+
<pre>
|
528
|
+
Wraps the tag with an if block using the attribute contents for the condition, for example...
|
529
|
+
|
530
|
+
<div mv:if="@flash[:notice]">foo</div>
|
531
|
+
|
532
|
+
becomes
|
533
|
+
|
534
|
+
<% if @flash[:notice] %>
|
535
|
+
<div>foo</div>
|
536
|
+
<% end %>
|
537
|
+
|
538
|
+
And combining if and content directives we can do the following
|
539
|
+
|
540
|
+
<div mv:if="@flash[:notice]" mv:content="@flash[:notice]" class="messages">
|
541
|
+
dummy notice message here
|
542
|
+
</div>
|
543
|
+
|
544
|
+
becomes
|
545
|
+
|
546
|
+
<% if @flash[:notice] %>
|
547
|
+
<div>
|
548
|
+
<%= @flash[:notice] %>
|
549
|
+
</div>
|
550
|
+
<% end %>
|
551
|
+
</pre>
|
552
|
+
|
553
|
+
<a name="mv_elsif"></a>
|
554
|
+
<h4>mv:elsif</h4>
|
555
|
+
<p>
|
556
|
+
mv:elsif="yourElseConditionHere"
|
557
|
+
</p>
|
558
|
+
<pre>
|
559
|
+
Used in conjunction with an if directive allows you to create if, elsif blocks, for example...
|
560
|
+
|
561
|
+
<div mv:if="foo()">
|
562
|
+
hello
|
563
|
+
</div>
|
564
|
+
<div mv:elsif="bar()">
|
565
|
+
world
|
566
|
+
</div>
|
567
|
+
|
568
|
+
becomes
|
569
|
+
|
570
|
+
<% if foo() %>
|
571
|
+
<div>
|
572
|
+
hello
|
573
|
+
</div>
|
574
|
+
<% elsif bar() %>
|
575
|
+
<div>
|
576
|
+
world
|
577
|
+
</div>
|
578
|
+
<% end %>
|
579
|
+
|
580
|
+
Note that the elsif directive element needs to follow the if element's closing tag
|
581
|
+
</pre>
|
582
|
+
|
583
|
+
<a name="mv_else"></a>
|
584
|
+
<h4>mv:else</h4>
|
585
|
+
<p>
|
586
|
+
mv:else=""
|
587
|
+
</p>
|
588
|
+
<pre>
|
589
|
+
Used in conjunction with if and elsif, allows you to create if, elseif, else blocks, for example...
|
590
|
+
|
591
|
+
<div mv:if="@foo">
|
592
|
+
hello
|
593
|
+
</div>
|
594
|
+
<div mv:else="">
|
595
|
+
world
|
596
|
+
</div>
|
597
|
+
|
598
|
+
becomes
|
599
|
+
|
600
|
+
<% if @foo %>
|
601
|
+
<div>
|
602
|
+
hello
|
603
|
+
</div>
|
604
|
+
<% else %>
|
605
|
+
<div>
|
606
|
+
world
|
607
|
+
</div>
|
608
|
+
<% end %>
|
609
|
+
</pre>
|
610
|
+
|
611
|
+
<a name="mv_inline_erb"></a>
|
612
|
+
<h4>Inline Erb substitutions</h4>
|
613
|
+
<p>
|
614
|
+
Inline substitutions
|
615
|
+
</p>
|
616
|
+
<pre>
|
617
|
+
Since <%= foobar %> and <% foo %> are invalid xhtml values, MasterView has an inline substitution to
|
618
|
+
replace these for the cases when you simply want to inject something. {{{ gets replaced with <%
|
619
|
+
and {{{= gets replaced with <%= also }}} gets replaced with %> If you instead want to use the
|
620
|
+
old <% syntax instead, MasterView by default is setup to perform a substitution on those values before
|
621
|
+
parsing. However to be safe you should use the xhtml safe syntax otherwise html editors might end
|
622
|
+
up changing things on you.
|
623
|
+
|
624
|
+
{{{= foobar }}}
|
625
|
+
|
626
|
+
becomes
|
627
|
+
|
628
|
+
<%= foobar %>
|
629
|
+
|
630
|
+
and
|
631
|
+
|
632
|
+
{{{ foo }}}
|
633
|
+
|
634
|
+
becomes
|
635
|
+
|
636
|
+
<% foo %>
|
637
|
+
</pre>
|
638
|
+
|
639
|
+
<a name="asset_link_directives"></a>
|
640
|
+
<h3>Rails Asset and Link Helper Directives</h3>
|
641
|
+
|
642
|
+
<a name="mv_javascript_include"></a>
|
643
|
+
<h4>mv:javascript_include</h4>
|
644
|
+
<p>
|
645
|
+
mv:javascript_include="prototype.js"
|
646
|
+
</p>
|
647
|
+
<pre>
|
648
|
+
Replaces the tag with a javascript_include_tag helper, for example...
|
649
|
+
|
650
|
+
<script type="text/javascript" src="../../../public/javascripts/prototype.js"
|
651
|
+
mv:javascript_include="prototype.js"></script>
|
652
|
+
|
653
|
+
becomes
|
654
|
+
|
655
|
+
<%= javascript_include_tag 'prototype.js' %>
|
656
|
+
|
657
|
+
This is useful to allow scripts to be used for demos/prototypes and then at runtime
|
658
|
+
use the appropriate asset using the rails helper.
|
659
|
+
</pre>
|
660
|
+
|
661
|
+
<a name="mv_link_to"></a>
|
662
|
+
<h4>mv:link_to</h4>
|
663
|
+
<p>
|
664
|
+
mv:link_to="linkToOptions"
|
665
|
+
</p>
|
666
|
+
<pre>
|
667
|
+
Replaces the tag with a link_to helper, it uses the contents of the tag for the name of the link,
|
668
|
+
so the name of the link can be changed by the html designer and it gets used in the appropriate place
|
669
|
+
in the helper, for example...
|
670
|
+
|
671
|
+
<a mv:link_to=":action => 'new'">New product</a>
|
672
|
+
|
673
|
+
becomes
|
674
|
+
|
675
|
+
<%= link_to 'New product', :action => 'new' %>
|
676
|
+
</pre>
|
677
|
+
|
678
|
+
<a name="mv_link_to_if"></a>
|
679
|
+
<h4>mv:link_to_if</h4>
|
680
|
+
<p>
|
681
|
+
mv:link_to_if="linkToIfConditionAndOption"
|
682
|
+
</p>
|
683
|
+
<pre>
|
684
|
+
Replaces the tag with a link_to_if helper, uses the contents of the tag for the name of the
|
685
|
+
link so the name of the link can be changed by the html designer and it gets used in the appropriate
|
686
|
+
place in the helper, for example...
|
687
|
+
|
688
|
+
<a mv:link_to_if="@product_pages.current.previous, { :page => @product_pages.current.previous }"Previous page"</a>
|
689
|
+
|
690
|
+
becomes
|
691
|
+
|
692
|
+
<%= link_to_if @product_pages.current.previous, 'Previous page', {:page => @product_pages.current.previous } %>
|
693
|
+
</pre>
|
694
|
+
|
695
|
+
<a name="mv_link_to_remote"></a>
|
696
|
+
<h4>mv:link_to_remote</h4>
|
697
|
+
<p>
|
698
|
+
mv:link_to_remote="linkToRemoteOptions"
|
699
|
+
</p>
|
700
|
+
<pre>
|
701
|
+
Replaces the tag with a link_to_remote helper, uses the contents of the tag for the name of the
|
702
|
+
link so the name of the link can be changed by the html designer and it gets used in the appropriate
|
703
|
+
place in the helper, for example...
|
704
|
+
|
705
|
+
<a mv:link_to_remote=":action => 'new'">New product</a>
|
706
|
+
|
707
|
+
becomes
|
708
|
+
|
709
|
+
<%= link_to_remote 'New product', :action => 'new' %>
|
710
|
+
</pre>
|
711
|
+
|
712
|
+
<a name="mv_stylesheet_link"></a>
|
713
|
+
<h4>mv:stylesheet_link</h4>
|
714
|
+
<p>
|
715
|
+
mv:stylesheet_link="style"
|
716
|
+
</p>
|
717
|
+
<pre>
|
718
|
+
Replaces the tag with a stylesheet_link_tag helper, for example...
|
719
|
+
|
720
|
+
<link rel="stylesheet" type="text/css" href="../../../public/stylesheets/scaffold.css" mv:stylesheet_link="scaffold"/>
|
721
|
+
|
722
|
+
becomes
|
723
|
+
|
724
|
+
<%= stylesheet_link_tag "scaffold" %>
|
725
|
+
|
726
|
+
This is useful to allow style to be used for demos/prototypes and then at runtime
|
727
|
+
use the appropriate asset using the rails helper.
|
728
|
+
</pre>
|
729
|
+
|
730
|
+
<a name="form_directives"></a>
|
731
|
+
<h3>Rails Form Helper Directives</h3>
|
732
|
+
|
733
|
+
<a name="mv_form"></a>
|
734
|
+
<h4>mv:form</h4>
|
735
|
+
<p>
|
736
|
+
mv:form=":action => ‘new’"
|
737
|
+
</p>
|
738
|
+
<pre>
|
739
|
+
Replaces this tag and closing tag with the form_tag and end_form_tag helpers. It also pulls the
|
740
|
+
method and multipart attributes from the element and merges that into the form_tag options, for example...
|
741
|
+
|
742
|
+
<form mv:form=":action => 'new'">foobar</form>
|
743
|
+
|
744
|
+
becomes
|
745
|
+
|
746
|
+
<% form_tag :action => 'new' %>
|
747
|
+
foobar
|
748
|
+
<% end_form_tag %>
|
749
|
+
|
750
|
+
<form method="GET" mv:form=":action => 'new'">foobar</form>
|
751
|
+
|
752
|
+
becomes
|
753
|
+
|
754
|
+
<% form_tag { :action => 'new' }, :method => 'GET' %>
|
755
|
+
foobar
|
756
|
+
<% end_form_tag %>
|
757
|
+
</pre>
|
758
|
+
|
759
|
+
<a name="mv_hidden_field"></a>
|
760
|
+
<h4>mv:hidden_field</h4>
|
761
|
+
<p>
|
762
|
+
mv:hidden_field="object, method"
|
763
|
+
</p>
|
764
|
+
<pre>
|
765
|
+
Replaces this tag with an hidden input tag using the rails hidden_tag helper, for example...
|
766
|
+
|
767
|
+
<input mv:hidden_field="product, desc" type="hidden" value="dummy text"/>
|
768
|
+
|
769
|
+
becomes
|
770
|
+
|
771
|
+
<%= hidden_field product, desc %>
|
772
|
+
</pre>
|
773
|
+
|
774
|
+
|
775
|
+
<a name="mv_password_field"></a>
|
776
|
+
<h4>mv:password_field</h4>
|
777
|
+
<p>
|
778
|
+
mv:password_field="user, password"
|
779
|
+
</p>
|
780
|
+
<pre>
|
781
|
+
Replaces the tag with a password_field helper using the attribute as well as merging any html
|
782
|
+
attributes that have been set by the designer, for example...
|
783
|
+
|
784
|
+
<input type="password" mv:password_field="user, password"/>
|
785
|
+
|
786
|
+
becomes
|
787
|
+
|
788
|
+
<%= password_field user, password %>
|
789
|
+
|
790
|
+
and similarly
|
791
|
+
|
792
|
+
<input type="password" mv:password_field="user, password" size="10" maxlength="15" class="pwdStyle"/>
|
793
|
+
|
794
|
+
becomes
|
795
|
+
|
796
|
+
<%= password_field, user, password, :class => 'pwdStyle', :maxlength = 15, :size => 10 %>
|
797
|
+
</pre>
|
798
|
+
|
799
|
+
<a name="mv_submit"></a>
|
800
|
+
<h4>mv:submit</h4>
|
801
|
+
<p>
|
802
|
+
mv:submit="submitOptions"
|
803
|
+
</p>
|
804
|
+
<pre>
|
805
|
+
Replaces the tag with a submit_tag helper, it uses the html value attribute to set the text
|
806
|
+
in the helper, and appends any options after, for example...
|
807
|
+
|
808
|
+
<input type="submit" mv:submit="" value="Save product"/>
|
809
|
+
|
810
|
+
becomes
|
811
|
+
|
812
|
+
<%= submit_tag 'Save product' %>
|
813
|
+
|
814
|
+
and
|
815
|
+
|
816
|
+
<input type="submit" mv:submit=":foo => 'bar'" value="Save product"/>
|
817
|
+
|
818
|
+
becomes
|
819
|
+
|
820
|
+
<%= submit_tag 'Save product', :foo => 'bar' %>
|
821
|
+
</pre>
|
822
|
+
|
823
|
+
|
824
|
+
<a name="mv_text_area"></a>
|
825
|
+
<h4>mv:text_area</h4>
|
826
|
+
<p>
|
827
|
+
mv:text_area="object, method"
|
828
|
+
</p>
|
829
|
+
<pre>
|
830
|
+
Replaces the tag with a text_area helper, it uses the html attributes like rows, cols, disabled,
|
831
|
+
readonly, class, style, tabindex, accesskey and merges them with the object and method specified
|
832
|
+
in the attribute value, for example...
|
833
|
+
|
834
|
+
<textarea mv:text_areas="product, desc">dummy text</textarea>
|
835
|
+
|
836
|
+
becomes
|
837
|
+
|
838
|
+
<%= text_area prouct, desc %>
|
839
|
+
|
840
|
+
or a more complex example
|
841
|
+
|
842
|
+
<textarea mv:text_area="product, desc" rows="4" cols="60", class="mystyle">dummy text</textarea>
|
843
|
+
|
844
|
+
becomes
|
845
|
+
|
846
|
+
<%= textarea product, desc, :class => 'mystyle', :cols => '60', :rows => 4 %>
|
847
|
+
</pre>
|
848
|
+
|
849
|
+
<a name="mv_text_field"></a>
|
850
|
+
<h4>mv:text_field</h4>
|
851
|
+
<p>
|
852
|
+
mv:text_field="object, method"
|
853
|
+
</p>
|
854
|
+
<pre>
|
855
|
+
Replaces the tag with a text_field helper, it uses the html attributes like size, maxlength,
|
856
|
+
disabled, readonly, class, style, tabindex, accesskey and merges them with the object and
|
857
|
+
method specified in the attribute value, for example...
|
858
|
+
|
859
|
+
<input type="text" mv:text_field="product, name" value="dummy text"/>
|
860
|
+
|
861
|
+
becomes
|
862
|
+
|
863
|
+
<%= text_field product, name %>
|
864
|
+
|
865
|
+
and
|
866
|
+
|
867
|
+
<input type="text" mv:text_field="product, name" value="dummy text" class="mystyle" size="15" maxlength="20"/>
|
868
|
+
|
869
|
+
becomes
|
870
|
+
|
871
|
+
<%= text_field product, name, :class => 'mystyle', :maxlength => 20, :size => 15 %>
|
872
|
+
</pre>
|
873
|
+
|
874
|
+
|
875
|
+
<hr />
|
876
|
+
<a name="directives_index"></a>
|
877
|
+
<h2>Directives Index</h2>
|
878
|
+
|
879
|
+
<p>Directives index in alphabetical order:</p>
|
880
|
+
|
881
|
+
<table class="toc" summary="alphabetical index of directives">
|
882
|
+
<tbody>
|
883
|
+
|
884
|
+
<!-- a -->
|
885
|
+
<tr>
|
886
|
+
<td class="directive"><a href="#mv_attr">mv:attr</a></td>
|
887
|
+
<td>Replaces attribute value(s) on this element with the value of an expression</td>
|
888
|
+
</tr>
|
889
|
+
|
890
|
+
<!-- b -->
|
891
|
+
<tr>
|
892
|
+
<td class="directive"><a href="#mv_block">mv:block</a></td>
|
893
|
+
<td>Expands to the equivalent rhtml (erb) block code around this element</td>
|
894
|
+
</tr>
|
895
|
+
|
896
|
+
<!-- c -->
|
897
|
+
<tr>
|
898
|
+
<td class="directive"><a href="#mv_content">mv:content</a></td>
|
899
|
+
<td>Replaces the content of this element with the value of the expression</td>
|
900
|
+
</tr>
|
901
|
+
|
902
|
+
<!-- e -->
|
903
|
+
<tr>
|
904
|
+
<td class="directive"><a href="#mv_else">mv:else</a></td>
|
905
|
+
<td>Used in conjunction with the <span class="directiveName">mv:if</span> and <span class="directiveName">mv:elsif</span> directives to allow you to create <code>if... elsif... else... end</code> blocks</td>
|
906
|
+
</tr>
|
907
|
+
|
908
|
+
<!-- f -->
|
909
|
+
<tr>
|
910
|
+
<td class="directive"><a href="#mv_form">mv:form</a></td>
|
911
|
+
<td>Replaces the start and end tags of this element using the Rails <code>form_tag</code> and <code>form_tag</code> helpers</td>
|
912
|
+
</tr>
|
913
|
+
|
914
|
+
<!-- g -->
|
915
|
+
<tr>
|
916
|
+
<td class="directive"><a href="#mv_generate">mv:generate</a></td>
|
917
|
+
<td>Generate output containing this element and its children</td>
|
918
|
+
</tr>
|
919
|
+
<tr>
|
920
|
+
<td class="directive"><a href="#mv_gen_partial">mv:gen_partial</a></td>
|
921
|
+
<td>Generate a Rails partial</td>
|
922
|
+
</tr>
|
923
|
+
<tr>
|
924
|
+
<td class="directive"><a href="#mv_gen_replace">mv:gen_replace</a></td>
|
925
|
+
<td>Used with <span class="directiveName">mv:generate</span> to replace the content of this element in the generated output with the value of the attribute</td>
|
926
|
+
</tr>
|
927
|
+
|
928
|
+
<!-- h -->
|
929
|
+
<tr>
|
930
|
+
<td class="directive"><a href="#mv_hidden_field">mv:hidden_field</a></td>
|
931
|
+
<td>Replaces this element with a <code>hidden</code> input element using the Rails <code>hidden_tag</code> helper.
|
932
|
+
<span class="explanation">(
|
933
|
+
Used on <code><input></code> form elements
|
934
|
+
)</span>
|
935
|
+
</td>
|
936
|
+
</tr>
|
937
|
+
|
938
|
+
<!-- i -->
|
939
|
+
<tr>
|
940
|
+
<td class="directive"><a href="#mv_if">mv:if</a></td>
|
941
|
+
<td>Wraps this element with an <code>if... end</code> block using the attribute contents for the condition</td>
|
942
|
+
</tr>
|
943
|
+
<tr>
|
944
|
+
<td class="directive"><a href="#mv_elsif">mv:elsif</a></td>
|
945
|
+
<td>Used in conjunction with the <span class="directiveName">mv:if</span> directive to allow you to create <code>if... elsif... end</code> blocks</td>
|
946
|
+
</tr>
|
947
|
+
<tr>
|
948
|
+
<td class="directive"><a href="#mv_import">mv:import</a></td>
|
949
|
+
<td>Design-time directive to mark a snapshot of generated code</td>
|
950
|
+
</tr>
|
951
|
+
<tr>
|
952
|
+
<td class="directive"><a href="#mv_import_render">mv:import_render</a></td>
|
953
|
+
<td>Design-time directive to mark a snapshot of generated partial code</td>
|
954
|
+
</tr>
|
955
|
+
<tr>
|
956
|
+
<td class="directive"><a href="#mv_inline_erb">Inline Erb substitutions </a></td>
|
957
|
+
<td>Inline substitution notation for Erb expressions</td>
|
958
|
+
</tr>
|
959
|
+
|
960
|
+
<!-- j -->
|
961
|
+
<tr>
|
962
|
+
<td class="directive"><a href="#mv_javascript_include">mv:javascript_include</a></td>
|
963
|
+
<td>Replaces this element using the Rails <code>javascript_include_tag</code> helper.
|
964
|
+
<span class="explanation">(
|
965
|
+
Used on <code><script></code> element in html header section
|
966
|
+
)</span>
|
967
|
+
</td>
|
968
|
+
</tr>
|
969
|
+
|
970
|
+
<!-- l -->
|
971
|
+
<tr>
|
972
|
+
<td class="directive"><a href="#mv_link_to">mv:link_to</a></td>
|
973
|
+
<td>Replaces this element using the Rails <code>link_to</code> helper.
|
974
|
+
<span class="explanation">(
|
975
|
+
Used on <code><a></code> link elements
|
976
|
+
)</span>
|
977
|
+
</td>
|
978
|
+
</tr>
|
979
|
+
<tr>
|
980
|
+
<td class="directive"><a href="#mv_link_to_if">mv:link_to_if</a></td>
|
981
|
+
<td>Replaces this element using the Rails <code>link_to_if</code> helper
|
982
|
+
<span class="explanation">(
|
983
|
+
Used on <code><a></code> link elements
|
984
|
+
)</span>
|
985
|
+
</td>
|
986
|
+
</tr>
|
987
|
+
<tr>
|
988
|
+
<td class="directive"><a href="#mv_link_to_remote">mv:link_to_remote</a></td>
|
989
|
+
<td>Replaces this element using the Rails <code>link_to_remote</code> helper
|
990
|
+
<span class="explanation">(
|
991
|
+
Used on <code><a></code> link elements
|
992
|
+
)</span>
|
993
|
+
</td>
|
994
|
+
</tr>
|
995
|
+
|
996
|
+
<!-- o -->
|
997
|
+
<tr>
|
998
|
+
<td class="directive"><a href="#mv_omit_tag">mv:omit_tag</a></td>
|
999
|
+
<td>Omits this element from the generated output if the value is empty or evaluates to true</td>
|
1000
|
+
</tr>
|
1001
|
+
|
1002
|
+
<!-- p -->
|
1003
|
+
<tr>
|
1004
|
+
<td class="directive"><a href="#mv_password_field">mv:password_field</a></td>
|
1005
|
+
<td>Replaces this element with a <code>password</code> input element using the Rails <code>password_field</code> helper.
|
1006
|
+
<span class="explanation">(
|
1007
|
+
Used on <code><input></code> form elements
|
1008
|
+
)</span>
|
1009
|
+
</td>
|
1010
|
+
</tr>
|
1011
|
+
|
1012
|
+
<!-- r -->
|
1013
|
+
<tr>
|
1014
|
+
<td class="directive"><a href="#mv_replace">mv:replace</a></td>
|
1015
|
+
<td>Replaces this element and its content with the value of the expression</td>
|
1016
|
+
</tr>
|
1017
|
+
|
1018
|
+
<!-- s -->
|
1019
|
+
<tr>
|
1020
|
+
<td class="directive"><a href="#mv_stylesheet_link">mv:stylesheet_link</a></td>
|
1021
|
+
<td>Replaces this element using the Rails <code>stylesheet_link_tag</code> helper
|
1022
|
+
<span class="explanation">(
|
1023
|
+
Used on stylesheet <code><link></code> elements in html header section
|
1024
|
+
)</span>
|
1025
|
+
</td>
|
1026
|
+
</tr>
|
1027
|
+
<tr>
|
1028
|
+
<td class="directive"><a href="#mv_submit">mv:submit</a></td>
|
1029
|
+
<td>Replaces this element with a <code>submit</code> input element using the Rails <code>submit_tag</code> helper.
|
1030
|
+
<span class="explanation">(
|
1031
|
+
Used on <code><input></code> form elements
|
1032
|
+
)</span>
|
1033
|
+
</td>
|
1034
|
+
</tr>
|
1035
|
+
|
1036
|
+
<!-- t -->
|
1037
|
+
<tr>
|
1038
|
+
<td class="directive"><a href="#mv_text_area">mv:text_area</a></td>
|
1039
|
+
<td>Replaces this element with a <code>textarea</code> input element using the Rails <code>text_area</code> helper.
|
1040
|
+
<span class="explanation">(
|
1041
|
+
Used on <code><textarea></code> form elements
|
1042
|
+
)</span>
|
1043
|
+
</td>
|
1044
|
+
</tr>
|
1045
|
+
<tr>
|
1046
|
+
<td class="directive"><a href="#mv_text_field">mv:text_field</a></td>
|
1047
|
+
<td>Replaces this element with a <code>text</code> input element using the Rails <code>text_field</code> helper.
|
1048
|
+
<span class="explanation">(
|
1049
|
+
Used on <code><input></code> form elements
|
1050
|
+
)</span>
|
1051
|
+
</td>
|
1052
|
+
</tr>
|
1053
|
+
</tbody>
|
1054
|
+
</table>
|
1055
|
+
|
1056
|
+
</div> <!-- bodyContent -->
|
1057
|
+
</div>
|
1058
|
+
|
1059
|
+
<div id="pageFooter">
|
1060
|
+
<div>
|
1061
|
+
·
|
1062
|
+
<a href="./index.html">Doc Home</a>
|
1063
|
+
|
|
1064
|
+
<a href="./installation.html">Installation</a>
|
1065
|
+
|
|
1066
|
+
<a href="./configuration.html">Configuration</a>
|
1067
|
+
|
|
1068
|
+
<a href="./guide.html">Usage</a>
|
1069
|
+
|
|
1070
|
+
<a href="./directives.html">Directives</a>
|
1071
|
+
·
|
1072
|
+
</div>
|
1073
|
+
<table summary="layout area">
|
1074
|
+
<tbody>
|
1075
|
+
<tr>
|
1076
|
+
<td class="copyright">© Copyright MasterView 2006</td>
|
1077
|
+
<td class="validators">
|
1078
|
+
<a href="http://validator.w3.org/check/referer">[Valid XHTML]</a>
|
1079
|
+
</td>
|
1080
|
+
</tr>
|
1081
|
+
</tbody>
|
1082
|
+
</table>
|
1083
|
+
</div>
|
1084
|
+
</body>
|
1085
|
+
</html>
|