masterview 0.2.3 → 0.2.4
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 +5 -0
- data/TODO +23 -11
- data/doc/developer.html +192 -0
- data/doc/directives.html +8 -0
- data/lib/masterview/extras/app/controllers/masterview_controller.rb +18 -1
- data/lib/masterview/extras/app/views/masterview/admin/interact.rhtml +126 -0
- data/lib/masterview/extras/app/views/masterview/admin/list.rhtml +1 -0
- data/lib/masterview/extras/sample_templates.rb +62 -0
- data/lib/masterview/initializer.rb +7 -1
- data/lib/masterview/masterview_version.rb +1 -1
- data/lib/masterview/parser.rb +3 -2
- metadata +5 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
0.2.4
|
2
|
+
Added interactive render to admin pages with example templates
|
3
|
+
Fixed problem where apache2 with scgi was failing to initialize MasterView
|
4
|
+
Updated documentation.
|
5
|
+
|
1
6
|
0.2.3 - July 5th, 2006
|
2
7
|
Change default development settings for enable_admin_pages = true and enable_view_rhtml = true, remains false in production.
|
3
8
|
Change generated message in files to indicate that list.html controls layout and _messages, while new.html controls _form...
|
data/TODO
CHANGED
@@ -36,14 +36,26 @@
|
|
36
36
|
DSL for creating directives
|
37
37
|
maybe something like
|
38
38
|
|
39
|
-
event :
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
39
|
+
event :stag do |e|
|
40
|
+
# these read args consecutively out of parse(attr_value)
|
41
|
+
e.attr_arg :object, :quote_if => true
|
42
|
+
e.attr_arg :foo { |t| t.upcase } # modifying case of foo
|
43
|
+
e.attr_arg :link_name { self.content } #overriding with different value
|
44
|
+
e.attr_arg :options, :optional => {} # specify that is optional but provide default if it is needed
|
45
|
+
e.attr_arg :html_options, :merge_common => true, :merge => [:size, :rows] # merge in common and specified attributes
|
46
|
+
|
47
|
+
a = a+1 # do some other logic
|
48
|
+
|
49
|
+
old_content = e.content # retrieving content of tag
|
50
|
+
e.content = 'foo' # resetting content of tag
|
51
|
+
yield_contents = e.yield()
|
52
|
+
|
53
|
+
e.erb_code_render 'a = a + 1' # render <% a = a + 1 %>
|
54
|
+
e.erb_content_render 'text_area' args(:object, :foo, :link_name, :options, :html_options) # render <%= %>, args handles joining the args with comma, and also takes into account if last args are not empty that other args are either provided also or defaulted.
|
55
|
+
|
56
|
+
e.render 'direct render' # direct render as is
|
57
|
+
end
|
58
|
+
|
59
|
+
- default generate to *.rhtml if nothing is specified
|
60
|
+
|
61
|
+
|
data/doc/developer.html
ADDED
@@ -0,0 +1,192 @@
|
|
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 - Developer's Guide</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
|
+
</head>
|
15
|
+
|
16
|
+
<body>
|
17
|
+
|
18
|
+
<div id="pageHeader">
|
19
|
+
<a href="index.html"><img id="logo" src="images/masterview_logo.png" alt="MasterView Rails-optimized (x)html friendly template engine"/></a>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div id="headerNav">
|
23
|
+
<div>
|
24
|
+
·
|
25
|
+
<a href="./index.html">Doc Home</a>
|
26
|
+
|
|
27
|
+
<a href="./installation.html">Installation</a>
|
28
|
+
|
|
29
|
+
<a href="./configuration.html">Configuration</a>
|
30
|
+
|
|
31
|
+
<a href="./guide.html">Usage</a>
|
32
|
+
|
|
33
|
+
<a href="./directives.html">Directives</a>
|
34
|
+
|
|
35
|
+
<a href="./media_list.html">Media (Videos/Illustrations)</a>
|
36
|
+
·
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div id="pageBody">
|
41
|
+
<div id="bodyContent">
|
42
|
+
|
43
|
+
<h1>MasterView Developer's Guide</h1>
|
44
|
+
|
45
|
+
<p>The <span class="productName">MasterView</span> template engine is designed
|
46
|
+
to be easily configurable for use in your application, by customizing configuration settings for your environment as described in the <a href="./configuration.html">Configuration Guide</a>.
|
47
|
+
It is also designed to be easily extensible by adding custom directives, as described in this guide.
|
48
|
+
</p>
|
49
|
+
|
50
|
+
<p>
|
51
|
+
Before undertaking implementation of your own custom directive, we recommend that
|
52
|
+
you review the <a href="#processing_overview">Overview of Template Processing and Directives</a> section, which explains the processing context within which a directive implementation executes.
|
53
|
+
Then read the <a href="#directive_framework">Directive Implementation Framework</a>
|
54
|
+
for a guide to the facilities provided by MasterView to
|
55
|
+
simplify the development effort required to implement a new directive.
|
56
|
+
</p>
|
57
|
+
|
58
|
+
<a name="processing_overview"></a>
|
59
|
+
<h2>Overview of Template Processing and Directives</h2>
|
60
|
+
|
61
|
+
<p>A MasterView template is an <a href="http://www.w3.org/TR/xhtml1/" target="_blank">XHTML</a> document
|
62
|
+
which uses attribute markup on the standard document elements to encode processing directives for the template engine.
|
63
|
+
The <a href="http://www.w3.org/TR/REC-xml-names/" target="_blank">XML namespace</a> facility is used to identify attributes containing processing instructions.
|
64
|
+
</p>
|
65
|
+
|
66
|
+
<h3>Directive Attribute Markup</h3>
|
67
|
+
|
68
|
+
<p>
|
69
|
+
The builtin set of MasterView directives use the <span class="directiveName">mv:</span> namespace to form qualified attribute names which are unique in your html documents.
|
70
|
+
(Although we do not anticipate namespace collisions, you can if needed override
|
71
|
+
the <span class="directiveName">mv:</span> namespace name using the
|
72
|
+
<code>namespace_prefix</code> configuration setting.)
|
73
|
+
</p>
|
74
|
+
|
75
|
+
<p class="explanation">Note: an XML schema definition of the builtin MasterView directives namespace will be published Real Soon Now.
|
76
|
+
This will enable a proper declaration of the MasterView attribute namespace
|
77
|
+
on your <code><html></code> elements of the form
|
78
|
+
<code>xmlns:mv='http://masterview.org/schema/2006/directives'</code>
|
79
|
+
(specific URI tba when published), which is useful as a documentary aide as well as to enable validation.
|
80
|
+
</p>
|
81
|
+
|
82
|
+
<p>In addition to the builtin MasterView directives, custom directives can be
|
83
|
+
used by appending one or more directories containing directive implementation classes
|
84
|
+
the MasterView directive load path (configuration setting <code>directive_paths</code>).
|
85
|
+
Custom directives are loaded at MasterView startup time and may be used in document markup jst like the standard directives.
|
86
|
+
MasterView manages all available directives in a registry which specifies
|
87
|
+
the fully qualified name of the directive attribute (namespace + simple attribute name)
|
88
|
+
and the directive implementation class which is instantiated to process a directive attribute.
|
89
|
+
</p>
|
90
|
+
|
91
|
+
<p class="explanation">TODO: include recommendation on namespace usage for custom directives.</p>
|
92
|
+
|
93
|
+
<h3>Template Document Processing</h3>
|
94
|
+
|
95
|
+
<p>When MasterView processes a template document, the document is processed
|
96
|
+
as a DOM node hierarchy of elements and attributes.
|
97
|
+
Template processing is essentially a tree transformation process: the elements and their attributes from the template source document are processed and emitted onto the output.
|
98
|
+
</p>
|
99
|
+
|
100
|
+
<p>By default, elements with their attributes and content are preserved unchanged
|
101
|
+
in the output. The addition of MasterView directive attributes to an element allows for transformation and substitution to occur between the template source and the generated output.
|
102
|
+
</p>
|
103
|
+
|
104
|
+
<p>
|
105
|
+
As each element in the document is processed, any attributes which are MasterView
|
106
|
+
directives are collected and sorted into processing order according to the
|
107
|
+
<code>priority</code> order defined for each directive.
|
108
|
+
The <code>MasterView::DirectivePriorities</code> range from
|
109
|
+
<code>Lowest</code> to <code>Highest</code>, with
|
110
|
+
<code>DirectivePriorities::Medium</code> the default.
|
111
|
+
In most cases, you do not need to be concerned with priority; the default order
|
112
|
+
works for most usage.
|
113
|
+
</p>
|
114
|
+
|
115
|
+
<p>For each MasterView directive attribute on a document element,
|
116
|
+
the template engine creates an instance of the directive's implementation class to provide the directive processing for that element.
|
117
|
+
The directive handler is provided with the attribute value from the document element when it is created so that it has access to the information needed to perform its operation.
|
118
|
+
</p>
|
119
|
+
|
120
|
+
<h3>Template Processing Directives</h3>
|
121
|
+
|
122
|
+
<p>Directives can be thought of as providing several flavors of processing:</p>
|
123
|
+
<dl>
|
124
|
+
<dt>attribute modifiers</dt>
|
125
|
+
<dd>the directive operates on the attributes of the element (adds or removes attributes or changes values of existing attributes></dd>
|
126
|
+
<dt>content modifiers</dt>
|
127
|
+
<dd>the directive operates on the content of the element (modifies or replaces the content of the element)</dd>
|
128
|
+
<dt>eval-only</dt>
|
129
|
+
<dd>the directive is evaluated such that it has some effect on the overall state of the document processing, but does not directly affect the attributes or content of its element in the output</dd>
|
130
|
+
</dl>
|
131
|
+
|
132
|
+
<p>Some directives provide combinations of these processing flavors.
|
133
|
+
<!--??, e.g., a simple directive may simply modify the value of a standard attribute on the element (e.g., <span class="directiveName">mv:attr</span>), while a more complex directive may generate ... blah blah... ??-->
|
134
|
+
</p>
|
135
|
+
|
136
|
+
<p class="explanation">TODO: fill in a bit here with description of the range of invocation points at which a directive may hook up to perform its processing; typically either start or end of the element tag to which it is attached</p>
|
137
|
+
|
138
|
+
|
139
|
+
<a name="directive_framework"></a>
|
140
|
+
<h2>Directive Implementation Framework</h2>
|
141
|
+
|
142
|
+
<p class="explanation">Under construction... provide an overview of MasterView::DirectiveBase and the DirectiveHelpers mixin</p>
|
143
|
+
|
144
|
+
<h3>Construction</h3>
|
145
|
+
<p>When a directive attribute is encountered while processing a document element node,
|
146
|
+
an instance of the implementation class registered for that directive is constructed to process the element attribute. The value of the directive attribute from the document element is passed to the initializer as a <code>String</code> value.
|
147
|
+
A directive attribute of the form <code>mv:some_directive="attr_value"</code> in the template
|
148
|
+
results in a directive processor being instantiated for that element by an constructor of the form <code>SomeDirective.new(attr_value)</code>.
|
149
|
+
</p>
|
150
|
+
|
151
|
+
<p>Helper functions are provided to simplify parsing several standard attribute encoding notations to convert the string value of the directive atttribute to a usable object.
|
152
|
+
In particular, methods <code>parse_eval_into_array</code> evaluates the string as if it was the content of an array literal, while <code>parse_eval_into_hash</code> returns a Ruby hash containing the <code>key => value</code> pairs from the attribute value.
|
153
|
+
</p>
|
154
|
+
|
155
|
+
<h3>Operation</h3>
|
156
|
+
|
157
|
+
|
158
|
+
<p class="explanation">TODO: fill in here with details on how the directive hooks up its processing (typically either start or end of the element tag to which it is attached), the context available to it when invoked (what can you get from the dcs arg), and how output is emitted</p>
|
159
|
+
|
160
|
+
</div> <!-- bodyContent -->
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div id="pageFooter">
|
164
|
+
<div>
|
165
|
+
·
|
166
|
+
<a href="./index.html">Doc Home</a>
|
167
|
+
|
|
168
|
+
<a href="./installation.html">Installation</a>
|
169
|
+
|
|
170
|
+
<a href="./configuration.html">Configuration</a>
|
171
|
+
|
|
172
|
+
<a href="./guide.html">Usage</a>
|
173
|
+
|
|
174
|
+
<a href="./directives.html">Directives</a>
|
175
|
+
|
|
176
|
+
<a href="./media_list.html">Media (Videos/Illustrations)</a>
|
177
|
+
|
|
178
|
+
</div>
|
179
|
+
<table summary="layout area">
|
180
|
+
<tbody>
|
181
|
+
<tr>
|
182
|
+
<td class="copyright">© Copyright MasterView 2006</td>
|
183
|
+
<td class="validators">
|
184
|
+
<a href="http://validator.w3.org/check/referer">[Valid XHTML]</a>
|
185
|
+
</td>
|
186
|
+
</tr>
|
187
|
+
</tbody>
|
188
|
+
</table>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
</body>
|
192
|
+
</html>
|
data/doc/directives.html
CHANGED
@@ -1134,6 +1134,14 @@ mv:text_field="object, method"
|
|
1134
1134
|
<td>Replaces this element with a Rails <code>check_box</code> helper</td>
|
1135
1135
|
</tr>
|
1136
1136
|
<tr>
|
1137
|
+
<td class="directive"><a href="#mv_collection_select">mv:collection_select</a></td>
|
1138
|
+
<td>Replaces this element with a Rails <code>collection_select</code> helper.
|
1139
|
+
<span class="explanation">(
|
1140
|
+
Used on <code><select></code> form elements
|
1141
|
+
)</span>
|
1142
|
+
</td>
|
1143
|
+
</tr>
|
1144
|
+
<tr>
|
1137
1145
|
<td class="directive"><a href="#mv_content">mv:content</a></td>
|
1138
1146
|
<td>Replaces the content of this element with the value of the expression</td>
|
1139
1147
|
</tr>
|
@@ -44,7 +44,7 @@
|
|
44
44
|
# [DJL 17-Jun-2006]
|
45
45
|
#++
|
46
46
|
#
|
47
|
-
|
47
|
+
require 'masterview/extras/sample_templates'
|
48
48
|
|
49
49
|
class MasterviewController < ApplicationController
|
50
50
|
|
@@ -143,6 +143,23 @@ class MasterviewController < ApplicationController
|
|
143
143
|
smart_render 'masterview/admin/view_rhtml'
|
144
144
|
end
|
145
145
|
|
146
|
+
# interact, test template src, view results
|
147
|
+
def interact
|
148
|
+
@results = []
|
149
|
+
@src = params[:src]
|
150
|
+
if @src
|
151
|
+
sh_mio = MasterView::StringHashMIOTree.new({}, '.rhtml')
|
152
|
+
MasterView::Parser.parse( @src, { :output_mio_tree => sh_mio, :omit_comment => true } )
|
153
|
+
@results = sh_mio.string_hash.sort.collect do |file,rhtml|
|
154
|
+
os = OpenStruct.new
|
155
|
+
os.file = file
|
156
|
+
os.rhtml = rhtml
|
157
|
+
os
|
158
|
+
end
|
159
|
+
end
|
160
|
+
smart_render 'masterview/admin/interact'
|
161
|
+
end
|
162
|
+
|
146
163
|
def access_not_allowed #:nodoc:
|
147
164
|
render :text => '<p>We\'re sorry, but the page you have requested is only available to authorized users.</p>',
|
148
165
|
:status => 500
|
@@ -0,0 +1,126 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Masterview Admin - Interact</title>
|
4
|
+
|
5
|
+
<%= stylesheet_link_tag 'masterview/style' %>
|
6
|
+
<%= stylesheet_link_tag 'masterview/sidebox' %>
|
7
|
+
<%= stylesheet_link_tag 'masterview/color-scheme' %>
|
8
|
+
<%= javascript_include_tag :defaults %>
|
9
|
+
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
|
13
|
+
<!-- ###### Header ###### -->
|
14
|
+
|
15
|
+
<div id="header">
|
16
|
+
<span class="headerTitle">Admin - Interact</span>
|
17
|
+
<div class="menuBar">
|
18
|
+
<%= link_to 'Home', :action => :index %>
|
19
|
+
<!-- | <a href="">Another link</a> -->
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
|
24
|
+
<div class="main">
|
25
|
+
|
26
|
+
<div class="interact_div" id="mv_interact"><!-- ###### interact ###### -->
|
27
|
+
<div class="mv_admin_interact sidebar LHS">
|
28
|
+
<h2>Tasks:</h2>
|
29
|
+
<ul>
|
30
|
+
<li><%= link_to 'Back to overview', :action => 'list' %></li>
|
31
|
+
</ul>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<script type="text/javascript">
|
35
|
+
function useSample(sampleTemplateId){
|
36
|
+
$('src').innerHTML = $(sampleTemplateId).innerHTML;
|
37
|
+
$('interact_form').submit();
|
38
|
+
}
|
39
|
+
</script>
|
40
|
+
|
41
|
+
<!-- create hidden divs with the sample text -->
|
42
|
+
<% MasterView::SampleTemplates::Samples.each do |cat,cat_samples|
|
43
|
+
cat_samples.each do |key,desc_template| %>
|
44
|
+
<div id="<%= cat.to_s %>_<%= key.to_s %>" style="display: none; visibility: hidden"><%= h desc_template[1] %></div>
|
45
|
+
|
46
|
+
<% end
|
47
|
+
end
|
48
|
+
%>
|
49
|
+
|
50
|
+
<div class="mv_admin_interact_examples sidebar LHS">
|
51
|
+
<h2>Examples:</h2>
|
52
|
+
<% MasterView::SampleTemplates::Samples.each do |cat,cat_samples| %>
|
53
|
+
<h3><%= cat.to_s %></h3>
|
54
|
+
<ul>
|
55
|
+
<% cat_samples.each do |key,desc_template| %>
|
56
|
+
<li><a href="#" onclick="useSample(<%= cat.to_s %>_<%= key.to_s %>); return false;"><%= desc_template[0] %></a></li>
|
57
|
+
<% end %>
|
58
|
+
</ul>
|
59
|
+
<% end %>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div class="mv_interact content">
|
63
|
+
<h1>Interact</h1>
|
64
|
+
|
65
|
+
<% if @flash[:notice] %>
|
66
|
+
<div class="messages" id="admin_messages">
|
67
|
+
<%= h @flash[:notice] %>
|
68
|
+
</div>
|
69
|
+
<% end %>
|
70
|
+
|
71
|
+
<form id="interact_form" action="<%= url_for :controller => 'masterview', :action => 'interact' %>" method="post">
|
72
|
+
|
73
|
+
<p>Enter MasterView template html and submit to view the rendered rhtml.
|
74
|
+
</p>
|
75
|
+
|
76
|
+
<div class="record">
|
77
|
+
<div><label for="id">Template HTML:</label>
|
78
|
+
</div>
|
79
|
+
<div class="field">
|
80
|
+
<textarea id="src" name="src" rows="20" cols="80"><%= h @src %></textarea><br/>
|
81
|
+
<input type="submit" value="Render"/>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
</form>
|
87
|
+
|
88
|
+
<% unless @results.empty? %>
|
89
|
+
<h2>Rendered RHTML</h2>
|
90
|
+
<% end %>
|
91
|
+
|
92
|
+
<% @results.each do |result| %>
|
93
|
+
<div class="record">
|
94
|
+
<div class="label"><label for="id"><%= result.file %>:</label></div>
|
95
|
+
<div class="field">
|
96
|
+
<pre><code>
|
97
|
+
<%= h result.rhtml %>
|
98
|
+
</code></pre>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
<% end %>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<!-- ###### Footer ###### -->
|
109
|
+
|
110
|
+
<div id="footer">
|
111
|
+
<div class="footerLHS">
|
112
|
+
<a href="http://validator.w3.org/check/referer">Valid XHTML 1.0 Strict</a>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="footerLHS">
|
116
|
+
<a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS 2</a>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div>
|
120
|
+
Powered by MasterView
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
|
125
|
+
</body>
|
126
|
+
</html>
|
@@ -28,6 +28,7 @@
|
|
28
28
|
<ul>
|
29
29
|
<li><%= link_to 'View Configuration', :action => 'configuration' %></li>
|
30
30
|
<li><%= link_to 'View Loaded Features', :action => 'features' %></li>
|
31
|
+
<li><%= link_to 'Interactive Render', :action => 'interact' %></li>
|
31
32
|
<li style="margin-top: 6px; padding-top: 4px; border-top: 1px dashed;"><%= link_to 'Rebuild all outdated templates', :action => 'rebuild_all' %></li>
|
32
33
|
</ul>
|
33
34
|
</div>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module MasterView
|
2
|
+
class SampleTemplates
|
3
|
+
Samples = {
|
4
|
+
:general => { # category
|
5
|
+
|
6
|
+
|
7
|
+
#key => [desc, template]
|
8
|
+
:basic => ['basic template', <<-END
|
9
|
+
<html mv:generate="layouts/store.rhtml">
|
10
|
+
<body>
|
11
|
+
<h1>Store</h1>
|
12
|
+
<div mv:generate="store/list.html">
|
13
|
+
List here
|
14
|
+
</div>
|
15
|
+
</body>
|
16
|
+
</html>
|
17
|
+
END
|
18
|
+
],
|
19
|
+
|
20
|
+
:text_field => ['text_field form', <<-END
|
21
|
+
<html mv:generate="layouts/store.rhtml">
|
22
|
+
<body>
|
23
|
+
<h1>Store</h1>
|
24
|
+
<div mv:generate="store/new.html">
|
25
|
+
Name: <input type="textfield" size="20" mv:text_field="product, name"/>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
29
|
+
END
|
30
|
+
]
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
},
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
:advanced => { # category
|
39
|
+
|
40
|
+
|
41
|
+
:text_field => ['text_field form', <<-END
|
42
|
+
<html mv:generate="layouts/store.rhtml">
|
43
|
+
<body>
|
44
|
+
<h1>Store</h1>
|
45
|
+
<div mv:generate="store/new.html">
|
46
|
+
Name: <input type="textfield" size="20" mv:text_field="product, name"/>
|
47
|
+
</div>
|
48
|
+
</body>
|
49
|
+
</html>
|
50
|
+
END
|
51
|
+
]
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
@@ -448,7 +448,7 @@ module MasterView
|
|
448
448
|
@mv_installation_dir = File.expand_path( "#{File.dirname(__FILE__)}/../.." )
|
449
449
|
|
450
450
|
#ISSUE: should probably also detect std console or breakpointer launch scripts [DJL 10-Jun-2006]
|
451
|
-
@rails_runner_scripts_pattern = /server|dispatch|mongrel_rails/
|
451
|
+
@rails_runner_scripts_pattern = /server|dispatch|mongrel_rails|cgi/ #cgi picks up scgi and fcgi
|
452
452
|
|
453
453
|
@has_rails_context = (defined?(::RAILS_ROOT) != nil)
|
454
454
|
decide_if_running_rails
|
@@ -576,7 +576,11 @@ module MasterView
|
|
576
576
|
end
|
577
577
|
|
578
578
|
def decide_if_running_rails #:nodoc:
|
579
|
+
#old way using program name except that this needs to be maintained
|
579
580
|
@running_rails = has_rails_context && ($PROGRAM_NAME =~ rails_runner_scripts_pattern) != nil
|
581
|
+
|
582
|
+
# TODO could try checking if things are defined instead but what would we check for?? Something related to Dispatcher?
|
583
|
+
# @running_rails = has_rails_context && (defined?(::Dispatcher.dispatch)) != nil
|
580
584
|
end
|
581
585
|
|
582
586
|
# see if this app has the std file structure that indicates a rails application
|
@@ -701,6 +705,8 @@ module MasterView
|
|
701
705
|
ensure_valid_settings
|
702
706
|
install_config_settings
|
703
707
|
# make a final check for running_rails? (in case config settings changed scripts spec)
|
708
|
+
# this logging didn't seem to work??
|
709
|
+
# @log_msg_q << [ :info, 'Program name = '+$PROGRAM_NAME ] # log the program that is starting
|
704
710
|
configuration.decide_if_running_rails
|
705
711
|
# keep a permananent record of how we got started
|
706
712
|
configuration.freeze
|
data/lib/masterview/parser.rb
CHANGED
@@ -231,7 +231,7 @@ module MasterView
|
|
231
231
|
# base, meta, link, hr, br, param, img, area, input, col
|
232
232
|
XHTMLEmptyElementNameSet = %w{ base meta link hr br param img area input col }.to_set
|
233
233
|
|
234
|
-
attr_reader :directive_load_paths, :mv_ns, :keyword_expander, :default_extension
|
234
|
+
attr_reader :directive_load_paths, :mv_ns, :keyword_expander, :default_extension, :options
|
235
235
|
attr_accessor :render_levels, :default_render_handler, :serializer, :template_pathname, :template_full_pathname
|
236
236
|
attr_reader :directives_registry #:nodoc:
|
237
237
|
|
@@ -239,6 +239,7 @@ module MasterView
|
|
239
239
|
|
240
240
|
def initialize( options = {} )
|
241
241
|
@@last_renderer = self; #save last renderer for convenient access
|
242
|
+
@options = options
|
242
243
|
@default_render_handler = SimpleRenderHandler.new
|
243
244
|
@render_levels = [
|
244
245
|
RenderLevel.new( [RenderMode.new] )
|
@@ -485,7 +486,7 @@ module MasterView
|
|
485
486
|
|
486
487
|
gen = @renderer.keyword_expander.resolveAttrAndDelete(attributes, @renderer.mv_ns+'generate') #get and delete from map
|
487
488
|
if gen
|
488
|
-
omit_comment = OmitGeneratedComments || File.extname(gen) != MasterView::IOMgr.erb.default_extension
|
489
|
+
omit_comment = @renderer.options[:omit_comment] || OmitGeneratedComments || File.extname(gen) != MasterView::IOMgr.erb.default_extension
|
489
490
|
attributes[@renderer.mv_ns+'insert_generated_comment'] = @renderer.template_full_pathname.to_s unless omit_comment #add the comment directive, so it will be written to each gen'd file
|
490
491
|
render_level = nil
|
491
492
|
gen_values = parse_eval_into_hash(gen, :normal)
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: masterview
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2006-07-
|
6
|
+
version: 0.2.4
|
7
|
+
date: 2006-07-26 00:00:00 -05:00
|
8
8
|
summary: A (x)html friendly template engine for rails with the power of layouts, and partials.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/masterview/extras/watcher.rb
|
96
96
|
- lib/masterview/extras/init_rails_reparse_checking.rb
|
97
97
|
- lib/masterview/extras/init_rails_erb_mv_direct.rb
|
98
|
+
- lib/masterview/extras/sample_templates.rb
|
98
99
|
- lib/masterview/extras/app/controllers
|
99
100
|
- lib/masterview/extras/app/views
|
100
101
|
- lib/masterview/extras/app/controllers/masterview_controller.rb
|
@@ -104,6 +105,7 @@ files:
|
|
104
105
|
- lib/masterview/extras/app/views/masterview/admin/view_rhtml.rhtml
|
105
106
|
- lib/masterview/extras/app/views/masterview/admin/list.rhtml
|
106
107
|
- lib/masterview/extras/app/views/masterview/admin/empty.rhtml
|
108
|
+
- lib/masterview/extras/app/views/masterview/admin/interact.rhtml
|
107
109
|
- lib/masterview/extras/app/views/masterview/admin/create.rhtml
|
108
110
|
- lib/masterview/extras/app/views/masterview/admin/features.rhtml
|
109
111
|
- lib/masterview/extras/app/views/masterview/admin/configuration.rhtml
|
@@ -121,6 +123,7 @@ files:
|
|
121
123
|
- doc/media_list.html
|
122
124
|
- doc/images
|
123
125
|
- doc/simple_diagram.html
|
126
|
+
- doc/developer.html
|
124
127
|
- doc/images/masterview_rhtml_rendering_thumbnail_smaller.png
|
125
128
|
- doc/images/masterview_rhtml_rendering_thumbnail.png
|
126
129
|
- doc/images/masterview_logo.png
|