ajax_scaffold_generator 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -20
- data/README +28 -28
- data/ajax_scaffold_generator.rb +123 -123
- data/templates/controller.rb +61 -61
- data/templates/form.rhtml +4 -4
- data/templates/functional_test.rb +88 -88
- data/templates/helper.rb +12 -12
- data/templates/layout.rhtml +15 -15
- data/templates/partial_item.rhtml +24 -24
- data/templates/script.js +425 -327
- data/templates/style.css +345 -324
- data/templates/view_edit.rhtml +1 -1
- data/templates/view_index.rhtml +1 -1
- data/templates/view_list.rhtml +57 -52
- data/templates/view_new.rhtml +2 -1
- metadata +5 -3
data/templates/helper.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
module <%= controller_class_name %>Helper
|
2
|
-
|
3
|
-
def num_columns
|
4
|
-
<%= model_name %>.content_columns.length + 1
|
5
|
-
end
|
6
|
-
|
7
|
-
# This can be moved into application_helper.rb
|
8
|
-
def loading_indicator_tag(scope,id)
|
9
|
-
"<img src=\"/images/indicator.gif\" style=\"display: none;\" id=\"#{scope}-#{id}-loading-indicator\" alt=\"loading indicator\" class=\"loading-indicator\" />"
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
1
|
+
module <%= controller_class_name %>Helper
|
2
|
+
|
3
|
+
def num_columns
|
4
|
+
<%= model_name %>.content_columns.length + 1
|
5
|
+
end
|
6
|
+
|
7
|
+
# This can be moved into application_helper.rb
|
8
|
+
def loading_indicator_tag(scope,id)
|
9
|
+
"<img src=\"/images/indicator.gif\" style=\"display: none;\" id=\"#{scope}-#{id}-loading-indicator\" alt=\"loading indicator\" class=\"loading-indicator\" />"
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
data/templates/layout.rhtml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"DTD/xhtml1-strict.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
5
|
-
<head>
|
6
|
-
<title><%= Inflector.titleize(plural_name) %></title>
|
7
|
-
<%%= stylesheet_link_tag 'ajax_scaffold', :media => 'all' %>
|
8
|
-
<%%= javascript_include_tag 'prototype', 'effects', 'rico_corner', 'ajax_scaffold' %>
|
9
|
-
</head>
|
10
|
-
<body>
|
11
|
-
|
12
|
-
<%%= @content_for_layout %>
|
13
|
-
|
14
|
-
</body>
|
15
|
-
</html>
|
1
|
+
<!DOCTYPE html
|
2
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
5
|
+
<head>
|
6
|
+
<title><%= Inflector.titleize(plural_name) %></title>
|
7
|
+
<%%= stylesheet_link_tag 'ajax_scaffold', :media => 'all' %>
|
8
|
+
<%%= javascript_include_tag 'prototype', 'effects', 'rico_corner', 'ajax_scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<%%= @content_for_layout %>
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -1,25 +1,25 @@
|
|
1
|
-
<tr id="view-<%= singular_name %>-<%%= <%= singular_name %>.id %>"
|
2
|
-
<%% for column in <%= model_name %>.content_columns %>
|
3
|
-
<td><%%=h <%= singular_name %>.send(column.name) %> </td>
|
4
|
-
<%% end %>
|
5
|
-
<td class="actions">
|
6
|
-
<div>
|
7
|
-
<%%= loading_indicator_tag '<%= singular_name %>', "edit-#{<%= singular_name %>.id}" %>
|
8
|
-
<%%= link_to_remote "Edit",
|
9
|
-
:url => { :controller => '<%= controller_name %>', :action => 'edit', :id => <%= singular_name %> },
|
10
|
-
:loading => "AjaxScaffold.editOnLoading(request,'<%= singular_name %>', #{<%= singular_name %>.id});",
|
11
|
-
:success => "AjaxScaffold.editOnSuccess(request,'<%= singular_name %>', #{<%= singular_name %>.id});",
|
12
|
-
:failure => "AjaxScaffold.editOnFailure(request,'<%= singular_name %>', #{<%= singular_name %>.id});",
|
13
|
-
:complete => "AjaxScaffold.editOnComplete(request,'<%= singular_name %>', #{<%= singular_name %>.id});",
|
14
|
-
:post => true; %>
|
15
|
-
<%%= link_to_remote "Delete",
|
16
|
-
:url => { :controller => '<%= controller_name %>',:action => 'destroy', :id => <%= singular_name %> },
|
17
|
-
:confirm => 'Are you sure?',
|
18
|
-
:loading => "AjaxScaffold.deleteOnLoading('<%= singular_name %>', #{<%= singular_name %>.id});",
|
19
|
-
:success => "AjaxScaffold.deleteOnSuccess('<%= singular_name %>', #{<%= singular_name %>.id});",
|
20
|
-
:failure => "AjaxScaffold.deleteOnFailure('<%= singular_name %>', #{<%= singular_name %>.id});",
|
21
|
-
:complete => "AjaxScaffold.deleteOnComplete('<%= singular_name %>', #{<%= singular_name %>.id});",
|
22
|
-
:post => true; %>
|
23
|
-
</div>
|
24
|
-
</td>
|
1
|
+
<tr id="view-<%= singular_name %>-<%%= <%= singular_name %>.id %>" <%%= "style=\"display: none;\"" if hidden %>>
|
2
|
+
<%% for column in <%= model_name %>.content_columns %>
|
3
|
+
<td><%%=h <%= singular_name %>.send(column.name) %> </td>
|
4
|
+
<%% end %>
|
5
|
+
<td class="actions">
|
6
|
+
<div>
|
7
|
+
<%%= loading_indicator_tag '<%= singular_name %>', "edit-#{<%= singular_name %>.id}" %>
|
8
|
+
<%%= link_to_remote "Edit",
|
9
|
+
:url => { :controller => '<%= controller_name %>', :action => 'edit', :id => <%= singular_name %> },
|
10
|
+
:loading => "AjaxScaffold.editOnLoading(request,'<%= singular_name %>', #{<%= singular_name %>.id});",
|
11
|
+
:success => "AjaxScaffold.editOnSuccess(request,'<%= singular_name %>', #{<%= singular_name %>.id});",
|
12
|
+
:failure => "AjaxScaffold.editOnFailure(request,'<%= singular_name %>', #{<%= singular_name %>.id});",
|
13
|
+
:complete => "AjaxScaffold.editOnComplete(request,'<%= singular_name %>', #{<%= singular_name %>.id});",
|
14
|
+
:post => true; %>
|
15
|
+
<%%= link_to_remote "Delete",
|
16
|
+
:url => { :controller => '<%= controller_name %>',:action => 'destroy', :id => <%= singular_name %> },
|
17
|
+
:confirm => 'Are you sure?',
|
18
|
+
:loading => "AjaxScaffold.deleteOnLoading('<%= singular_name %>', #{<%= singular_name %>.id});",
|
19
|
+
:success => "AjaxScaffold.deleteOnSuccess('<%= singular_name %>', #{<%= singular_name %>.id});",
|
20
|
+
:failure => "AjaxScaffold.deleteOnFailure('<%= singular_name %>', #{<%= singular_name %>.id});",
|
21
|
+
:complete => "AjaxScaffold.deleteOnComplete('<%= singular_name %>', #{<%= singular_name %>.id});",
|
22
|
+
:post => true; %>
|
23
|
+
</div>
|
24
|
+
</td>
|
25
25
|
</tr>
|