masterview_generator 0.0.13 → 0.0.14

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.
@@ -142,13 +142,13 @@ class MasterviewGenerator < Rails::Generator::NamedBase
142
142
 
143
143
  def design_time_stylesheets
144
144
  dts = ''
145
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_new.css" mv:replace=""/>',
145
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_new.css" mv:preview="remove" mv:replace=""/>',
146
146
  full_options[:showSection] != :new )
147
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_edit.css" mv:replace=""/>', true)
148
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_show.css" mv:replace=""/>', true)
149
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_list.css" mv:replace=""/>',
147
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_edit.css" mv:preview="remove" mv:replace=""/>', true)
148
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_show.css" mv:preview="remove" mv:replace=""/>', true)
149
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_list.css" mv:preview="remove" mv:replace=""/>',
150
150
  full_options[:showSection] != :list )
151
- dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_destroy.css" mv:replace=""/>', true)
151
+ dts << html_comment( '<link rel="stylesheet" type="text/css" href="./extra/show_only_destroy.css" mv:preview="remove" mv:replace=""/>', true)
152
152
  end
153
153
 
154
154
  def html_comment(orig, comment_out)
@@ -18,8 +18,8 @@
18
18
  </head>
19
19
  <body>
20
20
 
21
- <div class="messages" mv:if="@flash[:notice]" mv:content="@flash[:notice]">
22
- messages here - Note: Other divs are hidden at design time, disable extra/show_only_new.css or import different extra/*.css to work with other sections (extra stylesheets are show_only_edit.css, show_only_show.css, show_only_list.css, show_only_destroy.css)
21
+ <div id="<%= controller_file_name %>_messages" class="messages" mv:if="@flash[:notice]" mv:content="@flash[:notice]">
22
+ messages here - Note: Other page sections in this MasterView file are hidden at design time, disable the stylesheet &apos;extra/show_only_new.css&apos; or uncomment different extra/*.css to work with other page sections (other stylesheets are show_only_edit.css, show_only_show.css, show_only_list.css, show_only_destroy.css and they are commented out in this masterview file&apos;s head section)
23
23
  </div>
24
24
 
25
25
  <div class="main">
@@ -1,6 +1,7 @@
1
1
  var mvpreview = new Object();
2
2
 
3
3
  mvpreview.preview_divs = $A( document.getElementsByTagName('div') ).findAll( function(elem){ return (elem.getAttribute('mv:preview') != null); });
4
+ mvpreview.preview_remove_css_links = $A( document.getElementsByTagName('link') ).findAll( function(elem){ return (elem.getAttribute('mv:preview') != null); });
4
5
 
5
6
  mvpreview.copySections = function(){
6
7
  var mv_sections_needing_copy = this.preview_divs.findAll( function(elem){
@@ -15,7 +16,23 @@
15
16
  } );
16
17
  };
17
18
 
19
+ mvpreview.removeSections = function(){
20
+ var mv_sections_needing_removal = this.preview_remove_css_links.findAll( function(elem){
21
+ var prevAttr = elem.getAttribute('mv:preview');
22
+ return (prevAttr == 'remove');
23
+ });
24
+
25
+ //copy sections
26
+ mv_sections_needing_removal.each( function(e){
27
+ e.parentNode.removeChild(e);
28
+ } );
29
+ };
30
+
18
31
  mvpreview.sections = mvpreview.preview_divs.findAll( function(elem){ return (elem.getAttribute('mv:preview') == 'showOne'); });
32
+
33
+ mvpreview.change_messages = function(prefix){
34
+ $(prefix+'_messages').innerHTML = 'messages would be here - You are currently running this in browser preview mode. Javascript has overridden the links and buttons so that you can click on any of them to view other pages for this controller. This is to simulate app operation as a standalone prototype.';
35
+ }
19
36
 
20
37
  mvpreview.hideSections = function(){
21
38
  this.sections.each( function(elem){ window.Element.hide(elem); } );
@@ -77,7 +94,9 @@
77
94
 
78
95
 
79
96
  mvpreview.preparePage = function(prefix, options){
97
+ mvpreview.change_messages(prefix);
80
98
  mvpreview.copySections();
99
+ mvpreview.removeSections();
81
100
  mvpreview.registerShowOneSectionLinks(prefix);
82
101
  if(options && options.showOneSection) mvpreview.showOneSection(options.showOneSection);
83
102
  }
metadata CHANGED
@@ -3,8 +3,8 @@ 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.0.13
7
- date: 2006-04-27 00:00:00 -05:00
6
+ version: 0.0.14
7
+ date: 2006-04-28 00:00:00 -05:00
8
8
  summary: A (x)html friendly template engine for rails with the power of layouts, and partials. MasterView Generator for GEM
9
9
  require_paths:
10
10
  - .