masterview_generator 0.0.11 → 0.0.12
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/masterview_generator.rb +7 -5
- data/templates/form_scaffold.rhtml +2 -2
- data/templates/list_line_scaffold.rhtml +3 -3
- data/templates/masterview.rhtml +41 -40
- data/templates/show_scaffold.rhtml +2 -2
- data/templates/style.css +81 -3
- metadata +9 -9
data/masterview_generator.rb
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
class ScaffoldingSandbox
|
2
2
|
include ActionView::Helpers::ActiveRecordHelper
|
3
3
|
|
4
|
-
attr_accessor :singular_name, :suffix, :model_instance
|
4
|
+
attr_accessor :singular_name, :controller_file_name, :controller_view_dir_name, :suffix, :model_instance
|
5
5
|
|
6
6
|
def sandbox_binding
|
7
7
|
binding
|
8
8
|
end
|
9
9
|
|
10
10
|
def default_input_block
|
11
|
-
Proc.new { |record, column| "<
|
11
|
+
Proc.new { |record, column| "<div class=\"record form_record\"><div class=\"label form_label\"><label for=\"#{record}_#{column.name}\">#{column.human_name}:</label></div><div class=\"field form_field\">#{input(record, column.name)}</div></div>\n" }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
class ListHeadScaffoldingSandbox < ScaffoldingSandbox
|
16
16
|
def default_input_block
|
17
|
-
Proc.new { |record, column| "<th>#{column.human_name}</th>" }
|
17
|
+
Proc.new { |record, column| "<th class=\"list_heading list_heading_#{column.name}\">#{column.human_name}</th>" }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
class ListLineScaffoldingSandbox < ScaffoldingSandbox
|
22
22
|
def default_input_block
|
23
|
-
Proc.new { |record, column| "<td class=\"
|
23
|
+
Proc.new { |record, column| "<td class=\"list_data list_data_#{column.name}\" mv:content=\"h #{record}.send(:#{column.name})\">#{record} #{column.human_name}</td>" }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
class ShowScaffoldingSandbox < ScaffoldingSandbox
|
28
28
|
def default_input_block
|
29
|
-
Proc.new { |record, column| "<
|
29
|
+
Proc.new { |record, column| "<div class=\"record show_record\"><div class=\"label show_label\"><label>#{column.human_name}:</label></div><div class=\"field show_field\" mv:content=\"h @#{record}.send(:#{column.name})\">#{record} #{column.human_name}</div></div>\n" }
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -253,6 +253,8 @@ class MasterviewGenerator < Rails::Generator::NamedBase
|
|
253
253
|
def create_multi_sandbox( sandbox_class_name )
|
254
254
|
sandbox = eval("#{sandbox_class_name}.new")
|
255
255
|
sandbox.singular_name = singular_name
|
256
|
+
sandbox.controller_file_name = controller_file_name
|
257
|
+
sandbox.controller_view_dir_name = controller_view_dir_name
|
256
258
|
begin
|
257
259
|
sandbox.model_instance = model_instance
|
258
260
|
sandbox.instance_variable_set("@#{singular_name}", sandbox.model_instance)
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<
|
1
|
+
<div class="<%= singular_name %>_form_div">
|
2
2
|
<%= all_input_tags(@model_instance, @singular_name, {}) %>
|
3
|
-
</
|
3
|
+
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
<%= all_input_tags(@model_instance, @singular_name, {}) %>
|
3
|
-
<td class="operation"><a href="javascript:mvpreview.showOneSection('<%=
|
4
|
-
<td class="operation"><a href="javascript:mvpreview.showOneSection('<%=
|
5
|
-
<td class="operation"><a href="javascript:mvpreview.showOneSection('<%=
|
3
|
+
<td class="operation list_operation"><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_show');" mv:link_to=":action => 'show<%= suffix %>', :id => <%= singular_name %>">Show</a></td>
|
4
|
+
<td class="operation list_operation"><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_edit');" mv:link_to=":action => 'edit<%= suffix %>', :id => <%= singular_name %>">Edit</a></td>
|
5
|
+
<td class="operation list_operation"><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_destroy');" mv:link_to=":action => 'destroy', :id => <%= singular_name %>">Destroy</a></td>
|
6
6
|
|
data/templates/masterview.rhtml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<html mv:generate="layouts/<%=
|
1
|
+
<html mv:generate="layouts/<%= controller_file_name %>.rhtml">
|
2
2
|
<head>
|
3
3
|
<title><%= controller_class_name %>: {{{= controller.action_name }}}</title>
|
4
4
|
<link rel="stylesheet" type="text/css" href="../../../public/stylesheets/scaffold.css" mv:stylesheet_link="scaffold"/>
|
@@ -14,17 +14,17 @@
|
|
14
14
|
messages
|
15
15
|
</div>
|
16
16
|
|
17
|
-
|
18
|
-
<div id="<%=
|
19
|
-
<div id="<%=
|
20
|
-
<div class="<%=
|
17
|
+
<div class="main">
|
18
|
+
<div id="<%= controller_file_name %>_content" mv:replace="@content_for_layout">
|
19
|
+
<div id="<%= controller_file_name %>_new" mv:generate="<%= controller_view_dir_name %>/new.rhtml" mv:preview="showOne">
|
20
|
+
<div class="<%= controller_file_name %>_new sidebar">
|
21
21
|
<h1>Tasks:</h1>
|
22
22
|
<ul>
|
23
|
-
<li><a href="javascript:mvpreview.showOneSection('<%=
|
23
|
+
<li><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_list');" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
|
24
24
|
</ul>
|
25
25
|
</div>
|
26
26
|
|
27
|
-
<div class="<%=
|
27
|
+
<div class="<%= controller_file_name %>_new content">
|
28
28
|
<h1><%= plural_name.capitalize %></h1>
|
29
29
|
|
30
30
|
<form mv:form=":action => 'new'">
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<div class="form">
|
33
33
|
<h2>Creating <%= singular_name %></h2>
|
34
34
|
|
35
|
-
<div id="<%=
|
35
|
+
<div id="<%= controller_file_name %>_form" mv:gen_render=":partial => '<%= controller_view_dir_name %>/form'">
|
36
36
|
<div class="error_messages" mv:replace="error_messages_for :<%= singular_name %>">
|
37
37
|
error messages
|
38
38
|
</div>
|
@@ -43,8 +43,8 @@
|
|
43
43
|
</div>
|
44
44
|
|
45
45
|
<br/>
|
46
|
-
<div class="<%=
|
47
|
-
<input type="submit" value="OK" class="primary" mv:submit="" onclick="javascript:mvpreview.showOneSection('<%=
|
46
|
+
<div class="<%= controller_file_name %>_new operations">
|
47
|
+
<input type="submit" value="OK" class="primary" mv:submit="" onclick="javascript:mvpreview.showOneSection('<%= controller_file_name %>_list');return false;"/>
|
48
48
|
<input type="button" value="Cancel" style="width: auto;" onclick="window.location.href = '{{{= url_for :action => %q{list} }}}';" />
|
49
49
|
</div>
|
50
50
|
|
@@ -55,29 +55,29 @@
|
|
55
55
|
|
56
56
|
|
57
57
|
|
58
|
-
<div id="<%=
|
59
|
-
<div class="<%=
|
58
|
+
<div id="<%= controller_file_name %>_edit" mv:generate="<%= controller_view_dir_name %>/edit.rhtml" mv:preview="showOne">
|
59
|
+
<div class="<%= controller_file_name %>_edit sidebar">
|
60
60
|
<h1>Tasks:</h1>
|
61
61
|
<ul>
|
62
|
-
<li><a href="javascript:mvpreview.showOneSection('<%=
|
62
|
+
<li><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_list');" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
|
63
63
|
</ul>
|
64
64
|
</div>
|
65
65
|
|
66
|
-
<div class="<%=
|
66
|
+
<div class="<%= controller_file_name %>_edit content">
|
67
67
|
<h1><%= plural_name.capitalize %></h1>
|
68
68
|
|
69
69
|
<form mv:form=":action => 'edit', :id => @<%=singular_name%>.id">
|
70
70
|
|
71
71
|
<div class="form">
|
72
72
|
<h2>Editing <%= singular_name %></h2>
|
73
|
-
<div mv:replace="render :partial => 'form'" mv:preview="copyOf:<%=
|
74
|
-
copyOf:<%=
|
73
|
+
<div mv:replace="render :partial => 'form'" mv:preview="copyOf:<%= controller_file_name %>_form">
|
74
|
+
copyOf:<%= controller_file_name %>_form
|
75
75
|
</div>
|
76
76
|
</div>
|
77
77
|
|
78
78
|
<br/>
|
79
|
-
<div class="<%=
|
80
|
-
<input type="submit" value="OK" class="primary" mv:submit="" onclick="javascript:mvpreview.showOneSection('<%=
|
79
|
+
<div class="<%= controller_file_name %>_edit operations">
|
80
|
+
<input type="submit" value="OK" class="primary" mv:submit="" onclick="javascript:mvpreview.showOneSection('<%= controller_file_name %>_list');return false;"/>
|
81
81
|
<input type="button" value="Cancel" style="width: auto;" onclick="window.location.href = '{{{= url_for :action => %q{list} }}}';" /> </div>
|
82
82
|
|
83
83
|
</form>
|
@@ -86,23 +86,23 @@
|
|
86
86
|
|
87
87
|
|
88
88
|
|
89
|
-
<div id="<%=
|
90
|
-
<div class="<%=
|
89
|
+
<div id="<%= controller_file_name %>_list" mv:generate="<%= controller_view_dir_name %>/list.rhtml" mv:preview="showOne">
|
90
|
+
<div class="<%= controller_file_name %>_list sidebar">
|
91
91
|
<h1>Tasks:</h1>
|
92
92
|
<ul>
|
93
|
-
<li><a href="javascript:mvpreview.showOneSection('<%=
|
93
|
+
<li><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_new');" mv:link_to=":action => 'new<%= suffix %>'">Create new <%= singular_name %></a></li>
|
94
94
|
</ul>
|
95
95
|
</div>
|
96
96
|
|
97
|
-
<div class="<%=
|
97
|
+
<div class="<%= controller_file_name %>_list content">
|
98
98
|
<h1><%= plural_name.capitalize %></h1>
|
99
99
|
|
100
100
|
<div class="list">
|
101
|
-
<table border="1" class="<%=
|
101
|
+
<table border="1" class="<%= controller_file_name %>_list_table" cellpadding="5">
|
102
102
|
<tr>
|
103
103
|
<%= list_head_inclusion %>
|
104
104
|
</tr>
|
105
|
-
<tr mv:gen_render=":partial => '<%=
|
105
|
+
<tr mv:gen_render=":partial => '<%= controller_view_dir_name %>/<%= singular_name %>', :collection => @<%= plural_name %>">
|
106
106
|
<%= list_line_inclusion %>
|
107
107
|
</tr>
|
108
108
|
</table>
|
@@ -116,35 +116,35 @@
|
|
116
116
|
|
117
117
|
|
118
118
|
|
119
|
-
<div id="<%=
|
120
|
-
<div class="<%=
|
119
|
+
<div id="<%= controller_file_name %>_show" mv:generate="<%= controller_view_dir_name %>/show.rhtml" mv:preview="showOne">
|
120
|
+
<div class="<%= controller_file_name %>_show sidebar">
|
121
121
|
<h1>Tasks:</h1>
|
122
122
|
<ul>
|
123
|
-
<li><a href="javascript:mvpreview.showOneSection('<%=
|
124
|
-
<li><a href="javascript:mvpreview.showOneSection('<%=
|
123
|
+
<li><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_list');" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
|
124
|
+
<li><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_edit');" mv:link_to=":action => 'edit<%= suffix %>', :id => @<%= singular_name %>.id">Edit this <%= singular_name %></a></li>
|
125
125
|
</ul>
|
126
126
|
</div>
|
127
127
|
|
128
|
-
<div class="<%=
|
128
|
+
<div class="<%= controller_file_name %>_show content">
|
129
129
|
<h1><%= plural_name.capitalize %></h1>
|
130
130
|
|
131
|
-
<div id="<%=
|
131
|
+
<div id="<%= controller_file_name %>_show_partial" class="form" mv:gen_render=":partial => '<%= controller_view_dir_name %>/show'">
|
132
132
|
<%= show_inclusion %>
|
133
133
|
</div>
|
134
134
|
|
135
135
|
</div>
|
136
136
|
</div>
|
137
137
|
|
138
|
-
<div id="<%=
|
139
|
-
<div class="<%=
|
138
|
+
<div id="<%= controller_file_name %>_destroy" mv:generate="<%= controller_view_dir_name %>/destroy.rhtml" mv:preview="showOne">
|
139
|
+
<div class="<%= controller_file_name %>_destroy sidebar">
|
140
140
|
<h1>Tasks:</h1>
|
141
141
|
<ul>
|
142
|
-
<li><a href="javascript:mvpreview.showOneSection('<%=
|
143
|
-
<li><a href="javascript:mvpreview.showOneSection('<%=
|
142
|
+
<li><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_list');" mv:link_to=":action => 'list<%= suffix %>'">Back to overview</a></li>
|
143
|
+
<li><a href="javascript:mvpreview.showOneSection('<%= controller_file_name %>_show');" mv:link_to=":action => 'show<%= suffix %>', :id => @<%= singular_name %>.id">Show this <%= singular_name %></a></li>
|
144
144
|
</ul>
|
145
145
|
</div>
|
146
146
|
|
147
|
-
<div class="<%=
|
147
|
+
<div class="<%= controller_file_name %>_destroy content">
|
148
148
|
<h1><%= plural_name.capitalize %></h1>
|
149
149
|
|
150
150
|
<div class="error_messages" mv:replace="error_messages_for :<%= singular_name %>">
|
@@ -154,24 +154,25 @@
|
|
154
154
|
<div class="messages">Are you sure you want to delete this item?</div>
|
155
155
|
<br/>
|
156
156
|
<form mv:form=":action => 'destroy', :id => @<%= singular_name %>.id">
|
157
|
-
<div mv:replace="render :partial => 'show'" mv:preview="copyOf:<%=
|
158
|
-
copyOf:<%=
|
157
|
+
<div mv:replace="render :partial => 'show'" mv:preview="copyOf:<%= controller_file_name %>_show_partial">
|
158
|
+
copyOf:<%= controller_file_name %>_show_partial
|
159
159
|
</div>
|
160
160
|
|
161
161
|
<br/>
|
162
|
-
<div class="<%=
|
163
|
-
<input type="submit" value="Delete" mv:submit="" onclick="javascript:mvpreview.showOneSection('<%=
|
162
|
+
<div class="<%= controller_file_name %>_edit operations">
|
163
|
+
<input type="submit" value="Delete" mv:submit="" onclick="javascript:mvpreview.showOneSection('<%= controller_file_name %>_list');return false;"/>
|
164
164
|
<input type="button" value="Cancel" style="width: auto;" onclick="window.location.href = '{{{= url_for :action => %q{list} }}}';" />
|
165
165
|
</div>
|
166
166
|
</form>
|
167
167
|
</div>
|
168
168
|
</div>
|
169
|
+
</div>
|
169
170
|
</div>
|
170
171
|
|
171
172
|
<script type="text/javascript" mv:replace="" src="../../../public/javascripts/mvpreview.js"></script>
|
172
173
|
<script type="text/javascript" mv:replace="">
|
173
174
|
mvpreview.copySections();
|
174
|
-
mvpreview.showOneSection('<%=
|
175
|
+
mvpreview.showOneSection('<%= controller_file_name %>_list');
|
175
176
|
</script>
|
176
177
|
|
177
178
|
</body>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<
|
1
|
+
<div class="<%= singular_name %>_show_div">
|
2
2
|
<%= all_input_tags(@model_instance, @singular_name, {}) %>
|
3
|
-
</
|
3
|
+
</div>
|
data/templates/style.css
CHANGED
@@ -16,19 +16,97 @@ a { color: #000; }
|
|
16
16
|
a:visited { color: #666; }
|
17
17
|
a:hover { color: #fff; background-color:#000; }
|
18
18
|
|
19
|
+
|
20
|
+
/* content div containing form or list */
|
21
|
+
.content {
|
22
|
+
}
|
23
|
+
|
24
|
+
/* all data fields whether in show or form */
|
25
|
+
.field {
|
26
|
+
}
|
27
|
+
|
19
28
|
.fieldWithErrors {
|
20
29
|
padding: 2px;
|
21
30
|
background-color: red;
|
22
31
|
display: table;
|
23
32
|
}
|
24
33
|
|
25
|
-
|
26
|
-
|
34
|
+
/* data fields in form */
|
35
|
+
.form_field {
|
36
|
+
}
|
37
|
+
|
38
|
+
/* label in form */
|
39
|
+
.form_label {
|
40
|
+
}
|
41
|
+
|
42
|
+
/* each record in form */
|
43
|
+
.form_record {
|
27
44
|
}
|
28
45
|
|
46
|
+
/* all labels whether in show or form */
|
29
47
|
.label {
|
30
48
|
text-align: right;
|
31
|
-
|
49
|
+
float: left;
|
50
|
+
display: inline;
|
51
|
+
padding-right: 10px;
|
52
|
+
font-weight: bold;
|
53
|
+
width: 120px;
|
54
|
+
}
|
55
|
+
|
56
|
+
/* list div containing table */
|
57
|
+
.list {
|
58
|
+
}
|
59
|
+
|
60
|
+
/* list data field */
|
61
|
+
.list_data {
|
62
|
+
}
|
63
|
+
|
64
|
+
/* list heading */
|
65
|
+
.list_heading {
|
66
|
+
}
|
67
|
+
|
68
|
+
/* list operation - action links */
|
69
|
+
.list_operation {
|
70
|
+
}
|
71
|
+
|
72
|
+
/* main div top level div next to messages */
|
73
|
+
.main {
|
74
|
+
}
|
75
|
+
|
76
|
+
/* flash messages at top of screens, top level div, informational */
|
77
|
+
.messages {
|
78
|
+
color: green;
|
79
|
+
}
|
80
|
+
|
81
|
+
/* links that invoke actions on any page */
|
82
|
+
.operation {
|
83
|
+
}
|
84
|
+
|
85
|
+
/* operations - div containing buttons for form */
|
86
|
+
.operations {
|
87
|
+
}
|
88
|
+
|
89
|
+
/* each record whether on show or form */
|
90
|
+
.record {
|
91
|
+
margin-bottom: 10px;
|
92
|
+
clear: left;
|
93
|
+
}
|
94
|
+
|
95
|
+
/* data field on show */
|
96
|
+
.show_field {
|
97
|
+
}
|
98
|
+
|
99
|
+
/* labels on show */
|
100
|
+
.show_label {
|
101
|
+
}
|
102
|
+
|
103
|
+
/* records on show */
|
104
|
+
.show_record {
|
105
|
+
}
|
106
|
+
|
107
|
+
/* sidebar div containing navigation options for page */
|
108
|
+
.sidebar {
|
109
|
+
}
|
32
110
|
|
33
111
|
#ErrorExplanation {
|
34
112
|
width: 400px;
|
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.
|
7
|
-
date: 2006-04-
|
6
|
+
version: 0.0.12
|
7
|
+
date: 2006-04-24 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
|
- .
|
@@ -30,19 +30,19 @@ authors:
|
|
30
30
|
files:
|
31
31
|
- masterview_generator.rb
|
32
32
|
- templates/controller.rb
|
33
|
-
- templates/
|
34
|
-
- templates/form_scaffold.rhtml
|
35
|
-
- templates/functional_test.rb
|
33
|
+
- templates/mvpreview.js
|
36
34
|
- templates/helper.rb
|
37
35
|
- templates/layout.rhtml
|
38
36
|
- templates/list_head_scaffold.rhtml
|
39
|
-
- templates/
|
40
|
-
- templates/masterview.rhtml
|
41
|
-
- templates/mvpreview.js
|
37
|
+
- templates/functional_test.rb
|
42
38
|
- templates/show_scaffold.rhtml
|
43
39
|
- templates/style.css
|
44
|
-
-
|
40
|
+
- templates/list_line_scaffold.rhtml
|
41
|
+
- templates/form_scaffold.rhtml
|
42
|
+
- templates/masterview.rhtml
|
43
|
+
- templates/fields_scaffold.rhtml
|
45
44
|
- Rakefile
|
45
|
+
- USAGE
|
46
46
|
test_files: []
|
47
47
|
|
48
48
|
rdoc_options: []
|