ajax_scaffold_generator 3.0.1 → 3.0.2
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/ajax_scaffold_generator.rb +2 -2
- data/templates/ajax_scaffold.css +9 -0
- data/templates/ajax_scaffold_helper.rb +6 -1
- data/templates/arrow_down.gif +0 -0
- data/templates/arrow_up.gif +0 -0
- data/templates/controller.rb +1 -1
- data/templates/indicator-small.gif +0 -0
- data/templates/lib_ajax_scaffold_util.rb +4 -0
- data/templates/partial_column_headings.rhtml +5 -4
- data/templates/partial_item.rhtml +1 -1
- data/templates/partial_new_edit.rhtml +3 -3
- data/templates/partial_pagination_links.rhtml +6 -4
- data/templates/view_component.rhtml +1 -1
- data/templates/view_list.rhtml +1 -1
- metadata +3 -2
data/ajax_scaffold_generator.rb
CHANGED
@@ -38,6 +38,7 @@ end
|
|
38
38
|
class AjaxScaffoldGenerator < ScaffoldGenerator
|
39
39
|
|
40
40
|
def manifest
|
41
|
+
|
41
42
|
record do |m|
|
42
43
|
|
43
44
|
# Check for class naming collisions.
|
@@ -125,7 +126,6 @@ class AjaxScaffoldGenerator < ScaffoldGenerator
|
|
125
126
|
|
126
127
|
m.template 'ajax_scaffold_helper.rb',
|
127
128
|
File.join('app/helpers',
|
128
|
-
controller_class_path,
|
129
129
|
"ajax_scaffold_helper.rb")
|
130
130
|
|
131
131
|
# Layout and stylesheet.
|
@@ -174,7 +174,7 @@ class AjaxScaffoldGenerator < ScaffoldGenerator
|
|
174
174
|
end
|
175
175
|
|
176
176
|
def scaffold_images
|
177
|
-
%w( indicator.gif add.gif error.gif warning.gif information.gif arrow_down.gif arrow_up.gif )
|
177
|
+
%w( indicator.gif indicator-small.gif add.gif error.gif warning.gif information.gif arrow_down.gif arrow_up.gif )
|
178
178
|
end
|
179
179
|
|
180
180
|
def scaffold_javascripts
|
data/templates/ajax_scaffold.css
CHANGED
@@ -91,6 +91,10 @@ display: block;
|
|
91
91
|
background: #000;
|
92
92
|
}
|
93
93
|
|
94
|
+
.ajax-scaffold th.sorted {
|
95
|
+
background: #333;
|
96
|
+
}
|
97
|
+
|
94
98
|
.ajax-scaffold th.asc a,
|
95
99
|
.ajax-scaffold th.asc a:hover {
|
96
100
|
background: #333 url(/images/arrow_up.gif) right 50% no-repeat;
|
@@ -101,6 +105,11 @@ background: #333 url(/images/arrow_up.gif) right 50% no-repeat;
|
|
101
105
|
background: #333 url(/images/arrow_down.gif) right 50% no-repeat;
|
102
106
|
}
|
103
107
|
|
108
|
+
.ajax-scaffold th.loading a,
|
109
|
+
.ajax-scaffold th.loading a:hover {
|
110
|
+
background: #333 url(/images/indicator-small.gif) right 50% no-repeat;
|
111
|
+
}
|
112
|
+
|
104
113
|
/* Table Body Styling
|
105
114
|
============================= */
|
106
115
|
|
@@ -46,7 +46,8 @@ module AjaxScaffoldHelper
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def loading_indicator_tag(options)
|
49
|
-
|
49
|
+
image_filename = "indicator.gif"
|
50
|
+
"<img src=\"/images/#{image_filename}\" style=\"display: none;\" id=\"#{loading_indicator_id(options)}\" alt=\"loading indicator\" class=\"loading-indicator\" />"
|
50
51
|
end
|
51
52
|
|
52
53
|
# The following are a bunch of helper methods to produce the common scaffold view id's
|
@@ -55,6 +56,10 @@ module AjaxScaffoldHelper
|
|
55
56
|
"#{options[:scaffold_id]}-content"
|
56
57
|
end
|
57
58
|
|
59
|
+
def scaffold_column_header_id(options)
|
60
|
+
"#{options[:scaffold_id]}-#{options[:column_name]}"
|
61
|
+
end
|
62
|
+
|
58
63
|
def scaffold_tbody_id(options)
|
59
64
|
"#{options[:scaffold_id]}-tbody"
|
60
65
|
end
|
data/templates/arrow_down.gif
CHANGED
Binary file
|
data/templates/arrow_up.gif
CHANGED
Binary file
|
data/templates/controller.rb
CHANGED
@@ -41,7 +41,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
41
41
|
update_params :default_scaffold_id => "<%= singular_name %>", :default_sort => "id", :default_sort_direction => "asc"
|
42
42
|
|
43
43
|
@sort_by = session[params[:scaffold_id]][:sort] + " " + session[params[:scaffold_id]][:sort_direction]
|
44
|
-
@paginator, @<%= plural_name %> = paginate(:<%= plural_name %>, :order_by => @sort_by, :per_page =>
|
44
|
+
@paginator, @<%= plural_name %> = paginate(:<%= plural_name %>, :order_by => @sort_by, :per_page => default_per_page)
|
45
45
|
|
46
46
|
render :action => "component", :layout => false
|
47
47
|
end
|
Binary file
|
@@ -1,11 +1,12 @@
|
|
1
1
|
<%% current_sort = session[params[:scaffold_id]][:sort] %>
|
2
2
|
<%% current_sort_direction = session[params[:scaffold_id]][:sort_direction] %>
|
3
3
|
<%% for column in <%= model_name %>.content_columns %>
|
4
|
-
|
5
|
-
<%%
|
6
|
-
|
7
|
-
|
4
|
+
<%% sort_direction = current_sort == column.name && current_sort_direction == "asc" ? "desc" : "asc" %>
|
5
|
+
<%% sort_params = params.merge(:controller => '<%= controller_file_name %>', :action => 'component_update', :sort => column.name, :sort_direction => sort_direction, :page => 1) %>
|
6
|
+
<th id="<%%= scaffold_column_header_id(sort_params.merge(:column_name => column.name)) %>" <%%= "class=\"sorted #{current_sort_direction}\"" if column.name == current_sort %>>
|
7
|
+
<%%= link_to_remote column.human_name,
|
8
8
|
{ :url => sort_params,
|
9
|
+
:loading => "Element.addClassName('#{scaffold_column_header_id(sort_params.merge(:column_name => column.name))}','loading');",
|
9
10
|
:update => scaffold_content_id(sort_params) },
|
10
11
|
{ :href => url_for(sort_params) } %></th>
|
11
12
|
<%% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%% # The following is used when the browser doesn't have javascript enabled %>
|
2
2
|
<%% classAttr = cycle("", "class=\"even\"") %>
|
3
|
-
<%% @options = params.merge(:controller => '<%=
|
3
|
+
<%% @options = params.merge(:controller => '<%= controller_file_name %>', :action => "view", :id => <%= singular_name %>.id) %>
|
4
4
|
|
5
5
|
<tr <%%= classAttr %> id="<%%= element_row_id(@options) %>" <%%= "style=\"display: none;\"" if hidden %>>
|
6
6
|
<%% for column in <%= model_name %>.content_columns %>
|
@@ -5,9 +5,9 @@
|
|
5
5
|
<tr id="<%%= element_row_id(@options) %>" class="<%%= @options[:action] %>" <%%= "style=\"display:none;\"" if request.xhr? %>>
|
6
6
|
<td id="<%%= element_cell_id(@options) %>" colspan="<%%= num_columns %>">
|
7
7
|
|
8
|
-
<%%= form_remote_tag :url => @options.merge(:controller => '<%=
|
8
|
+
<%%= form_remote_tag :url => @options.merge(:controller => '<%= controller_file_name %>'),
|
9
9
|
:loading => "Element.show('#{loading_indicator_id(@options)}');",
|
10
|
-
:html => { :href => url_for(@options.merge(:controller => '<%=
|
10
|
+
:html => { :href => url_for(@options.merge(:controller => '<%= controller_file_name %>')),
|
11
11
|
:id => element_form_id(@options) } %>
|
12
12
|
|
13
13
|
<%%= hidden_field_tag "scaffold_id", @options[:scaffold_id] %>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
<%% on_cancel += "AjaxScaffold.displayMessageIfEmpty('#{scaffold_tbody_id(@options)}','#{empty_message_id(@options)}');" if @options[:action] == "create" %>
|
31
31
|
<%% end %>
|
32
32
|
<%%= link_to_function "Cancel", on_cancel,
|
33
|
-
:href => url_for(:controller => '<%=
|
33
|
+
:href => url_for(:controller => '<%= controller_file_name %>', :action => 'return_to_main') %>
|
34
34
|
<%%= loading_indicator_tag @options %>
|
35
35
|
</p>
|
36
36
|
<%%= end_form_tag %>
|
@@ -1,14 +1,16 @@
|
|
1
|
-
<%% pagination_params = params.merge(:controller => '<%=
|
1
|
+
<%% pagination_params = params.merge(:controller => '<%= controller_file_name %>', :action => 'component_update') %>
|
2
|
+
<%% indicator_params = { :controller => '<%= controller_file_name %>', :action => 'pagination' } %>
|
3
|
+
<%%= loading_indicator_tag indicator_params %>
|
2
4
|
<%%= link_to_remote('Previous',
|
3
5
|
{ :url => pagination_params.merge(:page => paginator.current.previous),
|
6
|
+
:loading => "Element.show('#{loading_indicator_id(indicator_params)}');",
|
4
7
|
:update => scaffold_content_id(pagination_params) },
|
5
8
|
{ :href => url_for(pagination_params.merge(:page => paginator.current.previous)),
|
6
9
|
:class => "previous"}) if @paginator.current.previous %>
|
7
|
-
|
8
|
-
<%%= pagination_ajax_links @paginator, pagination_params %>
|
9
|
-
</span>
|
10
|
+
<%%= pagination_ajax_links @paginator, pagination_params %>
|
10
11
|
<%%= link_to_remote('Next',
|
11
12
|
{ :url => pagination_params.merge(:page => paginator.current.next),
|
13
|
+
:loading => "Element.show('#{loading_indicator_id(indicator_params)}');",
|
12
14
|
:update => scaffold_content_id(pagination_params) },
|
13
15
|
{ :href => url_for(pagination_params.merge(:page => paginator.current.next)),
|
14
16
|
:class => "next"}) if @paginator.current.next %>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<%% end %>
|
5
5
|
<div class="ajax-scaffold-header">
|
6
6
|
<div class="actions">
|
7
|
-
<%% new_params = params.merge(:controller => '<%=
|
7
|
+
<%% new_params = params.merge(:controller => '<%= controller_file_name %>', :action => 'new') %>
|
8
8
|
<%%= loading_indicator_tag(new_params) %>
|
9
9
|
<%%= link_to_remote "Create New",
|
10
10
|
{ :url => new_params,
|
data/templates/view_list.rhtml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<%%= render_component :controller => '<%=
|
1
|
+
<%%= render_component :controller => '<%= controller_file_path %>', :action => 'component', :params => params %>
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ajax_scaffold_generator
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 3.0.
|
7
|
-
date: 2006-04-
|
6
|
+
version: 3.0.2
|
7
|
+
date: 2006-04-13 00:00:00 -04:00
|
8
8
|
summary: Ajax scaffold generator is a rails generator for ajaxified scaffolds
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- templates/layout.rhtml
|
53
53
|
- templates/information.gif
|
54
54
|
- templates/indicator.gif
|
55
|
+
- templates/indicator-small.gif
|
55
56
|
- templates/helper.rb
|
56
57
|
- templates/functional_test.rb
|
57
58
|
- templates/form_scaffolding.rhtml
|