masterview_generator 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/Rakefile CHANGED
@@ -28,6 +28,7 @@ namespace 'masterview_generator' do
28
28
  RELEASE_NAME = "REL #{PKG_VERSION}"
29
29
  PKG_FILES = FileList[
30
30
  "masterview_generator.rb",
31
+ "actionview_helper.rb",
31
32
  "templates/**/*",
32
33
  "[A-Z]*"
33
34
  ].exclude(/\bCVS\b|~$|\.svn|semantic.cache/)
@@ -35,7 +36,7 @@ namespace 'masterview_generator' do
35
36
  spec = Gem::Specification.new do |s|
36
37
  s.name = PKG_NAME
37
38
  s.version = PKG_VERSION
38
- s.summary = "A (x)html friendly template engine for rails with the power of layouts, and partials. MasterView Generator for GEM"
39
+ s.summary = "A (x)html friendly template engine for rails with the power of layouts, and partials. MasterView Generator for creating templates and scaffolding."
39
40
  s.has_rdoc = false
40
41
  s.files = PKG_FILES
41
42
  s.require_path = '.'
@@ -0,0 +1,255 @@
1
+ module MasterView
2
+ module Generator
3
+ # mixin to provide rendering for field types
4
+ # Basically this takes the field type from the db and renders an html design friendly view and puts in the
5
+ # appropriate mv directive which at runtime will use the rails view helper
6
+ module ActionViewHelper
7
+ # creates a text field with mv directive
8
+ def text_field(options)
9
+ %Q[<input type="text" name="#{@object_name}_#{@method_name}" mv:text_field="'#{@object_name}', '#{@method_name}'#{options.empty? ? '' : ', '+options.inspect}"/>]
10
+ end
11
+
12
+ # creates a hidden field with mv directive
13
+ def hidden_field(options)
14
+ %Q[<input type="hidden" name="#{@object_name}_#{@method_name}" mv:hidden_field="'#{@object_name}', '#{@method_name}'#{options.empty? ? '' : ', '+options.inspect}"/>]
15
+ end
16
+
17
+ # creates a password field with mv directives
18
+ def password_field(options)
19
+ %Q[<input type="password" name="#{@object_name}_#{@method_name}" mv:password_field="'#{@object_name}', '#{@method_name}'#{options.empty? ? '' : ', '+options.inspect}"/>]
20
+ end
21
+
22
+ # creates a text area with mv directives
23
+ def text_area(options)
24
+ %Q[<textarea name="#{@object_name}_#{@method_name}" rows="5" mv:text_area="'#{@object_name}', '#{@method_name}'#{options.empty? ? '' : ', '+options.inspect}"></textarea>]
25
+ end
26
+
27
+ # creates a date_select with mv directives
28
+ def date_select(options)
29
+ ret = <<-END
30
+ <span mv:replace="date_select '#{@object_name}', '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect}">
31
+ <select name="#{@object_name}[#{@method_name}(1i)]">
32
+ <option value="2001">2001</option>
33
+ <option value="2002">2002</option>
34
+ <option value="2003">2003</option>
35
+ <option value="2004">2004</option>
36
+ <option value="2005">2005</option>
37
+ <option value="2006">2006</option>
38
+ <option value="2007">2007</option>
39
+ <option value="2008">2008</option>
40
+ <option value="2009">2009</option>
41
+ <option value="2010">2010</option>
42
+ <option value="2011">2011</option>
43
+ </select>
44
+ <select name="#{@object_name}[#{@method_name}(2i)]">
45
+ <option value="1">January</option>
46
+ <option value="2">February</option>
47
+ <option value="3">March</option>
48
+ <option value="4">April</option>
49
+ <option value="5">May</option>
50
+ <option value="6">June</option>
51
+ <option value="7">July</option>
52
+ <option value="8">August</option>
53
+ <option value="9">September</option>
54
+ <option value="10">October</option>
55
+ <option value="11">November</option>
56
+ <option value="12">December</option>
57
+ </select>
58
+ <select name="#{@object_name}[#{@method_name}(3i)]">
59
+ <option value="1">1</option>
60
+ <option value="2">2</option>
61
+ <option value="3">3</option>
62
+ <option value="4">4</option>
63
+ <option value="5">5</option>
64
+ <option value="6">6</option>
65
+ <option value="7">7</option>
66
+ <option value="8">8</option>
67
+ <option value="9">9</option>
68
+ <option value="10">10</option>
69
+ <option value="11">11</option>
70
+ <option value="12">12</option>
71
+ <option value="13">13</option>
72
+ <option value="14">14</option>
73
+ <option value="15">15</option>
74
+ <option value="16">16</option>
75
+ <option value="17">17</option>
76
+ <option value="18">18</option>
77
+ <option value="19">19</option>
78
+ <option value="20">20</option>
79
+ <option value="21">21</option>
80
+ <option value="22">22</option>
81
+ <option value="23">23</option>
82
+ <option value="24">24</option>
83
+ <option value="25">25</option>
84
+ <option value="26">26</option>
85
+ <option value="27">27</option>
86
+ <option value="28">28</option>
87
+ <option value="29">29</option>
88
+ <option value="30">30</option>
89
+ <option value="31">31</option>
90
+ </select>
91
+ </span>
92
+ END
93
+ end
94
+
95
+ # creates a datetime_select with mv directives
96
+ def datetime_select(options)
97
+ ret = <<-END
98
+ <span mv:replace="datetime_select '#{@object_name}', '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect}">
99
+ <select name="#{@object_name}[#{@method_name}(1i)]">
100
+ <option value="2001">2001</option>
101
+ <option value="2002">2002</option>
102
+ <option value="2003">2003</option>
103
+ <option value="2004">2004</option>
104
+ <option value="2005">2005</option>
105
+ <option value="2006">2006</option>
106
+ <option value="2007">2007</option>
107
+ <option value="2008">2008</option>
108
+ <option value="2009">2009</option>
109
+ <option value="2010">2010</option>
110
+ <option value="2011">2011</option>
111
+ </select>
112
+ <select name="#{@object_name}[#{@method_name}(2i)]">
113
+ <option value="1">January</option>
114
+ <option value="2">February</option>
115
+ <option value="3">March</option>
116
+ <option value="4">April</option>
117
+ <option value="5">May</option>
118
+ <option value="6">June</option>
119
+ <option value="7">July</option>
120
+ <option value="8">August</option>
121
+ <option value="9">September</option>
122
+ <option value="10">October</option>
123
+ <option value="11">November</option>
124
+ <option value="12">December</option>
125
+ </select>
126
+ <select name="#{@object_name}[#{@method_name}(3i)]">
127
+ <option value="1">1</option>
128
+ <option value="2">2</option>
129
+ <option value="3">3</option>
130
+ <option value="4">4</option>
131
+ <option value="5">5</option>
132
+ <option value="6">6</option>
133
+ <option value="7">7</option>
134
+ <option value="8">8</option>
135
+ <option value="9">9</option>
136
+ <option value="10">10</option>
137
+ <option value="11">11</option>
138
+ <option value="12">12</option>
139
+ <option value="13">13</option>
140
+ <option value="14">14</option>
141
+ <option value="15">15</option>
142
+ <option value="16">16</option>
143
+ <option value="17">17</option>
144
+ <option value="18">18</option>
145
+ <option value="19">19</option>
146
+ <option value="20">20</option>
147
+ <option value="21">21</option>
148
+ <option value="22">22</option>
149
+ <option value="23">23</option>
150
+ <option value="24">24</option>
151
+ <option value="25">25</option>
152
+ <option value="26">26</option>
153
+ <option value="27">27</option>
154
+ <option value="28">28</option>
155
+ <option value="29">29</option>
156
+ <option value="30">30</option>
157
+ <option value="31">31</option>
158
+ </select>
159
+ &mdash; <select name="#{@object_name}[#{@method_name}(4i)]">
160
+ <option value="00">00</option>
161
+ <option value="01">01</option>
162
+ <option value="02">02</option>
163
+ <option value="03">03</option>
164
+ <option value="04">04</option>
165
+ <option value="05">05</option>
166
+ <option value="06">06</option>
167
+ <option value="07">07</option>
168
+ <option value="08">08</option>
169
+ <option value="09">09</option>
170
+ <option value="10">10</option>
171
+ <option value="11">11</option>
172
+ <option value="12">12</option>
173
+ <option value="13">13</option>
174
+ <option value="14">14</option>
175
+ <option value="15">15</option>
176
+ <option value="16">16</option>
177
+ <option value="17">17</option>
178
+ <option value="18">18</option>
179
+ <option value="19">19</option>
180
+ <option value="20">20</option>
181
+ <option value="21">21</option>
182
+ <option value="22">22</option>
183
+ <option value="23">23</option>
184
+ </select>
185
+ : <select name="#{@object_name}[#{@method_name}(5i)]">
186
+ <option value="00">00</option>
187
+ <option value="01">01</option>
188
+ <option value="02">02</option>
189
+ <option value="03">03</option>
190
+ <option value="04">04</option>
191
+ <option value="05">05</option>
192
+ <option value="06">06</option>
193
+ <option value="07">07</option>
194
+ <option value="08">08</option>
195
+ <option value="09">09</option>
196
+ <option value="10">10</option>
197
+ <option value="11">11</option>
198
+ <option value="12">12</option>
199
+ <option value="13">13</option>
200
+ <option value="14">14</option>
201
+
202
+ <option value="15">15</option>
203
+ <option value="16">16</option>
204
+ <option value="17">17</option>
205
+ <option value="18">18</option>
206
+ <option value="19">19</option>
207
+ <option value="20">20</option>
208
+ <option value="21">21</option>
209
+ <option value="22">22</option>
210
+ <option value="23">23</option>
211
+ <option value="24">24</option>
212
+ <option value="25">25</option>
213
+ <option value="26">26</option>
214
+ <option value="27">27</option>
215
+ <option value="28">28</option>
216
+ <option value="29">29</option>
217
+ <option value="30">30</option>
218
+ <option value="31">31</option>
219
+ <option value="32">32</option>
220
+ <option value="33">33</option>
221
+ <option value="34">34</option>
222
+ <option value="35">35</option>
223
+ <option value="36">36</option>
224
+ <option value="37">37</option>
225
+ <option value="38">38</option>
226
+ <option value="39">39</option>
227
+ <option value="40">40</option>
228
+ <option value="41">41</option>
229
+ <option value="42">42</option>
230
+ <option value="43">43</option>
231
+ <option value="44">44</option>
232
+ <option value="45">45</option>
233
+ <option value="46">46</option>
234
+ <option value="47">47</option>
235
+ <option value="48">48</option>
236
+ <option value="49">49</option>
237
+ <option value="50">50</option>
238
+ <option value="51">51</option>
239
+ <option value="52">52</option>
240
+ <option value="53">53</option>
241
+ <option value="54">54</option>
242
+ <option value="55">55</option>
243
+ <option value="56">56</option>
244
+ <option value="57">57</option>
245
+ <option value="58">58</option>
246
+ <option value="59">59</option>
247
+ </select>
248
+ </span>
249
+ END
250
+ end
251
+ end
252
+ end
253
+ end
254
+
255
+
@@ -1,4 +1,5 @@
1
1
  require 'masterview'
2
+ require File.join( File.dirname(__FILE__), 'actionview_helper' )
2
3
 
3
4
  class ScaffoldingSandbox
4
5
  include ActionView::Helpers::ActiveRecordHelper
@@ -36,28 +37,29 @@ end
36
37
 
37
38
 
38
39
  class ActionView::Helpers::InstanceTag
40
+ include ::MasterView::Generator::ActionViewHelper
39
41
  def to_input_field_tag(field_type, options={})
40
42
  field_meth = "#{field_type}_field"
41
43
  case field_meth
42
44
  when 'text_field'
43
- %Q[<input type="text" name="#{@object_name}_#{@method_name}" mv:text_field="'#{@object_name}', '#{@method_name}'#{options.empty? ? '' : ', '+options.inspect}"/>]
45
+ text_field options
44
46
  when 'hidden_field'
45
- %Q[<input type="hidden" name="#{@object_name}_#{@method_name}" mv:hidden_field="'#{@object_name}', '#{@method_name}'#{options.empty? ? '' : ', '+options.inspect}"/>]
47
+ hidden_field options
46
48
  when 'password_field'
47
- %Q[<input type="password" name="#{@object_name}_#{@method_name}" mv:password_field="'#{@object_name}', '#{@method_name}'#{options.empty? ? '' : ', '+options.inspect}"/>]
49
+ password_field options
48
50
  end
49
51
  end
50
52
 
51
53
  def to_text_area_tag(options = {})
52
- %Q[<textarea name="#{@object_name}_#{@method_name}" rows="5" mv:text_area="'#{@object_name}', '#{@method_name}'#{options.empty? ? '' : ', '+options.inspect}"></textarea>]
54
+ text_area options
53
55
  end
54
56
 
55
57
  def to_date_select_tag(options = {})
56
- %Q[<span mv:replace="date_select '#{@object_name}', '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect}">todo render date select</span>]
58
+ date_select options
57
59
  end
58
-
60
+
59
61
  def to_datetime_select_tag(options = {})
60
- %Q[<span mv:replace="datetime_select '#{@object_name}', '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect}">todo render date select</span>]
62
+ datetime_select options
61
63
  end
62
64
  end
63
65
 
@@ -66,17 +68,15 @@ module Rails
66
68
  module Commands
67
69
  class Create < Base
68
70
  def string_to_file(content, relative_destination, file_options = {}, &block)
69
- # Determine full paths for source and destination files.
70
- destination = destination_path(relative_destination)
71
- destination_exists = File.exists?(destination)
71
+ template_mio = MasterView::IOMgr.template.path(relative_destination)
72
72
 
73
73
  # If source and destination are identical then we're done.
74
- if destination_exists and content == File.readlines(destination).join
74
+ if template_mio.identical?(content)
75
75
  return logger.identical(relative_destination)
76
76
  end
77
77
 
78
78
  # Check for and resolve file collisions.
79
- if destination_exists
79
+ if template_mio.exist?
80
80
 
81
81
  # Make a choice whether to overwrite the file. :force and
82
82
  # :skip already have their mind made up, but give :ask a shot.
@@ -103,29 +103,15 @@ module Rails
103
103
  # If we're pretending, back off now.
104
104
  return if options[:pretend]
105
105
 
106
- # Write destination file with optional shebang. Yield for content
107
- # if block given so templaters may render the source file. If a
108
- # shebang is requested, replace the existing shebang or insert a
109
- # new one.
110
- File.open(destination, 'wb') do |df|
111
- if block_given?
112
- df.write(yield(content))
113
- else
114
- if file_options[:shebang]
115
- df.puts("#!#{file_options[:shebang]}")
116
- df.puts(line) if content !~ /^#!/
117
- end
118
- df.write(content)
119
- end
120
- end
106
+ template_mio.write(content, :disable_logging => true) # it is already being logged
121
107
 
122
108
  # Optionally change permissions.
123
- if file_options[:chmod]
124
- FileUtils.chmod(file_options[:chmod], destination)
125
- end
109
+ #if file_options[:chmod]
110
+ # FileUtils.chmod(file_options[:chmod], destination)
111
+ #end
126
112
 
127
113
  # Optionally add file to subversion
128
- system("svn add #{destination}") if options[:svn]
114
+ #system("svn add #{destination}") if options[:svn]
129
115
  end
130
116
 
131
117
  def multi_include_template(relative_source, relative_destination, template_options = {}, multi_assign_options = {})
@@ -134,7 +120,13 @@ module Rails
134
120
  multi_assign_options.each do |k,v|
135
121
  options[:assigns][k] = render_template_part(v)
136
122
  end
137
- template(relative_source, relative_destination, options)
123
+ # Render the source file with the temporary binding.
124
+ src_io = File.new( source_path(relative_source) )
125
+ vars = options[:assigns] || {}
126
+ b = binding
127
+ vars.each { |k,v| eval "#{k} = vars[:#{k}] || vars['#{k}']", b }
128
+ combined_contents = ERB.new(src_io.read, nil, '-').result(b)
129
+ string_to_file(combined_contents, relative_destination, template_options)
138
130
  end
139
131
 
140
132
  def multi_file_multi_include_template(relative_source, relative_destination_map, template_options = {}, multi_assign_options = {})
@@ -143,15 +135,15 @@ module Rails
143
135
  multi_assign_options.each do |k,v|
144
136
  options[:assigns][k] = render_template_part(v)
145
137
  end
146
- vars = options[:assigns] || {}
147
- b = binding
148
- vars.each { |k,v| eval "#{k} = vars[:#{k}] || vars['#{k}']", b }
138
+ vars = options[:assigns] || {}
139
+ b = binding
140
+ vars.each { |k,v| eval "#{k} = vars[:#{k}] || vars['#{k}']", b }
149
141
 
150
- # Render the source file with the temporary binding.
142
+ # Render the source file with the temporary binding.
151
143
  src_io = File.new( source_path(relative_source) )
152
144
  combined_contents = ERB.new(src_io.read, nil, '-').result(b)
153
145
  content_hash = {}
154
- MasterView::TemplateSpec.scan_template(combined_contents, nil, content_hash)
146
+ MasterView::TemplateSpec.scan_template(combined_contents, 'MasterViewTemporaryCombinedSource', content_hash)
155
147
  relative_destination_map.each do |page_type, relative_destination|
156
148
  template_spec = MasterView::TemplateSpec.new(relative_destination)
157
149
  yield(page_type, template_spec) #allow the template_spec to be modified
@@ -188,11 +180,11 @@ module Rails
188
180
  end
189
181
 
190
182
  class Update < Create
191
- def multi_include_template(relative_source, relative_destination, template_options = {}, multi_assign_options = {})
183
+ def multi_include_template(relative_source, relative_destination, template_options = {}, multi_assign_options = {})
192
184
  return if relative_source.is_a?(StringIO) && relative_destination.is_a?(StringIO)
193
185
  begin
194
186
  dest_file = destination_path(relative_destination)
195
- source_to_update = File.readlines(dest_file).join
187
+ source_to_update = MasterView::IOMgr.template.path(dest_file).read
196
188
  rescue Errno::ENOENT
197
189
  logger.missing relative_destination
198
190
  return
@@ -206,7 +198,7 @@ module Rails
206
198
  rendered_part = render_template_part(template_options)
207
199
  source_to_update.gsub!(/#{begin_mark}.*?#{end_mark}/m, rendered_part)
208
200
  end
209
- File.open(dest_file, 'w') { |file| file.write(source_to_update) }
201
+ MasterView::IOMgr.template.path(dest_file).write(source_to_update, :disable_logging => true ) # already logging
210
202
  end
211
203
 
212
204
  def multi_file_multi_include_template(relative_source, relative_destination_map, template_options = {}, multi_assign_options = {})
@@ -256,13 +248,13 @@ class MasterviewGenerator < Rails::Generator::NamedBase
256
248
 
257
249
  dts << com
258
250
 
259
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_new.css" mv:preview="remove" mv:replace=""/>',
251
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="../../masterview/extra/show_only_new.css" mv:preview="remove" mv:replace=""/>',
260
252
  full_options[:showSection] != :new )
261
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_edit.css" mv:preview="remove" mv:replace=""/>', true)
262
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_show.css" mv:preview="remove" mv:replace=""/>', true)
263
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_list.css" mv:preview="remove" mv:replace=""/>',
253
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="../../masterview/extra/show_only_edit.css" mv:preview="remove" mv:replace=""/>', true)
254
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="../../masterview/extra/show_only_show.css" mv:preview="remove" mv:replace=""/>', true)
255
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="../../masterview/extra/show_only_list.css" mv:preview="remove" mv:replace=""/>',
264
256
  full_options[:showSection] != :list )
265
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_destroy.css" mv:preview="remove" mv:replace=""/>', true)
257
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="../../masterview/extra/show_only_destroy.css" mv:preview="remove" mv:replace=""/>', true)
266
258
  end
267
259
  end
268
260
 
@@ -276,13 +268,14 @@ class MasterviewGenerator < Rails::Generator::NamedBase
276
268
 
277
269
  def design_time_javascript
278
270
  dtj = ''
279
- if full_options[:single_file]
280
- dtj << %Q[ <script type="text/javascript" mv:replace="" src="./extra/mvpreview.js"></script>\n]
271
+ # todo make this relative to whereever IOMgr.template is
272
+ if full_options[:single_file]
273
+ dtj << %Q[ <script type="text/javascript" mv:replace="" src="../../masterview/extra/mvpreview.js"></script>\n]
281
274
  dtj << %Q[ <script type="text/javascript" mv:replace="">\n]
282
275
  dtj << %Q[ mvpreview.preparePage( '#{controller_file_name}', {showOneSection: '#{controller_file_name}_list', single_file: true } );\n]
283
276
  dtj << %Q[ </script>\n]
284
277
  else
285
- dtj << %Q[ <script type="text/javascript" mv:replace="" src="./extra/mvpreview.js"></script>\n]
278
+ dtj << %Q[ <script type="text/javascript" mv:replace="" src="../../masterview/extra/mvpreview.js"></script>\n]
286
279
  dtj << %Q[ <script type="text/javascript" mv:replace="">\n]
287
280
  dtj << %Q[ mvpreview.preparePage( '#{controller_file_name}', {} );\n]
288
281
  dtj << %Q[ </script>\n]
@@ -291,14 +284,15 @@ class MasterviewGenerator < Rails::Generator::NamedBase
291
284
 
292
285
  def stylesheets
293
286
  ss = ''
287
+ # todo make this relative to whereever IOMgr.template is
294
288
  if full_options[:stylesheets]
295
289
  full_options[:stylesheets].each do |stylesheet|
296
290
  ss << %Q( <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/#{stylesheet}.css" mv:stylesheet_link="#{stylesheet}"/>\n)
297
291
  end
298
292
  else # unless --style option was present we output the default stylesheets
299
- ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/scaffold.css" mv:stylesheet_link="scaffold"/>\n}
300
- ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/sidebox.css" mv:stylesheet_link="sidebox"/>\n}
301
- ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/color-scheme.css" mv:stylesheet_link="color-scheme"/>\n}
293
+ ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/masterview/style.css" mv:stylesheet_link="masterview/style"/>\n}
294
+ ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/masterview/sidebox.css" mv:stylesheet_link="masterview/sidebox"/>\n}
295
+ ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/masterview/color-scheme.css" mv:stylesheet_link="masterview/color-scheme"/>\n}
302
296
  end
303
297
  ss
304
298
  end
@@ -329,8 +323,9 @@ class MasterviewGenerator < Rails::Generator::NamedBase
329
323
  m.directory File.join('app/controllers', controller_class_path)
330
324
  m.directory File.join('app/helpers', controller_class_path)
331
325
  m.directory File.join('app/views', controller_class_path, controller_view_dir_name)
332
- m.directory 'app/views/masterview'
333
- m.directory 'app/views/masterview/extra'
326
+ m.directory 'public/stylesheets/masterview'
327
+ m.directory 'app/masterview'
328
+ m.directory 'app/masterview/extra'
334
329
  m.directory File.join('test/functional', controller_class_path)
335
330
 
336
331
  # Controller class, functional test, helper, and views.
@@ -351,7 +346,7 @@ class MasterviewGenerator < Rails::Generator::NamedBase
351
346
 
352
347
  # MasterView
353
348
  if full_options[:single_file]
354
- m.multi_include_template "masterview.rhtml","app/views/masterview/#{controller_masterview_name}.html", {},
349
+ m.multi_include_template "masterview.rhtml","#{controller_masterview_name}/masterview.html", {},
355
350
  {
356
351
  'form_inclusion' =>
357
352
  { :insert => 'form_scaffold.rhtml',
@@ -385,11 +380,11 @@ class MasterviewGenerator < Rails::Generator::NamedBase
385
380
  else #multi file
386
381
  m.multi_file_multi_include_template "masterview.rhtml",
387
382
  {
388
- :list => "app/views/masterview/#{controller_masterview_name}_list.html",
389
- :new => "app/views/masterview/#{controller_masterview_name}_new.html",
390
- :edit => "app/views/masterview/#{controller_masterview_name}_edit.html",
391
- :show => "app/views/masterview/#{controller_masterview_name}_show.html",
392
- :destroy => "app/views/masterview/#{controller_masterview_name}_destroy.html",
383
+ :list => "#{controller_masterview_name}/list.html",
384
+ :new => "#{controller_masterview_name}/new.html",
385
+ :edit => "#{controller_masterview_name}/edit.html",
386
+ :show => "#{controller_masterview_name}/show.html",
387
+ :destroy => "#{controller_masterview_name}/destroy.html",
393
388
  },
394
389
  {},
395
390
  {
@@ -468,17 +463,17 @@ class MasterviewGenerator < Rails::Generator::NamedBase
468
463
  end
469
464
 
470
465
 
471
- m.file 'style.css', 'public/stylesheets/scaffold.css'
472
- m.file 'sidebox.css', 'public/stylesheets/sidebox.css'
473
- m.file 'color-scheme.css', 'public/stylesheets/color-scheme.css'
466
+ m.file 'style.css', 'public/stylesheets/masterview/style.css'
467
+ m.file 'sidebox.css', 'public/stylesheets/masterview/sidebox.css'
468
+ m.file 'color-scheme.css', 'public/stylesheets/masterview/color-scheme.css'
474
469
 
475
470
  # design time files
476
- m.file 'mvpreview.js', 'app/views/masterview/extra/mvpreview.js'
477
- m.file 'show_only_new.css', 'app/views/masterview/extra/show_only_new.css'
478
- m.file 'show_only_edit.css', 'app/views/masterview/extra/show_only_edit.css'
479
- m.file 'show_only_show.css', 'app/views/masterview/extra/show_only_show.css'
480
- m.file 'show_only_list.css', 'app/views/masterview/extra/show_only_list.css'
481
- m.file 'show_only_destroy.css', 'app/views/masterview/extra/show_only_destroy.css'
471
+ m.file 'mvpreview.js', 'app/masterview/extra/mvpreview.js'
472
+ m.file 'show_only_new.css', 'app/masterview/extra/show_only_new.css'
473
+ m.file 'show_only_edit.css', 'app/masterview/extra/show_only_edit.css'
474
+ m.file 'show_only_show.css', 'app/masterview/extra/show_only_show.css'
475
+ m.file 'show_only_list.css', 'app/masterview/extra/show_only_list.css'
476
+ m.file 'show_only_destroy.css', 'app/masterview/extra/show_only_destroy.css'
482
477
 
483
478
 
484
479
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  <%= all_input_tags(@model_instance, @singular_name, {}) %>
3
- <td class="operation"><a class="show_link" href="admin_show.html" mv:link_to=":action => 'show<%= suffix %>', :id => <%= singular_name %>">Show</a></td>
4
- <td class="operation"><a class="edit_link" href="admin_edit.html" mv:link_to=":action => 'edit<%= suffix %>', :id => <%= singular_name %>">Edit</a></td>
5
- <td class="operation"><a class="destroy_link" href="admin_destroy.html" mv:link_to=":action => 'destroy', :id => <%= singular_name %>">Destroy</a></td>
3
+ <td class="operation"><a class="show_link" href="show.html" mv:link_to=":action => 'show<%= suffix %>', :id => <%= singular_name %>">Show</a></td>
4
+ <td class="operation"><a class="edit_link" href="edit.html" mv:link_to=":action => 'edit<%= suffix %>', :id => <%= singular_name %>">Edit</a></td>
5
+ <td class="operation"><a class="destroy_link" href="destroy.html" mv:link_to=":action => 'destroy', :id => <%= singular_name %>">Destroy</a></td>
6
6
 
@@ -19,7 +19,7 @@
19
19
  <div id="header">
20
20
  <span class="headerTitle"><%= controller_class_name %></span>
21
21
  <div class="menuBar">
22
- <a href="<%= controller_file_name %>_list.html" mv:link_to=":action => :index">Home</a>
22
+ <a href="list.html" mv:link_to=":action => :index">Home</a>
23
23
  <!-- | <a href="">Another link</a> -->
24
24
  </div>
25
25
  </div>
@@ -34,14 +34,14 @@
34
34
  <div class="<%= controller_file_name %>_list sidebar LHS">
35
35
  <h2>Tasks:</h2>
36
36
  <ul>
37
- <li><a class="new_link" href="<%= controller_file_name %>_new.html" mv:link_to=":action => 'new<%= suffix %>'">Create new <%= singular_name %></a></li>
37
+ <li><a class="new_link" href="new.html" mv:link_to=":action => 'new<%= suffix %>'">Create new <%= singular_name %></a></li>
38
38
  </ul>
39
39
  </div>
40
40
 
41
41
  <div class="<%= controller_file_name %>_list content">
42
42
  <h1><%= plural_name.capitalize %></h1>
43
43
 
44
- <div id="<%= controller_file_name %>_messages" class="messages" mv:gen_render=":partial => '<%= controller_view_dir_name %>/messages'" mv:if="@flash[:notice]" mv:content="@flash[:notice]">
44
+ <div id="<%= controller_file_name %>_messages" class="messages" mv:gen_partial=":partial => '<%= controller_view_dir_name %>/messages'" mv:if="@flash[:notice]" mv:content="@flash[:notice]">
45
45
  <%= messages %>
46
46
  </div>
47
47
 
@@ -50,13 +50,13 @@
50
50
  <tr>
51
51
  <%= list_head_inclusion %>
52
52
  </tr>
53
- <tr mv:gen_render=":partial => '<%= controller_view_dir_name %>/<%= singular_name %>', :collection => @<%= plural_name %>">
53
+ <tr mv:gen_partial=":partial => '<%= controller_view_dir_name %>/<%= singular_name %>', :collection => @<%= plural_name %>">
54
54
  <%= list_line_inclusion %>
55
55
  </tr>
56
56
  </table>
57
57
 
58
- <a class="previous_link" href="<%= controller_file_name %>_list.html" mv:if="@<%= singular_name %>_pages.current.previous" mv:link_to=":page => @<%= singular_name %>_pages.current.previous">Previous page</a>
59
- <a class="next_link" href="<%= controller_file_name %>_list.html" mv:if="@<%= singular_name %>_pages.current.next" mv:link_to=":page => @<%= singular_name %>_pages.current.next">Next page</a>
58
+ <a class="previous_link" href="list.html" mv:if="@<%= singular_name %>_pages.current.previous" mv:link_to=":page => @<%= singular_name %>_pages.current.previous">Previous page</a>
59
+ <a class="next_link" href="list.html" mv:if="@<%= singular_name %>_pages.current.next" mv:link_to=":page => @<%= singular_name %>_pages.current.next">Next page</a>
60
60
 
61
61
  </div>
62
62
  </div>
@@ -68,7 +68,7 @@
68
68
  <div class="<%= controller_file_name %>_new sidebar LHS">
69
69
  <h2>Tasks:</h2>
70
70
  <ul>
71
- <li><a class="list_link" href="<%= controller_file_name %>_list.html" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
71
+ <li><a class="list_link" href="list.html" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
72
72
  </ul>
73
73
  </div>
74
74
 
@@ -84,7 +84,7 @@
84
84
  copyOf:<%= controller_file_name %>_messages
85
85
  </div>
86
86
 
87
- <div id="<%= controller_file_name %>_form" mv:gen_render=":partial => '<%= controller_view_dir_name %>/form'">
87
+ <div id="<%= controller_file_name %>_form" mv:gen_partial=":partial => '<%= controller_view_dir_name %>/form'">
88
88
  <div class="error_messages" mv:replace="error_messages_for :<%= singular_name %>">
89
89
  error messages
90
90
  </div>
@@ -109,7 +109,7 @@
109
109
  <div class="<%= controller_file_name %>_edit sidebar LHS">
110
110
  <h2>Tasks:</h2>
111
111
  <ul>
112
- <li><a class="list_link" href="<%= controller_file_name %>_list.html" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
112
+ <li><a class="list_link" href="list.html" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
113
113
  </ul>
114
114
  </div>
115
115
 
@@ -145,8 +145,8 @@
145
145
  <div class="<%= controller_file_name %>_show sidebar LHS">
146
146
  <h2>Tasks:</h2>
147
147
  <ul>
148
- <li><a class="list_link" href="<%= controller_file_name %>_list.html" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
149
- <li><a class="edit_link" href="<%= controller_file_name %>_edit.html" mv:link_to=":action => 'edit<%= suffix %>', :id => @<%= singular_name %>.id">Edit this <%= singular_name %></a></li>
148
+ <li><a class="list_link" href="list.html" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
149
+ <li><a class="edit_link" href="edit.html" mv:link_to=":action => 'edit<%= suffix %>', :id => @<%= singular_name %>.id">Edit this <%= singular_name %></a></li>
150
150
  </ul>
151
151
  </div>
152
152
 
@@ -157,7 +157,7 @@
157
157
  copyOf:<%= controller_file_name %>_messages
158
158
  </div>
159
159
 
160
- <div id="<%= controller_file_name %>_show_partial" class="form" mv:gen_render=":partial => '<%= controller_view_dir_name %>/show'">
160
+ <div id="<%= controller_file_name %>_show_partial" class="form" mv:gen_partial=":partial => '<%= controller_view_dir_name %>/show'">
161
161
  <%= show_inclusion %>
162
162
  </div>
163
163
 
@@ -169,8 +169,8 @@
169
169
  <div class="<%= controller_file_name %>_destroy sidebar LHS">
170
170
  <h2>Tasks:</h2>
171
171
  <ul>
172
- <li><a class="list_link" href="<%= controller_file_name %>_list.html" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
173
- <li><a class="show_link" href="<%= controller_file_name %>_show.html" mv:link_to=":action => 'show<%= suffix %>', :id => @<%= singular_name %>.id">Show this <%= singular_name %></a></li>
172
+ <li><a class="list_link" href="list.html" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
173
+ <li><a class="show_link" href="show.html" mv:link_to=":action => 'show<%= suffix %>', :id => @<%= singular_name %>.id">Show this <%= singular_name %></a></li>
174
174
  </ul>
175
175
  </div>
176
176
 
@@ -113,8 +113,8 @@
113
113
  function(button){
114
114
  var className = button.className;
115
115
  if(className){
116
- if(className.match(regexSave)) mvpreview.registerShowPageLink(button, prefix+'_list.html');
117
- else if(className.match(regexCancel)) mvpreview.registerShowPageLink(button, prefix+'_list.html');
116
+ if(className.match(regexSave)) mvpreview.registerShowPageLink(button, 'list.html');
117
+ else if(className.match(regexCancel)) mvpreview.registerShowPageLink(button, 'list.html');
118
118
  }
119
119
  }
120
120
  );
metadata CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: masterview_generator
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.5
7
- date: 2006-05-31 00:00:00 -05:00
8
- summary: A (x)html friendly template engine for rails with the power of layouts, and partials. MasterView Generator for GEM
6
+ version: 0.2.0
7
+ date: 2006-06-21 00:00:00 -05:00
8
+ summary: A (x)html friendly template engine for rails with the power of layouts, and partials. MasterView Generator for creating templates and scaffolding.
9
9
  require_paths:
10
10
  - .
11
11
  email: jeff.barczewski@gmail.com
@@ -29,6 +29,7 @@ authors:
29
29
  - Jeff Barczewski
30
30
  files:
31
31
  - masterview_generator.rb
32
+ - actionview_helper.rb
32
33
  - templates/show_only_destroy.css
33
34
  - templates/show_only_new.css
34
35
  - templates/controller.rb