masterview 0.2.5 → 0.3.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.
Files changed (155) hide show
  1. data/CHANGELOG +31 -1
  2. data/README +70 -69
  3. data/RELEASE_NOTES +70 -64
  4. data/Rakefile +26 -27
  5. data/TODO +13 -29
  6. data/doc/about.html +246 -0
  7. data/doc/configuration.html +49 -36
  8. data/doc/developer.html +423 -41
  9. data/doc/directives.html +139 -51
  10. data/doc/guide.html +19 -9
  11. data/doc/index.html +90 -224
  12. data/doc/installation.html +36 -28
  13. data/doc/media_list.html +30 -20
  14. data/doc/simple_diagram.html +3 -5
  15. data/doc/stylesheets/masterview.css +16 -1
  16. data/examples/rails_app_config/masterview/settings.rb +2 -1
  17. data/init.rb +1 -1
  18. data/lib/#ChangeLog# +6 -0
  19. data/lib/masterview/analyzer.rb +48 -34
  20. data/lib/masterview/attr_string_parser.rb +5 -1
  21. data/lib/masterview/case_insensitive_hash.rb +69 -0
  22. data/lib/masterview/{pathname_extensions.rb → core_ext/pathname.rb} +0 -0
  23. data/lib/masterview/{string_extensions.rb → core_ext/string.rb} +0 -0
  24. data/lib/masterview/deprecated/directive_base.rb +362 -0
  25. data/lib/masterview/directive_base.rb +201 -179
  26. data/lib/masterview/directive_dsl.rb +457 -0
  27. data/lib/masterview/directive_helpers.rb +28 -141
  28. data/lib/masterview/directive_load_path.rb +388 -0
  29. data/lib/masterview/directive_metadata.rb +377 -0
  30. data/lib/masterview/directive_registry.rb +259 -69
  31. data/lib/masterview/directives/.metadata +16 -0
  32. data/lib/masterview/directives/attr.rb +9 -8
  33. data/lib/masterview/directives/block.rb +11 -14
  34. data/lib/masterview/directives/check_box.rb +13 -18
  35. data/lib/masterview/directives/collection_select.rb +15 -29
  36. data/lib/masterview/directives/content.rb +9 -3
  37. data/lib/masterview/directives/else.rb +15 -13
  38. data/lib/masterview/directives/elsif.rb +14 -13
  39. data/lib/masterview/directives/eval.rb +20 -0
  40. data/lib/masterview/directives/form.rb +56 -9
  41. data/lib/masterview/directives/form_remote.rb +26 -0
  42. data/lib/masterview/directives/global_inline_erb.rb +10 -14
  43. data/lib/masterview/directives/hidden_field.rb +11 -20
  44. data/lib/masterview/directives/if.rb +13 -12
  45. data/lib/masterview/directives/image_tag.rb +20 -28
  46. data/lib/masterview/directives/import.rb +5 -12
  47. data/lib/masterview/directives/import_render.rb +7 -19
  48. data/lib/masterview/directives/insert_generated_comment.rb +8 -11
  49. data/lib/masterview/directives/javascript_include.rb +21 -12
  50. data/lib/masterview/directives/link_to.rb +14 -8
  51. data/lib/masterview/directives/link_to_function.rb +22 -0
  52. data/lib/masterview/directives/link_to_if.rb +15 -13
  53. data/lib/masterview/directives/link_to_remote.rb +13 -8
  54. data/lib/masterview/directives/omit_tag.rb +32 -16
  55. data/lib/masterview/directives/password_field.rb +10 -22
  56. data/lib/masterview/directives/radio_button.rb +11 -22
  57. data/lib/masterview/directives/replace.rb +7 -8
  58. data/lib/masterview/directives/select.rb +11 -24
  59. data/lib/masterview/directives/stylesheet_link.rb +20 -12
  60. data/lib/masterview/directives/submit.rb +11 -5
  61. data/lib/masterview/directives/text_area.rb +10 -23
  62. data/lib/masterview/directives/text_field.rb +10 -22
  63. data/lib/masterview/exceptions.rb +21 -0
  64. data/lib/masterview/extras/app/controllers/masterview_controller.rb +102 -75
  65. data/lib/masterview/extras/app/views/layouts/masterview_admin.rhtml +24 -23
  66. data/lib/masterview/extras/app/views/layouts/masterview_admin_config.rhtml +81 -0
  67. data/lib/masterview/extras/app/views/masterview/admin/configuration.rhtml +5 -1
  68. data/lib/masterview/extras/app/views/masterview/admin/create.rhtml +2 -2
  69. data/lib/masterview/extras/app/views/masterview/admin/directives.rhtml +5 -0
  70. data/lib/masterview/extras/app/views/masterview/admin/features.rhtml +5 -79
  71. data/lib/masterview/extras/app/views/masterview/admin/interact.rhtml +5 -0
  72. data/lib/masterview/extras/app/views/masterview/admin/list.rhtml +3 -71
  73. data/lib/masterview/extras/init_mv_admin_pages.rb +42 -23
  74. data/lib/masterview/filter_helpers.rb +26 -0
  75. data/lib/masterview/initializer.rb +99 -53
  76. data/lib/masterview/io.rb +19 -15
  77. data/lib/masterview/keyword_expander.rb +7 -2
  78. data/lib/masterview/masterview_info.rb +229 -23
  79. data/lib/masterview/masterview_version.rb +2 -2
  80. data/lib/masterview/parser.rb +275 -105
  81. data/lib/masterview/parser_helpers.rb +54 -0
  82. data/lib/masterview/rails_ext/action_controller_erb_direct.rb +29 -0
  83. data/lib/masterview/rails_ext/action_controller_reparse_checking.rb +27 -0
  84. data/lib/masterview/{extras/init_rails_erb_mv_direct.rb → rails_ext/action_view_erb_direct.rb} +12 -59
  85. data/lib/masterview/template_spec.rb +3 -2
  86. data/lib/masterview.rb +21 -12
  87. data/lib/rexml/parsers/baseparser_with_doctype_fix.rb +473 -0
  88. data/lib/rexml/parsers/sax2parser_with_doctype_fix.rb +243 -0
  89. data/test/directive_test_helper.rb +135 -0
  90. data/test/fixtures/directives/id_check.rb +18 -0
  91. data/test/fixtures/directives/test_directive_events.rb +70 -0
  92. data/test/test_helper.rb +18 -5
  93. data/test/tmp/views/layouts/product.rhtml +10 -10
  94. data/test/tmp/views/product/_form.rhtml +4 -4
  95. data/test/tmp/views/product/_product.rhtml +3 -3
  96. data/test/tmp/views/product/destroy.rhtml +5 -5
  97. data/test/tmp/views/product/edit.rhtml +4 -4
  98. data/test/tmp/views/product/list.rhtml +3 -3
  99. data/test/tmp/views/product/new.rhtml +4 -4
  100. data/test/tmp/views/product/show.rhtml +2 -2
  101. data/test/unit/attr_string_parser_test.rb +105 -0
  102. data/test/unit/case_insensitive_hash_mod_test.rb +104 -0
  103. data/test/unit/config_settings_test.rb +13 -1
  104. data/test/unit/default_generate_mio_filter_test.rb +3 -3
  105. data/test/unit/deprecated_directive_base_test.rb +30 -0
  106. data/test/unit/directive_attr_test.rb +111 -35
  107. data/test/unit/directive_base_test.rb +520 -1
  108. data/test/unit/directive_block_test.rb +30 -22
  109. data/test/unit/directive_content_test.rb +24 -11
  110. data/test/unit/directive_else_test.rb +18 -15
  111. data/test/unit/directive_elsif_test.rb +17 -15
  112. data/test/unit/directive_form_remote_test.rb +59 -0
  113. data/test/unit/directive_form_test.rb +31 -39
  114. data/test/unit/directive_global_inline_erb_test.rb +28 -17
  115. data/test/unit/directive_grid_test_notready.rb +38 -0
  116. data/test/unit/directive_helpers_test.rb +39 -0
  117. data/test/unit/directive_hidden_field_test.rb +44 -29
  118. data/test/unit/directive_if_test.rb +10 -7
  119. data/test/unit/directive_image_tag_test.rb +69 -61
  120. data/test/unit/directive_import_render_test.rb +28 -38
  121. data/test/unit/directive_import_test.rb +16 -14
  122. data/test/unit/directive_insert_generated_comment_test.rb +32 -0
  123. data/test/unit/directive_javascript_include_test.rb +40 -43
  124. data/test/unit/directive_link_to_function_test.rb +40 -0
  125. data/test/unit/directive_link_to_if_test.rb +52 -12
  126. data/test/unit/directive_link_to_remote_test.rb +58 -0
  127. data/test/unit/directive_link_to_test.rb +46 -31
  128. data/test/unit/directive_load_path_test.rb +257 -0
  129. data/test/unit/directive_metadata_test.rb +313 -0
  130. data/test/unit/directive_omit_tag_test.rb +73 -21
  131. data/test/unit/directive_password_field_test.rb +44 -38
  132. data/test/unit/directive_registry_test.rb +44 -0
  133. data/test/unit/directive_replace_test.rb +28 -12
  134. data/test/unit/directive_stylesheet_link_test.rb +43 -36
  135. data/test/unit/directive_submit_test.rb +29 -30
  136. data/test/unit/directive_text_area_test.rb +40 -36
  137. data/test/unit/directive_text_field_test.rb +44 -38
  138. data/test/unit/example_directive_child_events_test.rb +41 -0
  139. data/test/unit/example_test.rb +31 -4
  140. data/test/unit/file_mio_test.rb +18 -13
  141. data/test/unit/filter_helpers_test.rb +10 -8
  142. data/test/unit/find_directive_parent_test.rb +174 -0
  143. data/test/unit/keyword_expander_test.rb +4 -2
  144. data/test/unit/mio_test.rb +18 -11
  145. data/test/unit/mtime_string_hash_mio_tree_test.rb +5 -1
  146. data/test/unit/parser_test.rb +41 -29
  147. data/test/unit/pathname_extensions_test.rb +1 -1
  148. data/test/unit/run_parser_test.rb +2 -2
  149. data/test/unit/simplified_directive_base_test.rb +256 -0
  150. data/test/unit/string_hash_mio_test.rb +5 -1
  151. data/test/unit/template_file_watcher_test.rb +2 -2
  152. data/test/unit/template_test.rb +221 -46
  153. metadata +86 -45
  154. data/lib/masterview/directives/testfilter.rb +0 -55
  155. data/lib/masterview/extras/init_rails_reparse_checking.rb +0 -62
@@ -1,27 +1,27 @@
1
1
  #
2
2
  # == MasterView Admin Controller
3
- #
3
+ #
4
4
  # The MasterviewController is a Rails controller that you can enable
5
5
  # in your Rails application to provide administrative operations
6
6
  # for the MasterView template engine.
7
- #
7
+ #
8
8
  # To enable or disable the admin controller, use the
9
9
  # MasterView::Configuration setting +enable_admin_pages+
10
10
  # to enable or disable its availability in your
11
11
  # config/masterview/settngs.rb or a suitable environment
12
12
  # settings file, according to your intended usage:
13
- #
13
+ #
14
14
  # config.enable_admin_pages = true
15
- #
15
+ #
16
16
  # When enabled, the MasterView admin controller is accessable
17
17
  # in your application at the address:
18
- #
18
+ #
19
19
  # http://yourapp.foo/masterview
20
- #
21
- # The controller places its stylesheets in a +masterview+ subdirectory
20
+ #
21
+ # The controller places its stylesheets in a +masterview+ subdirectory
22
22
  # in your rails stylesheets directory (app/stylesheets/masterview).
23
- #
24
- # The MasterView admin controller is primarily a developer facility;
23
+ #
24
+ # The MasterView admin controller is primarily a developer facility;
25
25
  # it is not generally appropriate for end-users of your rails application.
26
26
  # If you enable this facility in your production environment,
27
27
  # you should consider restricting access to authorized users.
@@ -32,10 +32,10 @@
32
32
  # integrate stylesheets and layout into their overal app look?
33
33
  # How/when would access restriction actually be hooked up?
34
34
  # Standard technique is to do something along the lines of using
35
- # a before_filter which invokes things like :check_authentication
35
+ # a before_filter which invokes things like :check_authentication
36
36
  # and :check_authorization services in the app framework
37
37
  # (or, say, predicate can_access? or has_permission? or...].
38
- # But... this whole area of user authentication and authorization
38
+ # But... this whole area of user authentication and authorization
39
39
  # has no specific conventions in the Rails ecosystem yet,
40
40
  # so we really can't make any assumptions yet about any particular
41
41
  # approach that MasterviewController itself could hook into.
@@ -43,45 +43,48 @@
43
43
  # them tips on how to make it happen.
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
- include MasterView::DefaultGenerateMIOFilter
50
+ include MasterView::MIO::DefaultGenerateMIOFilter
51
51
 
52
52
  before_filter :check_authorization, :except => [ :access_not_allowed ]
53
53
 
54
- ENABLE_ADMIN_LAYOUT = false #:nodoc: #UNDER CONSTRUCTION - fine idea, but doesn't work yet [DJL 03-Jun-2006]
54
+ ###layout 'masterview_admin'
55
+
56
+ MV_ADMIN_INSTALL_DIR = File.expand_path( File.join(File.dirname(__FILE__), '../..') ) #:nodoc:
57
+ #CONTEXT_REF_VIEW = 'app/views'
58
+ #CONTEXT_REF_LAYOUT = 'app/views/layout'
59
+ FILE_LOC_APP = 'app' #:nodoc:
60
+ FILE_LOC_MV = 'mv' #:nodoc:
55
61
 
56
- # Describe the MasterView configuration option settings
57
- def configuration
58
- if ENABLE_ADMIN_LAYOUT
59
- smart_render_with_layout('masterview/admin/configuration', 'masterview_admin')
60
- else
61
- #ugly, but keep this version
62
- aint_got_no_layout_backstop = '<div style="padding-top: 6px;">(back to <a href=".">Admin home</a>)</div>'
63
- config_html = MasterView::Info.to_html( :postscript => aint_got_no_layout_backstop )
64
- render :text => config_html
65
- end
66
- end
67
-
68
62
  def index
69
63
  redirect_to :action => :list
70
64
  end
71
65
 
72
66
  # List the templates in the application and their status.
73
- # Provide operations to force rebuild (reparse and regenerate)
67
+ # Provide operations to force rebuild (reparse and regenerate)
74
68
  # of specific templates or all templates and
75
69
  # create utility to ...mumble...
76
- #
70
+ #
77
71
  def list
78
72
  template_specs, content_hash = MasterView::TemplateSpec.scan
79
73
  @template_specs_sorted = template_specs.sort
80
- smart_render 'masterview/admin/list'
74
+ masterview_render_with_layout( 'masterview/admin/list', 'masterview_admin' )
75
+ end
76
+
77
+ # Describe the MasterView configuration option settings
78
+ def configuration
79
+ masterview_render_with_layout( 'masterview/admin/configuration', 'masterview_admin_config' )
80
+ end
81
+
82
+ def directives
83
+ masterview_render_with_layout( 'masterview/admin/directives', 'masterview_admin_config' )
81
84
  end
82
85
 
83
86
  def features
84
- smart_render 'masterview/admin/features'
87
+ masterview_render_with_layout( 'masterview/admin/features', 'masterview_admin_config' )
85
88
  end
86
89
 
87
90
  # Rebuild all templates in the application.
@@ -103,7 +106,7 @@ class MasterviewController < ApplicationController
103
106
  # Rebuild a specific template.
104
107
  # Invoked from the main masterview admin page.
105
108
  def rebuild
106
- path = params[:id]
109
+ path = params[:file]
107
110
  template_specs, content_hash = MasterView::TemplateSpec.scan
108
111
  template_spec = template_specs[path]
109
112
  raise 'Template '+path+' not found' unless template_spec
@@ -120,7 +123,7 @@ class MasterviewController < ApplicationController
120
123
  def create
121
124
  if @request.post?
122
125
  action_to_create = params[:action_name]
123
- src_file = params[:id]
126
+ src_file = params[:file]
124
127
 
125
128
  empty_file_path = find_path('app/views/masterview/admin/empty.rhtml')
126
129
  empty_insert_erb = File.readlines(empty_file_path).join
@@ -136,7 +139,7 @@ class MasterviewController < ApplicationController
136
139
  # View the generated rhtml
137
140
  def view_rhtml
138
141
  raise "View RHTML is disabled. Edit your config/masterview/settings.rb (or config/masterview/environments/xxxx.rb) file and set config.enable_view_rhtml = true. Restart application for change to take effect." unless MasterView::EnableMasterViewAdminViewRHTML
139
- @rhtml_file = params[:id]
142
+ @rhtml_file = params[:file]
140
143
  raise "RHTML file not specified" unless @rhtml_file
141
144
  f = MasterView::IOMgr.erb.path(@rhtml_file)
142
145
  raise "RHTML file ("+@rhtml_file+") not found. Maybe automatic parsing is disabled. You may invoke parsing manually by using rake mv:parse" unless f.exist?
@@ -149,22 +152,26 @@ class MasterviewController < ApplicationController
149
152
  @results = []
150
153
  @src = params[:src]
151
154
  if @src
152
- sh_mio = MasterView::StringHashMIOTree.new({}, MasterView::LoadedConfiguration.generated_file_default_extension )
153
-
154
- src_with_default_gen = add_default_gen_if_needed(@src) # apply a default generate
155
- MasterView::Parser.parse( src_with_default_gen, { :output_mio_tree => sh_mio, :omit_comment => true, :template_pathname => 'YOUR_TEMPLATE_PATH_HERE' } )
156
- @results = sh_mio.string_hash.sort.collect do |file,rhtml|
157
- os = OpenStruct.new
158
- os.file = file
159
- os.rhtml = rhtml
160
- os
155
+ begin
156
+ sh_mio = MasterView::MIO::StringHashMIOTree.new({}, MasterView::ConfigSettings.generated_file_default_extension )
157
+
158
+ src_with_default_gen = add_default_gen_if_needed(@src) # apply a default generate
159
+ MasterView::Parser.parse( src_with_default_gen, { :output_mio_tree => sh_mio, :omit_comment => true, :template_pathname => 'YOUR_TEMPLATE_PATH_HERE', :rescue_exceptions => false } )
160
+ @results = sh_mio.string_hash.sort.collect do |file,rhtml|
161
+ os = OpenStruct.new
162
+ os.file = file
163
+ os.rhtml = rhtml
164
+ os
165
+ end
166
+ rescue REXML::ParseException => e
167
+ @error_message = e.to_s
161
168
  end
162
169
  end
163
170
  smart_render 'masterview/admin/interact'
164
171
  end
165
172
 
166
173
  def access_not_allowed #:nodoc:
167
- render :text => '<p>We\'re sorry, but the page you have requested is only available to authorized users.</p>',
174
+ render :text => '<p>We\'re sorry, but the page you have requested is only available to authorized users.</p>',
168
175
  :status => 500
169
176
  end
170
177
 
@@ -186,56 +193,76 @@ class MasterviewController < ApplicationController
186
193
  end
187
194
  end
188
195
 
189
- private
196
+ private
190
197
 
191
198
  # checks app path first for views and files, then falls back to files in MV
192
199
  def find_path(path)
193
- local_path = File.join(RAILS_ROOT, path)
194
- mv_path = File.join(File.dirname(__FILE__), '../..', path)
195
- working_path = (File.exist?(local_path)) ? local_path : mv_path
200
+ app_path = File.join(RAILS_ROOT, path)
201
+ mv_path = File.join(MV_ADMIN_INSTALL_DIR, path)
202
+ working_path = (File.exist?(app_path)) ? app_path : mv_path
196
203
  end
197
204
 
198
205
  # render local template file if exists otherwise render file from mv
199
206
  def smart_render(short_path)
200
- local_path = File.join(RAILS_ROOT, 'app/views', short_path)+'.rhtml'
201
- if File.exist?(local_path)
207
+ template_path, template_loc = resolve_relative_path( short_path, 'app/views' )
208
+ if template_loc == FILE_LOC_APP
202
209
  render :template => short_path
203
210
  else
204
- mv_path = File.join(File.dirname(__FILE__), '../../app/views', short_path)+'.rhtml'
205
- MasterView::Log.debug { 'mv_path='+mv_path }
206
- render :file => mv_path
211
+ MasterView::Log.debug { 'render admin template from mv_path='+template_path }
212
+ render :file => template_path
207
213
  end
208
214
  end
209
215
 
210
216
  # render local template file if exists otherwise render file from mv
211
- def smart_render_with_layout(short_path, layout) #:nodoc: #UNDER CONSTRUCTION
212
- #DOESN'T WORK YET - we get the right path, but need a way into template rendering
213
- # (usual path through rails bolts in assumption of app/views rel path)
214
- # [DJL 03-Jul-2006]
215
- local_path = File.join(RAILS_ROOT, 'app/views', short_path)+'.rhtml'
216
- if File.exist?(local_path)
217
- render :template => short_path, :layout => smart_layout_path(layout)
217
+ def masterview_render_with_layout(short_path, layout) #:nodoc:
218
+ template_path, template_loc = resolve_relative_path( short_path, 'app/views' )
219
+ layout_path, layout_loc = resolve_relative_path( layout, 'app/views/layouts' )
220
+ if (template_loc == FILE_LOC_APP) && (layout_loc == FILE_LOC_APP)
221
+ # app has customized both the admin page view and its layout
222
+ render :template => short_path, :layout => layout
218
223
  else
219
- mv_path = File.join(File.dirname(__FILE__), '../../app/views', short_path)+'.rhtml'
220
- MasterView::Log.debug { 'mv_path='+mv_path }
221
- render :file => mv_path, :layout => smart_layout_path(layout)
224
+ # template or layout or both use std masterview
225
+ MasterView::Log.debug { 'render admin template from mv_path='+template_path }
226
+ MasterView::Log.debug { 'render admin layout from mv_path='+layout_path } if layout_loc == FILE_LOC_MV
227
+ masterview_render_file_with_layout( template_path, layout_path )
222
228
  end
223
229
  end
224
230
 
225
- def smart_layout_path(short_path) #:nodoc: #UNDER CONSTRUCTION
226
- local_path = File.join(RAILS_ROOT, 'app/views/layouts', short_path)+'.rhtml'
227
- if File.exist?(local_path)
228
- short_path
229
- else
230
- mv_layouts_dir_path = File.expand_path( File.join(File.dirname(__FILE__), '../../app/views/layouts') )
231
- mv_path = File.join(mv_layouts_dir_path, short_path)+'.rhtml'
232
- if File.exist?(mv_path)
233
- MasterView::Log.debug { 'admin layout mv_path='+mv_path }
234
- else
235
- MasterView::Log.error { '***BAD ADMIN PAGE LAYOUT REF: mv_path='+mv_path }
236
- end
237
- mv_path
231
+ # Resolve a relative reference within the Rails application
232
+ # or to the masterview installation directory.
233
+ # Answer the full_path and a location indicator ('app' or 'mv')
234
+ def resolve_relative_path( short_path, context_ref='app/views', file_ext='.rhtml' )
235
+
236
+ file_ref = "#{short_path}#{file_ext}"
237
+
238
+ # resolve to rails app/views if present to allow app customization
239
+ app_path = File.join(RAILS_ROOT, context_ref, file_ref)
240
+ return [ app_path, FILE_LOC_APP ] if File.exist?(app_path)
241
+
242
+ # resolve to standard masterview view template if not overridden
243
+ mv_path = File.join(MV_ADMIN_INSTALL_DIR, context_ref, file_ref)
244
+ if ! File.exist?(mv_path)
245
+ MasterView::Log.error { '***NO SUCH MV ADMIN FILE: mv_path='+mv_path }
238
246
  end
247
+ return [ mv_path, FILE_LOC_MV ]
239
248
  end
240
249
 
241
250
  end
251
+
252
+ # patch a special version of template rendering into ActionController::Base
253
+ # standard layout rendering is bolted down to app/views/layout context
254
+ module ActionController #:nodoc:
255
+ class Base #:nodoc:
256
+ def masterview_render_file_with_layout( template_path, layout_path, local_assigns={} )
257
+ # Implementation based on ActionController::Layout#render_with_a_layout
258
+ use_full_path = false #we already have full path, we don't want rails template_base prefixed
259
+ add_variables_to_assigns
260
+ content_for_layout = @template.render_file(template_path, use_full_path, local_assigns)
261
+ # following was needed in ActionController::Layout because of the way it does its overrides
262
+ #erase_render_results #??do we need to do this?? Is there any downside to doing so??!
263
+ #add_variables_to_assigns
264
+ @template.instance_variable_set('@content_for_layout', content_for_layout)
265
+ render_text(@template.render_file(layout_path, use_full_path, local_assigns))
266
+ end
267
+ end
268
+ end
@@ -1,22 +1,22 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
3
 
4
4
  <html xmlns="http://www.w3.org/1999/xhtml"
5
5
  xml:lang="en" lang="en">
6
6
 
7
- <head>
8
- <title>MasterView Admin</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
7
+ <head>
8
+ <title>Masterview Admin</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+
11
+ <%= stylesheet_link_tag 'masterview/style' %>
12
+ <%= stylesheet_link_tag 'masterview/sidebox' %>
13
+ <%= stylesheet_link_tag 'masterview/color-scheme' %>
14
+ <%= javascript_include_tag :defaults %>
15
+
16
+ </head>
17
+ <body>
10
18
 
11
- <%= stylesheet_link_tag 'masterview/style' %>
12
- <%= stylesheet_link_tag 'masterview/sidebox' %>
13
- <%= stylesheet_link_tag 'masterview/color-scheme' %>
14
- <%= javascript_include_tag :defaults %>
15
- </head>
16
-
17
- <body>
18
-
19
- <!-- ###### Header ###### -->
19
+ <!-- ###### Header ###### -->
20
20
 
21
21
  <div id="header">
22
22
  <span class="headerTitle">Admin</span>
@@ -25,20 +25,21 @@
25
25
  <!-- | <a href="">Another link</a> -->
26
26
  </div>
27
27
  </div>
28
-
29
-
28
+
30
29
  <div class="main">
31
30
 
32
31
  <div class="mv_admin_list sidebar LHS">
33
32
  <h2>Tasks:</h2>
34
33
  <ul>
35
34
  <li><%= link_to 'View Configuration', :action => 'configuration' %></li>
36
- <li><%= link_to 'View Loaded Features', :action => 'features' %></li>
37
- <li style="margin-top: 6px; padding-top: 4px; border-top: 1px dashed;"><%= link_to 'Rebuild all outdated templates', :action => 'rebuild_all' %></li>
35
+ <li><%= link_to 'View Features', :action => 'features' %></li>
36
+ <li><%= link_to 'View Directives', :action => 'directives' %></li>
37
+ <li class="subsection_start"><%= link_to 'Interactive Render', :action => 'interact' %></li>
38
+ <li class="subsection_start"><%= link_to 'Rebuild all outdated templates', :action => 'rebuild_all' %></li>
38
39
  </ul>
39
40
  </div>
40
-
41
- <div class="mv_admin_list content">
41
+
42
+ <div class="mv_admin_list content">
42
43
  <h1>MasterView Admin</h1>
43
44
 
44
45
  <% if @flash[:notice] %>
@@ -46,12 +47,12 @@
46
47
  <%= h @flash[:notice] %>
47
48
  </div>
48
49
  <% end %>
49
-
50
+
50
51
  <%= @content_for_layout %>
51
52
 
52
- </div>
53
+ </div>
53
54
 
54
- </div>
55
+ </div> <!-- end main -->
55
56
 
56
57
  <!-- ###### Footer ###### -->
57
58
 
@@ -69,5 +70,5 @@
69
70
  </div>
70
71
  </div>
71
72
 
72
- </body>
73
+ </body>
73
74
  </html>
@@ -0,0 +1,81 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml"
5
+ xml:lang="en" lang="en">
6
+
7
+ <head>
8
+ <title>Masterview Admin - <%= @config_page_title %></title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+
11
+ <%= stylesheet_link_tag 'masterview/style' %>
12
+ <%= stylesheet_link_tag 'masterview/sidebox' %>
13
+ <%= stylesheet_link_tag 'masterview/color-scheme' %>
14
+ <%= javascript_include_tag :defaults %>
15
+
16
+ </head>
17
+ <body>
18
+
19
+ <!-- ###### Header ###### -->
20
+
21
+ <div id="header">
22
+ <span class="headerTitle">Admin</span>
23
+ <div class="menuBar">
24
+ <%= link_to 'Home', :action => :index %>
25
+ <!-- | <a href="">Another link</a> -->
26
+ </div>
27
+ </div>
28
+
29
+ <div class="main">
30
+
31
+ <div class="create_div" id="mv_admin_configuration"><!-- ###### configuration ###### -->
32
+ <div class="mv_admin_configuration sidebar LHS">
33
+ <h2>Tasks:</h2>
34
+ <ul>
35
+ <li><%= link_to 'View Configuration', :action => 'configuration' %></li>
36
+ <li><%= link_to 'View Features', :action => 'features' %></li>
37
+ <li><%= link_to 'View Directives', :action => 'directives' %></li>
38
+ <li class="subsection_start"><%= link_to 'Interactive Render', :action => 'interact' %></li>
39
+ <li class="subsection_start"><%= link_to 'Rebuild all outdated templates', :action => 'rebuild_all' %></li>
40
+ <li class="subsection_start"><%= link_to 'Admin Home', :action => 'list' %></li>
41
+ </ul>
42
+ </div>
43
+
44
+ <div class="mv_admin_configuration content">
45
+
46
+ <h1><%= @config_page_title %></h1>
47
+ <p><b>MasterView Version:</b> <%= MasterView::VERSION::STRING %><br/></p>
48
+
49
+ <% if @flash[:notice] %>
50
+ <div class="messages" id="admin_messages">
51
+ <%= h @flash[:notice] %>
52
+ </div>
53
+ <% end %>
54
+
55
+ <%= @content_for_layout %>
56
+
57
+ </div>
58
+
59
+ </div>
60
+
61
+ </div> <!-- end main -->
62
+
63
+ <!-- ###### Footer ###### -->
64
+
65
+ <div id="footer">
66
+ <div class="footerLHS">
67
+ <a href="http://validator.w3.org/check/referer">Valid XHTML 1.0 Strict</a>
68
+ </div>
69
+
70
+ <div class="footerLHS">
71
+ <a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS 2</a>
72
+ </div>
73
+
74
+ <div>
75
+ Powered by MasterView
76
+ </div>
77
+ </div>
78
+
79
+
80
+ </body>
81
+ </html
@@ -1 +1,5 @@
1
- <%= MasterView::Info.to_html() %>
1
+ <% @config_page_title = 'Configuration Settings' -%>
2
+ <%= MasterView::Info.to_html(
3
+ :title => :none, :preamble => :none,
4
+ :container_attrs => 'class="config_info"',
5
+ :section_attrs => 'class="section_header"' ) %>
@@ -53,8 +53,8 @@
53
53
  <div class="record">
54
54
  <div class="label"><label for="id">Source:</label></div>
55
55
  <div class="field">
56
- <%= File.basename(params[:id], '.html') %> (Template to copy layout from)
57
- <input type="hidden" name="id" value="<%= params[:id] %>"
56
+ <%= File.basename(params[:file], '.html') %> (Template to copy layout from)
57
+ <input type="hidden" name="file" value="<%= params[:file] %>"
58
58
  </div>
59
59
  </div>
60
60
 
@@ -0,0 +1,5 @@
1
+ <% @config_page_title = 'Loaded Directives' -%>
2
+ <%= MasterView::DirectivesInfo.to_html(
3
+ :title => :none, :preamble => :none,
4
+ :container_attrs => 'class="config_info"',
5
+ :section_attrs => 'class="section_header"' ) %>
@@ -1,79 +1,5 @@
1
- <html>
2
- <head>
3
- <title>Masterview Admin</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</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="create_div" id="mv_admin_features"><!-- ###### features ###### -->
27
- <div class="mv_admin_features sidebar LHS">
28
- <h2>Tasks:</h2>
29
- <ul>
30
- <li><%= link_to 'Back to overview', :action => 'list' %></li>
31
- </ul>
32
- </div>
33
-
34
- <div class="mv_admin_features content">
35
- <h1>Loaded Features</h1>
36
- <b>MasterView Version:</b> <%= MasterView::VERSION::STRING %><br/><br/>
37
-
38
- <% if @flash[:notice] %>
39
- <div class="messages" id="admin_messages">
40
- <%= h @flash[:notice] %>
41
- </div>
42
- <% end %>
43
-
44
- <table>
45
- <thead>
46
- <tr><th>Feature</th><th>Loaded</th></tr>
47
- </thead>
48
- <tbody>
49
- <tr><td>Filter templates through tidy on read</td><td><%= (MasterView::LoadedFeatures[:tidy_template_read]) ? 'true' : 'false' %></td></tr>
50
- <tr><td>Parse templates at startup</td><td><%= (MasterView::LoadedFeatures[:rails_parse_at_startup]) ? 'true' : 'false' %></td></tr>
51
- <tr><td>Reparse modified templates</td><td><%= (MasterView::LoadedFeatures[:rails_reparse_checking]) ? 'true' : 'false' %></td></tr>
52
- <tr><td>Read ERB directly from MasterView</td><td><%= (MasterView::LoadedFeatures[:rails_erb_mv_direct]) ? 'true' : 'false' %></td></tr>
53
- </tbody>
54
- </table>
55
-
56
- </div>
57
- </div>
58
-
59
- </div>
60
-
61
- <!-- ###### Footer ###### -->
62
-
63
- <div id="footer">
64
- <div class="footerLHS">
65
- <a href="http://validator.w3.org/check/referer">Valid XHTML 1.0 Strict</a>
66
- </div>
67
-
68
- <div class="footerLHS">
69
- <a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS 2</a>
70
- </div>
71
-
72
- <div>
73
- Powered by MasterView
74
- </div>
75
- </div>
76
-
77
-
78
- </body>
79
- </html>
1
+ <% @config_page_title = 'Loaded Features' -%>
2
+ <%= MasterView::FeaturesInfo.to_html(
3
+ :title => :none, :preamble => :none,
4
+ :container_attrs => 'class="config_info"',
5
+ :section_attrs => 'class="section_header"' ) %>
@@ -89,6 +89,11 @@
89
89
  <h2>Rendered RHTML</h2>
90
90
  <% end %>
91
91
 
92
+ <% if @error_message %>
93
+ <h2>Error message</h2>
94
+ <%= h @error_message %>
95
+ <% end %>
96
+
92
97
  <% @results.each do |result| %>
93
98
  <div class="record">
94
99
  <div class="label"><label for="id"><%= result.file %>:</label></div>