masterview_generator 0.0.16 → 0.0.17

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.
@@ -159,6 +159,20 @@ class MasterviewGenerator < Rails::Generator::NamedBase
159
159
  t << "\n"
160
160
  end
161
161
 
162
+ def stylesheets
163
+ ss = ''
164
+ if full_options[:stylesheets]
165
+ full_options[:stylesheets].each do |stylesheet|
166
+ ss << %Q( <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/#{stylesheet}.css" mv:stylesheet_link="#{stylesheet}"/>\n)
167
+ end
168
+ else # unless --style option was present we output the default stylesheets
169
+ ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/scaffold.css" mv:stylesheet_link="scaffold"/>\n}
170
+ ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/sidebox.css" mv:stylesheet_link="sidebox"/>\n}
171
+ ss << %Q{ <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/color-scheme.css" mv:stylesheet_link="color-scheme"/>\n}
172
+ end
173
+ ss
174
+ end
175
+
162
176
  def manifest
163
177
  record do |m|
164
178
  # Depend on model generator but skip if the model exists.
@@ -202,7 +216,7 @@ class MasterviewGenerator < Rails::Generator::NamedBase
202
216
  :mark_id => singular_name
203
217
  },
204
218
  'list_head_inclusion' =>
205
- { :insert => 'fields_scaffold.rhtml',
219
+ { :insert => 'list_head_scaffold.rhtml',
206
220
  :sandbox => lambda { create_multi_sandbox('ListHeadScaffoldingSandbox') },
207
221
  :begin_mark => 'listhead',
208
222
  :end_mark => 'eolisthead',
@@ -225,6 +239,8 @@ class MasterviewGenerator < Rails::Generator::NamedBase
225
239
  }
226
240
 
227
241
  m.template 'style.css', 'public/stylesheets/scaffold.css'
242
+ m.template 'sidebox.css', 'public/stylesheets/sidebox.css'
243
+ m.template 'color-scheme.css', 'public/stylesheets/color-scheme.css'
228
244
 
229
245
  # design time files
230
246
  m.template 'mvpreview.js', 'app/views/masterview/extra/mvpreview.js'
@@ -241,13 +257,25 @@ class MasterviewGenerator < Rails::Generator::NamedBase
241
257
  protected
242
258
  # Override with your own usage banner.
243
259
  def banner
244
- "Usage: #{$0} masterview ModelName [ControllerName] [action, ...] [--showAll | --showOnlyNew | --showOnlyList]"
260
+ "Usage: #{$0} masterview ModelName [ControllerName] [action, ...] [--show-all | --show-only list] [--style [cssStylesheet]]"
245
261
  end
246
262
 
247
263
  def add_options!(opt)
248
- opt.on('-A', '--showAll', 'Generate with ALL sections visible at design time (no css hiding)') { options[:showSection] = :all }
249
- opt.on('-N', '--showOnlyNew', 'Geneate with only NEW section visible at design time (rest hidden with css)') { options[:showSection] = :new }
250
- opt.on('-L', '--showOnlyList', 'Geneate with only LIST section visible at design time (rest hidden with css)') { options[:showSection] = :list }
264
+ opt.on('-A', '--show-all', 'Generate with ALL sections visible at design time (no css hiding)') { options[:showSection] = :all }
265
+ opt.on("-O", "--show-only SECTION_NAME",
266
+ "Generate with only sectionName section visible at design time (rest hidden with css)",
267
+ " (Valid options are: new, list)",
268
+ " (example: --showOnly list - would generate to show only 'list' section at design time)" ) do |section|
269
+ options[:showSection] = section.to_sym
270
+ end
271
+
272
+ opt.on("-S", "--style [CSS_STYLESHEET]",
273
+ "Add this stylesheet instead of defaults",
274
+ " (You may add this option multiple times for each stylesheet to add)",
275
+ " (If you omit the cssStylesheet then no default stylesheets will be added)" ) do |stylesheet|
276
+ options[:stylesheets] ||= []
277
+ options[:stylesheets] << File.basename(stylesheet, File.extname(stylesheet)) if stylesheet #get only the base part, so if /home/foo.css get foo
278
+ end
251
279
  end
252
280
 
253
281
  def scaffold_views
@@ -0,0 +1,71 @@
1
+ /* ------------------------------------------------------------------------
2
+ Five basic colors are used. These are:
3
+ 1. Text Color
4
+ 2. Border Color
5
+ 3. Background Color (darker)
6
+ 4. Background Color (lighter)
7
+ 5. Message Color
8
+
9
+ To change the above colors, just edit their respective values below.
10
+ ------------------------------------------------------------------------ */
11
+
12
+
13
+ /* ###### General Color Scheme ###### */
14
+
15
+ h1, h2, h3, th, label, #header div, #header div *, #footer *, .headerTitle, .sidebar *
16
+ { /* Text Color: */ color: #008500; }
17
+
18
+ h1, table, td, th, #header, .sidebar, .sidebar h2
19
+ { /* Border Color: */ border-color: #008500; }
20
+
21
+ #header, th, .sidebar div, .sidebar h2
22
+ { /* Background Color (darker): */ background-color: #F3FFED; }
23
+
24
+ .sidebar span
25
+ { /* Background Color (lighter): */ background-color: #F6FFF2; }
26
+
27
+
28
+ /* ###### Special Colors ###### */
29
+
30
+ #header a {
31
+ color: #008500;
32
+ }
33
+
34
+ #header a:hover{
35
+ color: #008500;
36
+ background-color: #F6FFF2;
37
+ }
38
+
39
+ .sidebar a {
40
+ color: #008500;
41
+ }
42
+
43
+ .messages {
44
+ /* Message Color */ color: #3a89af;
45
+ }
46
+
47
+ .sidebar a:hover {
48
+ color: #008500;
49
+ background-color: #F3FFED;
50
+ }
51
+
52
+ .content a {
53
+ color: #008500;
54
+ background-color: #F6FFF2;
55
+ }
56
+
57
+ .operation{
58
+ background-color: #F6FFF2;
59
+ }
60
+
61
+ #footer {
62
+ background-color: #F6FFF2;
63
+ }
64
+
65
+ #footer a {
66
+ color: #008500;
67
+ }
68
+
69
+ #footer div {
70
+ color: #008500;
71
+ }
@@ -1,6 +1,6 @@
1
1
 
2
2
  <%= all_input_tags(@model_instance, @singular_name, {}) %>
3
- <td><a class="show_link" href="#" mv:link_to=":action => 'show<%= suffix %>', :id => <%= singular_name %>">Show</a></td>
4
- <td><a class="edit_link" href="#" mv:link_to=":action => 'edit<%= suffix %>', :id => <%= singular_name %>">Edit</a></td>
5
- <td><a class="destroy_link" href="#" mv:link_to=":action => 'destroy', :id => <%= singular_name %>">Destroy</a></td>
3
+ <td class="operation"><a class="show_link" href="#" mv:link_to=":action => 'show<%= suffix %>', :id => <%= singular_name %>">Show</a></td>
4
+ <td class="operation"><a class="edit_link" href="#" mv:link_to=":action => 'edit<%= suffix %>', :id => <%= singular_name %>">Edit</a></td>
5
+ <td class="operation"><a class="destroy_link" href="#" mv:link_to=":action => 'destroy', :id => <%= singular_name %>">Destroy</a></td>
6
6
 
@@ -1,7 +1,8 @@
1
1
  <html mv:generate="layouts/<%= controller_file_name %>.rhtml">
2
2
  <head>
3
- <title><%= controller_class_name %>: {{{= controller.action_name }}}</title>
4
- <link rel="stylesheet" type="text/css" href="../../../public/stylesheets/scaffold.css" mv:stylesheet_link="scaffold"/>
3
+ <title><%= controller_class_name %>: {{{= controller.action_name }}}</title>
4
+
5
+ <%= stylesheets -%>
5
6
 
6
7
  <!--
7
8
  These stylesheets below are for design time use to allow working with only one visible section at a time, especially
@@ -18,28 +19,45 @@
18
19
  </head>
19
20
  <body>
20
21
 
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)
22
+ <!-- ###### Header ###### -->
23
+
24
+ <div id="header">
25
+ <span class="headerTitle"><%= controller_class_name %></span>
26
+ <div class="menuBar">
27
+ <a href="#" mv:link_to=":action => :index">Home</a>
28
+ <!-- | <a href="">Another link</a> -->
29
+ </div>
23
30
  </div>
24
31
 
32
+
25
33
  <div class="main">
26
34
  <div id="<%= controller_file_name %>_content" mv:replace="@content_for_layout">
35
+
36
+
37
+
38
+ <!-- ###### New ###### -->
39
+
27
40
  <div id="<%= controller_file_name %>_new" mv:generate="<%= controller_view_dir_name %>/new.rhtml" mv:preview="showOne" class="new_div">
28
- <div class="<%= controller_file_name %>_new sidebar">
29
- <h1>Tasks:</h1>
41
+
42
+ <div class="<%= controller_file_name %>_new sidebar LHS">
43
+ <h2>Tasks:</h2>
30
44
  <ul>
31
45
  <li><a class="list_link" href="#" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
32
46
  </ul>
33
47
  </div>
34
48
 
35
49
  <div class="<%= controller_file_name %>_new content">
36
- <h1><%= plural_name.capitalize %></h1>
50
+ <h1><%= plural_name.capitalize %></h1>
37
51
 
38
52
  <form mv:form=":action => 'new'">
39
53
 
40
54
  <div class="form">
41
55
  <h2>Creating <%= singular_name %></h2>
42
56
 
57
+ <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]">
58
+ 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)
59
+ </div>
60
+
43
61
  <div id="<%= controller_file_name %>_form" mv:gen_render=":partial => '<%= controller_view_dir_name %>/form'">
44
62
  <div class="error_messages" mv:replace="error_messages_for :<%= singular_name %>">
45
63
  error messages
@@ -61,9 +79,12 @@
61
79
  </div>
62
80
 
63
81
 
82
+
83
+ <!-- ###### Edit ###### -->
84
+
64
85
  <div id="<%= controller_file_name %>_edit" mv:generate="<%= controller_view_dir_name %>/edit.rhtml" mv:preview="showOne" class="edit_div">
65
- <div class="<%= controller_file_name %>_edit sidebar">
66
- <h1>Tasks:</h1>
86
+ <div class="<%= controller_file_name %>_edit sidebar LHS">
87
+ <h2>Tasks:</h2>
67
88
  <ul>
68
89
  <li><a class="list_link" href="#" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
69
90
  </ul>
@@ -72,10 +93,16 @@
72
93
  <div class="<%= controller_file_name %>_edit content">
73
94
  <h1><%= plural_name.capitalize %></h1>
74
95
 
96
+
75
97
  <form mv:form=":action => 'edit', :id => @<%=singular_name%>.id">
76
98
 
77
99
  <div class="form">
78
100
  <h2>Editing <%= singular_name %></h2>
101
+
102
+ <div class="messages" mv:replace="render :partial => 'messages'" mv:preview="copyOf:<%= controller_file_name %>_messages">
103
+ copyOf:<%= controller_file_name %>_messages
104
+ </div>
105
+
79
106
  <div mv:replace="render :partial => 'form'" mv:preview="copyOf:<%= controller_file_name %>_form">
80
107
  copyOf:<%= controller_file_name %>_form
81
108
  </div>
@@ -91,9 +118,12 @@
91
118
  </div>
92
119
 
93
120
 
121
+
122
+ <!-- ###### List ###### -->
123
+
94
124
  <div id="<%= controller_file_name %>_list" mv:generate="<%= controller_view_dir_name %>/list.rhtml" mv:preview="showOne" class="list_div">
95
- <div class="<%= controller_file_name %>_list sidebar">
96
- <h1>Tasks:</h1>
125
+ <div class="<%= controller_file_name %>_list sidebar LHS">
126
+ <h2>Tasks:</h2>
97
127
  <ul>
98
128
  <li><a class="new_link" href="#" mv:link_to=":action => 'new<%= suffix %>'">Create new <%= singular_name %></a></li>
99
129
  </ul>
@@ -102,6 +132,10 @@
102
132
  <div class="<%= controller_file_name %>_list content">
103
133
  <h1><%= plural_name.capitalize %></h1>
104
134
 
135
+ <div class="messages" mv:replace="render :partial => 'messages'" mv:preview="copyOf:<%= controller_file_name %>_messages">
136
+ copyOf:<%= controller_file_name %>_messages
137
+ </div>
138
+
105
139
  <div class="list">
106
140
  <table border="1" class="<%= controller_file_name %>_list_table" cellpadding="5">
107
141
  <tr>
@@ -120,9 +154,12 @@
120
154
  </div>
121
155
 
122
156
 
157
+
158
+ <!-- ###### Show ###### -->
159
+
123
160
  <div id="<%= controller_file_name %>_show" mv:generate="<%= controller_view_dir_name %>/show.rhtml" mv:preview="showOne" class="show_div">
124
- <div class="<%= controller_file_name %>_show sidebar">
125
- <h1>Tasks:</h1>
161
+ <div class="<%= controller_file_name %>_show sidebar LHS">
162
+ <h2>Tasks:</h2>
126
163
  <ul>
127
164
  <li><a class="list_link" href="#" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
128
165
  <li><a class="edit_link" href="#" mv:link_to=":action => 'edit<%= suffix %>', :id => @<%= singular_name %>.id">Edit this <%= singular_name %></a></li>
@@ -132,6 +169,10 @@
132
169
  <div class="<%= controller_file_name %>_show content">
133
170
  <h1><%= plural_name.capitalize %></h1>
134
171
 
172
+ <div class="messages" mv:replace="render :partial => 'messages'" mv:preview="copyOf:<%= controller_file_name %>_messages">
173
+ copyOf:<%= controller_file_name %>_messages
174
+ </div>
175
+
135
176
  <div id="<%= controller_file_name %>_show_partial" class="form" mv:gen_render=":partial => '<%= controller_view_dir_name %>/show'">
136
177
  <%= show_inclusion %>
137
178
  </div>
@@ -139,9 +180,13 @@
139
180
  </div>
140
181
  </div>
141
182
 
183
+
184
+
185
+ <!-- ###### Destroy ###### -->
186
+
142
187
  <div id="<%= controller_file_name %>_destroy" mv:generate="<%= controller_view_dir_name %>/destroy.rhtml" mv:preview="showOne" class="destroy_div">
143
- <div class="<%= controller_file_name %>_destroy sidebar">
144
- <h1>Tasks:</h1>
188
+ <div class="<%= controller_file_name %>_destroy sidebar LHS">
189
+ <h2>Tasks:</h2>
145
190
  <ul>
146
191
  <li><a class="list_link" href="#" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
147
192
  <li><a class="show_link" href="#" mv:link_to=":action => 'show<%= suffix %>', :id => @<%= singular_name %>.id">Show this <%= singular_name %></a></li>
@@ -151,6 +196,10 @@
151
196
  <div class="<%= controller_file_name %>_destroy content">
152
197
  <h1><%= plural_name.capitalize %></h1>
153
198
 
199
+ <div class="messages" mv:replace="render :partial => 'messages'" mv:preview="copyOf:<%= controller_file_name %>_messages">
200
+ copyOf:<%= controller_file_name %>_messages
201
+ </div>
202
+
154
203
  <div class="error_messages" mv:replace="error_messages_for :<%= singular_name %>">
155
204
  error messages
156
205
  </div>
@@ -173,6 +222,29 @@
173
222
  </div>
174
223
  </div>
175
224
 
225
+
226
+
227
+ <!-- ###### Footer ###### -->
228
+
229
+ <div id="footer">
230
+ <div class="footerLHS">
231
+ <a href="http://validator.w3.org/check/referer">Valid XHTML 1.0 Strict</a>
232
+ </div>
233
+
234
+ <div class="footerLHS">
235
+ <a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS 2</a>
236
+ </div>
237
+
238
+ <div>
239
+ Copyright
240
+ </div>
241
+
242
+ <div>
243
+ Website by
244
+ </div>
245
+ </div>
246
+
247
+
176
248
  <script type="text/javascript" mv:replace="" src="./extra/mvpreview.js"></script>
177
249
  <script type="text/javascript" mv:replace="">
178
250
  mvpreview.preparePage( '<%= controller_file_name %>', {showOneSection: '<%= controller_file_name %>_list' } );
@@ -0,0 +1,178 @@
1
+
2
+ /* ###### Browser-specific Styles ###### */
3
+
4
+ /* For IE & Mozilla-based browsers: */
5
+
6
+ .LHS {
7
+ margin-left: 2.5mm;
8
+ float: left;
9
+ clear: left;
10
+ }
11
+
12
+ .RHS {
13
+ margin-right: 2.5mm;
14
+ float: right;
15
+ clear: right;
16
+ }
17
+
18
+ /* For Mozilla-based (CSS2-fully complaint) browsers only: */
19
+
20
+ [class~="LHS"] {
21
+ margin-left: 5mm;
22
+ }
23
+
24
+ [class~="RHS"] {
25
+ margin-right: 5mm;
26
+ }
27
+
28
+
29
+ /* ###### Body Text ###### */
30
+
31
+ body {
32
+ background-color: white;
33
+ color: black;
34
+ font-family: verdana, tahoma, helvetica, arial, sans-serif;
35
+ font-size: 95%;
36
+ margin: 0;
37
+ background-repeat: no-repeat;
38
+ background-attachment: scroll;
39
+ }
40
+
41
+ h1, h2, h3 {
42
+ font-family: "trebuchet ms", tahoma, sans-serif;
43
+ }
44
+
45
+ h1 {
46
+ font-weight: bold;
47
+ font-size: 150%;
48
+ border-bottom-style: solid;
49
+ border-bottom-width: 1px;
50
+ padding-bottom: 0.5ex;
51
+ }
52
+
53
+ h2 {
54
+ font-size: 120%;
55
+ }
56
+
57
+ img {
58
+ border: none;
59
+ }
60
+
61
+
62
+ .content {
63
+ text-align: justify;
64
+ line-height: 1.5em;
65
+ margin: 0 14em 0 14em;
66
+ padding: 0 1em 1ex 1em;
67
+ }
68
+
69
+ .content p {
70
+ padding-bottom: 2ex;
71
+ }
72
+
73
+ .content a {
74
+ font-weight: bold;
75
+ font-size: 90%;
76
+ }
77
+
78
+ .record {
79
+ clear: none;
80
+ }
81
+
82
+ table,td,th{
83
+ border-width: 1px;
84
+ border-style: solid;
85
+ border-collapse:collapse;
86
+ margin:0;
87
+ padding:0;
88
+ }
89
+
90
+ td,th{
91
+ padding:.2em .5em;
92
+ vertical-align:top;
93
+ }
94
+
95
+ a {
96
+ text-decoration: none;
97
+ }
98
+
99
+ a:hover {
100
+ text-decoration: underline;
101
+ }
102
+
103
+ /* ###### Header ###### */
104
+
105
+ #header {
106
+ border-bottom-style: solid;
107
+ border-bottom-width: 2px;
108
+ height: 5.5em;
109
+ margin-bottom: 5mm;
110
+ padding: 0 2.5mm 0 5mm;
111
+ background-repeat: no-repeat;
112
+ }
113
+
114
+ .headerTitle {
115
+ font-size: 300%;
116
+ font-weight: bold;
117
+ line-height: 1.25em;
118
+ }
119
+
120
+ /* ###### Side Box ###### */
121
+
122
+ div.sidebar {
123
+ border-style: solid none solid none;
124
+ border-width: 2px 0 2px 0;
125
+ width: 12em;
126
+ margin-top: 0;
127
+ margin-bottom: 1.25ex;
128
+ }
129
+
130
+ .sidebar h2 {
131
+ font-size: 95%;
132
+ font-weight: bold;
133
+ border-bottom-style: dashed;
134
+ border-bottom-width: 1px;
135
+ margin-top: 0;
136
+ padding: 0.25ex 0.25em 0.25ex 0.75em;
137
+ }
138
+
139
+ .sidebar a {
140
+ text-decoration: none;
141
+ display: block;
142
+ padding: 0.35ex 0.35em 0.35ex 0.35em;
143
+ }
144
+
145
+ .sidebar a:hover {
146
+ text-decoration: underline;
147
+ display: block;
148
+ padding: 0.35ex 0.35em 0.35ex 0.35em;
149
+ }
150
+
151
+ .sidebar ul {
152
+ font-size: 85%;
153
+ line-height: 80%;
154
+ position: relative;
155
+ left: -2em;
156
+ list-style-type: none;
157
+ }
158
+
159
+ /* ###### Footer ###### */
160
+
161
+ #footer {
162
+ padding-top: 0.75ex;
163
+ padding-bottom: 0.75ex;
164
+ clear: left;
165
+ }
166
+
167
+ #footer div {
168
+ font-size: 85%;
169
+ line-height: 1.25em;
170
+ text-align: right;
171
+ padding-right: 3mm;
172
+ }
173
+
174
+ .footerLHS {
175
+ float: left;
176
+ clear: left;
177
+ padding-left: 3mm;
178
+ }
data/templates/style.css CHANGED
@@ -2,21 +2,8 @@ body { background-color: #fff; color: #333; }
2
2
 
3
3
  body, p, ol, ul, td {
4
4
  font-family: verdana, arial, helvetica, sans-serif;
5
- font-size: 13px;
6
- line-height: 18px;
7
5
  }
8
6
 
9
- pre {
10
- background-color: #eee;
11
- padding: 10px;
12
- font-size: 11px;
13
- }
14
-
15
- a { color: #000; }
16
- a:visited { color: #666; }
17
- a:hover { color: #fff; background-color:#000; }
18
-
19
-
20
7
  /* content div containing form or list */
21
8
  .content {
22
9
  }
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.16
7
- date: 2006-04-28 00:00:00 -05:00
6
+ version: 0.0.17
7
+ date: 2006-05-04 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
  - .
@@ -33,8 +33,10 @@ files:
33
33
  - templates/mvpreview.js
34
34
  - templates/helper.rb
35
35
  - templates/layout.rhtml
36
+ - templates/sidebox.css
36
37
  - templates/list_head_scaffold.rhtml
37
38
  - templates/functional_test.rb
39
+ - templates/color-scheme.css
38
40
  - templates/show_scaffold.rhtml
39
41
  - templates/style.css
40
42
  - templates/list_line_scaffold.rhtml