ajax_scaffold_generator 3.1.5 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,218 +1,218 @@
1
- module AjaxScaffold
2
-
3
- class ScaffoldColumn
4
-
5
- attr_reader :name, :eval, :sort_sql, :label
6
-
7
- # Only options[:name] is required. It will infer the eval and sort values
8
- # based on the given class.
9
- def initialize(klass, options)
10
- @name = options[:name]
11
- @eval = options[:eval].nil? ? "h(#{Inflector.underscore(klass.to_s)}.#{@name})" : options[:eval]
12
- @label = options[:label].nil? ? Inflector.titleize(@name) : options[:label]
13
- @sortable = options[:sortable].nil? ? true : options[:sortable]
14
- @sort_sql = options[:sort_sql].nil? ? Inflector.tableize(klass.to_s) + "." + @name : options[:sort_sql] unless !@sortable
15
- @class = options[:class] unless options[:class].nil?
16
- end
17
-
18
- def sortable?
19
- @sortable
20
- end
21
-
22
- end
23
-
24
- module Model
25
- module ClassMethods
26
-
27
- def build_scaffold_columns
28
- scaffold_columns = Array.new
29
- content_columns.each do |column|
30
- scaffold_columns << ScaffoldColumn.new(self, { :name => column.name })
31
- end
32
- scaffold_columns
33
- end
34
-
35
- def build_scaffold_columns_hash
36
- scaffold_columns_hash = Hash.new
37
- scaffold_columns.each do |scaffold_column|
38
- scaffold_columns_hash[scaffold_column.name] = scaffold_column
39
- end
40
- scaffold_columns_hash
41
- end
42
- end
43
- end
44
-
45
- module Common
46
- def current_sort(params)
47
- session[params[:scaffold_id]][:sort]
48
- end
49
-
50
- def current_sort_direction(params)
51
- session[params[:scaffold_id]][:sort_direction]
52
- end
53
- end
54
-
55
- module Controller
56
- include AjaxScaffold::Common
57
-
58
- # Filters
59
-
60
- def clear_flashes
61
- #We want to clear flashes so they don't appear on a page reload
62
- if request.xhr?
63
- flash.keys.each do |flash_key|
64
- flash[flash_key] = nil
65
- end
66
- end
67
- end
68
-
69
- # Helper Methods
70
-
71
- def default_per_page
72
- 5
73
- end
74
-
75
- def store_or_get_from_session(id_key, value_key)
76
- session[id_key][value_key] = params[value_key] if !params[value_key].nil?
77
- params[value_key] ||= session[id_key][value_key]
78
- end
79
-
80
- def update_params(options)
81
- @scaffold_id = params[:scaffold_id] ||= options[:default_scaffold_id]
82
- session[@scaffold_id] ||= {:sort => options[:default_sort], :sort_direction => options[:default_sort_direction], :page => 1}
83
-
84
- store_or_get_from_session(@scaffold_id, :sort)
85
- store_or_get_from_session(@scaffold_id, :sort_direction)
86
- store_or_get_from_session(@scaffold_id, :page)
87
- end
88
-
89
- end
90
-
91
- module Helper
92
- include AjaxScaffold::Common
93
-
94
- def format_column(column_value)
95
- if column_empty?(column_value)
96
- empty_column_text
97
- elsif column_value.instance_of? Time
98
- format_time(column_value)
99
- elsif column_value.instance_of? Date
100
- format_date(column_value)
101
- else
102
- column_value.to_s
103
- end
104
- end
105
-
106
- def format_time(time)
107
- time.strftime("%m/%d/%Y %I:%M %p")
108
- end
109
-
110
- def format_date(date)
111
- date.strftime("%m/%d/%Y")
112
- end
113
-
114
- def column_empty?(column_value)
115
- column_value.nil? || (column_value.empty? rescue false)
116
- end
117
-
118
- def empty_column_text
119
- "-"
120
- end
121
-
122
- # Generates a temporary id for creating a new element
123
- def generate_temporary_id
124
- (Time.now.to_f*1000).to_i.to_s
125
- end
126
-
127
- def pagination_ajax_links(paginator, params)
128
- pagination_links_each(paginator, {}) do |n|
129
- link_to_remote n,
130
- { :url => params.merge(:page => n ),
131
- :loading => "Element.show('#{loading_indicator_id(params.merge(:action => 'pagination'))}');",
132
- :update => scaffold_content_id(params) },
133
- { :href => url_for(params.merge(:page => n )) }
134
- end
135
- end
136
-
137
- def column_sort_direction(column_name, params)
138
- column_name && current_sort_direction(params) == "asc" ? "desc" : "asc"
139
-
140
- if column_name && column_name == current_sort(params)
141
- current_sort_direction(params) == "asc" ? "desc" : "asc"
142
- else
143
- "asc"
144
- end
145
- end
146
-
147
- def column_class(column_name, column_value, sort_column)
148
- class_name = String.new
149
- class_name += "empty " if column_empty?(column_value)
150
- class_name += "sorted " if (!sort_column.nil? && column_name == sort_column)
151
- class_name
152
- end
153
-
154
- def loading_indicator_tag(options)
155
- image_tag "indicator.gif", :style => "display:none;", :id => loading_indicator_id(options), :alt => "loading indicator", :class => "loading-indicator"
156
- end
157
-
158
- # The following are a bunch of helper methods to produce the common scaffold view id's
159
-
160
- def scaffold_content_id(options)
161
- "#{options[:scaffold_id]}-content"
162
- end
163
-
164
- def scaffold_column_header_id(options)
165
- "#{options[:scaffold_id]}-#{options[:column_name]}-column"
166
- end
167
-
168
- def scaffold_tbody_id(options)
169
- "#{options[:scaffold_id]}-tbody"
170
- end
171
-
172
- def scaffold_messages_id(options)
173
- "#{options[:scaffold_id]}-messages"
174
- end
175
-
176
- def empty_message_id(options)
177
- "#{options[:scaffold_id]}-empty-message"
178
- end
179
-
180
- def element_row_id(options)
181
- "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-row"
182
- end
183
-
184
- def element_cell_id(options)
185
- "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-cell"
186
- end
187
-
188
- def element_form_id(options)
189
- "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-form"
190
- end
191
-
192
- def loading_indicator_id(options)
193
- if options[:id].nil?
194
- "#{options[:scaffold_id]}-#{options[:action]}-loading-indicator"
195
- else
196
- "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-loading-indicator"
197
- end
198
- end
199
-
200
- def element_messages_id(options)
201
- "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-messages"
202
- end
203
- end
204
- end
205
-
206
- class ActiveRecord::Base
207
- extend AjaxScaffold::Model::ClassMethods
208
-
209
- @scaffold_columns = nil
210
- def self.scaffold_columns
211
- @scaffold_columns ||= build_scaffold_columns
212
- end
213
-
214
- @scaffold_columns_hash = nil
215
- def self.scaffold_columns_hash
216
- @scaffold_columns_hash ||= build_scaffold_columns_hash
217
- end
218
- end
1
+ module AjaxScaffold # :nodoc:
2
+ class ScaffoldColumn
3
+ attr_reader :name, :eval, :sort_sql, :label, :class_name, :sanitize
4
+
5
+ # Only options[:name] is required. It will infer the eval and sort values
6
+ # based on the given class.
7
+ def initialize(klass, options)
8
+ @name = options[:name]
9
+ @eval = options[:eval].nil? ? "#{Inflector.underscore(klass.to_s)}.#{@name}" : options[:eval]
10
+ @label = options[:label].nil? ? Inflector.titleize(@name) : options[:label]
11
+ @sortable = options[:sortable].nil? ? true : options[:sortable]
12
+ @sort_sql = options[:sort_sql].nil? ? "#{klass.table_name}.#{@name}" : options[:sort_sql] unless !@sortable
13
+ @class_name = options[:class_name].nil? ? "" : options[:class_name]
14
+ @sanitize = options[:sanitize].nil? ? true : options[:sanitize]
15
+ end
16
+
17
+ def sanitize?
18
+ @sanitize
19
+ end
20
+
21
+ def sortable?
22
+ @sortable
23
+ end
24
+
25
+ end
26
+
27
+ module Common
28
+ def current_sort(params)
29
+ session[params[:scaffold_id]][:sort]
30
+ end
31
+
32
+ def current_sort_direction(params)
33
+ session[params[:scaffold_id]][:sort_direction]
34
+ end
35
+
36
+ def current_page(params)
37
+ session[params[:scaffold_id]][:page]
38
+ end
39
+ end
40
+
41
+ module Controller
42
+
43
+ def clear_flashes
44
+ if request.xhr?
45
+ flash.keys.each do |flash_key|
46
+ flash[flash_key] = nil
47
+ end
48
+ end
49
+ end
50
+
51
+ def default_per_page
52
+ 25
53
+ end
54
+
55
+ def store_or_get_from_session(id_key, value_key)
56
+ session[id_key][value_key] = params[value_key] if !params[value_key].nil?
57
+ params[value_key] ||= session[id_key][value_key]
58
+ end
59
+
60
+ def update_params(options)
61
+ @scaffold_id = params[:scaffold_id] ||= options[:default_scaffold_id]
62
+ session[@scaffold_id] ||= {:sort => options[:default_sort], :sort_direction => options[:default_sort_direction], :page => 1}
63
+
64
+ store_or_get_from_session(@scaffold_id, :sort)
65
+ store_or_get_from_session(@scaffold_id, :sort_direction)
66
+ store_or_get_from_session(@scaffold_id, :page)
67
+ end
68
+
69
+ end
70
+
71
+ module Helper
72
+ include AjaxScaffold::Common
73
+
74
+ def format_column(column_value, sanitize = true)
75
+ if column_empty?(column_value)
76
+ empty_column_text
77
+ elsif column_value.instance_of? Time
78
+ format_time(column_value)
79
+ elsif column_value.instance_of? Date
80
+ format_date(column_value)
81
+ else
82
+ sanitize ? h(column_value.to_s) : column_value.to_s
83
+ end
84
+ end
85
+
86
+ def format_time(time)
87
+ time.strftime("%m/%d/%Y %I:%M %p")
88
+ end
89
+
90
+ def format_date(date)
91
+ date.strftime("%m/%d/%Y")
92
+ end
93
+
94
+ def column_empty?(column_value)
95
+ column_value.nil? || (column_value.empty? rescue false)
96
+ end
97
+
98
+ def empty_column_text
99
+ "-"
100
+ end
101
+
102
+ # Generates a temporary id for creating a new element
103
+ def generate_temporary_id
104
+ (Time.now.to_f*1000).to_i.to_s
105
+ end
106
+
107
+ def pagination_ajax_links(paginator, params)
108
+ pagination_links_each(paginator, {}) do |n|
109
+ link_to_remote n,
110
+ { :url => params.merge(:page => n ),
111
+ :loading => "Element.show('#{loading_indicator_id(params.merge(:action => 'pagination'))}');",
112
+ :update => scaffold_content_id(params) },
113
+ { :href => url_for(params.merge(:page => n )) }
114
+ end
115
+ end
116
+
117
+ def column_sort_direction(column_name, params)
118
+ if column_name && column_name == current_sort(params)
119
+ current_sort_direction(params) == "asc" ? "desc" : "asc"
120
+ else
121
+ "asc"
122
+ end
123
+ end
124
+
125
+ def column_class(column_name, column_value, sort_column, class_name = nil)
126
+ class_name = String.new
127
+ class_name += "empty " if column_empty?(column_value)
128
+ class_name += "sorted " if (!sort_column.nil? && column_name == sort_column)
129
+ class_name += "#{class_name} " unless class_name.nil?
130
+ class_name
131
+ end
132
+
133
+ def loading_indicator_tag(options)
134
+ image_tag "indicator.gif", :style => "display:none;", :id => loading_indicator_id(options), :alt => "loading indicator", :class => "loading-indicator"
135
+ end
136
+
137
+ # The following are a bunch of helper methods to produce the common scaffold view id's
138
+
139
+ def scaffold_content_id(options)
140
+ "#{options[:scaffold_id]}-content"
141
+ end
142
+
143
+ def scaffold_column_header_id(options)
144
+ "#{options[:scaffold_id]}-#{options[:column_name]}-column"
145
+ end
146
+
147
+ def scaffold_tbody_id(options)
148
+ "#{options[:scaffold_id]}-tbody"
149
+ end
150
+
151
+ def scaffold_messages_id(options)
152
+ "#{options[:scaffold_id]}-messages"
153
+ end
154
+
155
+ def empty_message_id(options)
156
+ "#{options[:scaffold_id]}-empty-message"
157
+ end
158
+
159
+ def element_row_id(options)
160
+ "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-row"
161
+ end
162
+
163
+ def element_cell_id(options)
164
+ "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-cell"
165
+ end
166
+
167
+ def element_form_id(options)
168
+ "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-form"
169
+ end
170
+
171
+ def loading_indicator_id(options)
172
+ if options[:id].nil?
173
+ "#{options[:scaffold_id]}-#{options[:action]}-loading-indicator"
174
+ else
175
+ "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-loading-indicator"
176
+ end
177
+ end
178
+
179
+ def element_messages_id(options)
180
+ "#{options[:scaffold_id]}-#{options[:action]}-#{options[:id]}-messages"
181
+ end
182
+ end
183
+
184
+ module Model
185
+ module ClassMethods
186
+
187
+ def build_scaffold_columns
188
+ scaffold_columns = Array.new
189
+ content_columns.each do |column|
190
+ scaffold_columns << ScaffoldColumn.new(self, { :name => column.name })
191
+ end
192
+ scaffold_columns
193
+ end
194
+
195
+ def build_scaffold_columns_hash
196
+ scaffold_columns_hash = Hash.new
197
+ scaffold_columns.each do |scaffold_column|
198
+ scaffold_columns_hash[scaffold_column.name] = scaffold_column
199
+ end
200
+ scaffold_columns_hash
201
+ end
202
+ end
203
+ end
204
+ end
205
+
206
+ class ActiveRecord::Base
207
+ extend AjaxScaffold::Model::ClassMethods
208
+
209
+ @scaffold_columns = nil
210
+ def self.scaffold_columns
211
+ @scaffold_columns ||= build_scaffold_columns
212
+ end
213
+
214
+ @scaffold_columns_hash = nil
215
+ def self.scaffold_columns_hash
216
+ @scaffold_columns_hash ||= build_scaffold_columns_hash
217
+ end
218
+ end
@@ -1,17 +1,17 @@
1
- <%% for scaffold_column in scaffold_columns %>
2
- <%% column_sort_direction = column_sort_direction(scaffold_column.name, params) %>
3
- <%% sort_params = params.merge(:controller => '<%= controller_file_path %>', :action => 'component_update', :sort => scaffold_column.name, :sort_direction => column_sort_direction, :page => 1) %>
4
- <%% column_header_id = scaffold_column_header_id(sort_params.merge(:column_name => scaffold_column.name)) %>
5
- <th id="<%%= column_header_id %>" <%%= "class=\"sorted #{current_sort_direction(params)}\"" if scaffold_column.name == current_sort(params) %>>
6
- <%% if scaffold_column.sortable? %>
7
- <%%= link_to_remote scaffold_column.label,
8
- { :url => sort_params,
9
- :loading => "Element.addClassName('#{column_header_id}','loading');",
10
- :update => scaffold_content_id(sort_params) },
11
- { :href => url_for(sort_params) } %>
12
- <%% else %>
13
- <p><%%= scaffold_column.label %></p>
14
- <%% end %>
15
- </th>
16
- <%% end %>
1
+ <%% for scaffold_column in scaffold_columns %>
2
+ <%% column_sort_direction = column_sort_direction(scaffold_column.name, params) %>
3
+ <%% sort_params = params.merge(:controller => '<%= controller_file_path %>', :action => 'component_update', :sort => scaffold_column.name, :sort_direction => column_sort_direction, :page => 1) %>
4
+ <%% column_header_id = scaffold_column_header_id(sort_params.merge(:column_name => scaffold_column.name)) %>
5
+ <th id="<%%= column_header_id %>" <%%= "class=\"sorted #{current_sort_direction(params)}\"" if scaffold_column.name == current_sort(params) %>>
6
+ <%% if scaffold_column.sortable? %>
7
+ <%%= link_to_remote scaffold_column.label,
8
+ { :url => sort_params,
9
+ :loading => "Element.addClassName('#{column_header_id}','loading');",
10
+ :update => scaffold_content_id(sort_params) },
11
+ { :href => url_for(sort_params) } %>
12
+ <%% else %>
13
+ <p><%%= scaffold_column.label %></p>
14
+ <%% end %>
15
+ </th>
16
+ <%% end %>
17
17
  <th></th>
@@ -3,34 +3,34 @@
3
3
  <%% @options = params.merge(:controller => '<%= controller_file_path %>', :action => "view", :id => <%= singular_name %>.send("#{<%= model_name %>.primary_key}")) %>
4
4
 
5
5
  <tr <%%= classAttr %> id="<%%= element_row_id(@options) %>" <%%= "style=\"display: none;\"" if hidden %>>
6
- <%% for scaffold_column in scaffold_columns %>
7
- <%% column_value = eval(scaffold_column.eval) rescue nil %>
8
- <td class="<%%= column_class(scaffold_column.name, column_value, current_sort(params)) %>" >
9
- <%%= format_column(column_value) %>
10
- </td>
11
- <%% end %>
6
+ <%% for scaffold_column in scaffold_columns %>
7
+ <%% column_value = eval(scaffold_column.eval) rescue nil %>
8
+ <td class="<%%= column_class(scaffold_column.name, column_value, current_sort(params), scaffold_column.class_name) %>" >
9
+ <%%= format_column(column_value, scaffold_column.sanitize?) %>
10
+ </td>
11
+ <%% end %>
12
12
  <td class="actions">
13
13
  <table cellpadding="0" cellspacing="0">
14
14
  <tr>
15
15
  <td class="indicator-container">
16
16
  <%%= loading_indicator_tag(@options) %>
17
17
  </td>
18
- <td>
18
+ <td>
19
19
  <%% edit_options = @options.merge(:action => 'edit') %>
20
- <%%= link_to_remote "Edit",
21
- { :url => edit_options,
22
- :loading => "Element.show('#{loading_indicator_id(@options)}');" },
23
- { :href => url_for(edit_options) } %>
24
- </td>
25
- <td>
26
- <%% delete_options = @options.merge(:action => 'destroy') %>
27
- <%%= link_to_remote "Delete",
28
- { :url => delete_options,
29
- :confirm => 'Are you sure?',
30
- :loading => "Element.show('#{loading_indicator_id(@options)}');" },
31
- { :href => url_for( delete_options ) } %>
32
- </td>
33
- </tr>
34
- </table>
20
+ <%%= link_to_remote "Edit",
21
+ { :url => edit_options,
22
+ :loading => "Element.show('#{loading_indicator_id(@options)}');" },
23
+ { :href => url_for(edit_options) } %>
24
+ </td>
25
+ <td>
26
+ <%% delete_options = @options.merge(:action => 'destroy') %>
27
+ <%%= link_to_remote "Delete",
28
+ { :url => delete_options,
29
+ :confirm => 'Are you sure?',
30
+ :loading => "Element.show('#{loading_indicator_id(@options)}');" },
31
+ { :href => url_for( delete_options ) } %>
32
+ </td>
33
+ </tr>
34
+ </table>
35
35
  </td>
36
36
  </tr>
@@ -1,40 +1,40 @@
1
- <%% if not request.xhr? %>
2
- <table class="ajax-scaffold" cellpadding="0" cellspacing="0">
3
- <tbody>
4
- <%% end %>
5
- <tr id="<%%= element_row_id(@options) %>" <%%= "style=\"display:none;\"" if request.xhr? %>>
6
- <td id="<%%= element_cell_id(@options) %>" class="<%%= @options[:action] %>" colspan="<%%= num_columns %>">
7
-
8
- <%%= form_remote_tag :url => @options.merge(:controller => '<%= controller_file_path %>'),
9
- :loading => "Element.show('#{loading_indicator_id(@options)}'); Form.disable('#{element_form_id(@options)}');",
10
- :html => { :href => url_for(@options.merge(:controller => '<%= controller_file_path %>')),
11
- :id => element_form_id(@options) } %>
12
-
13
- <%%= hidden_field_tag "scaffold_id", @options[:scaffold_id] %>
14
-
15
- <h4><%%= Inflector.titleize(@options[:action]) %> <%= Inflector.titleize(singular_name) %></h4>
16
-
17
- <%% if request.xhr? %>
18
- <div id="<%%= element_messages_id(@options) %>" class="messages-container"></div>
19
- <%% else %>
20
- <%%= render :partial => 'form_messages' %>
21
- <%% end %>
22
-
23
- <%%= render :partial => 'form' %>
24
-
25
- <p class="form-footer">
26
- <%%= submit_tag Inflector.titleize(@options[:action]), :class => "submit" %>
27
- <%% cancel_params = @options.merge(:controller => '<%= controller_file_path %>', :action => 'cancel', :referring_action => @options[:action]) %>
28
- <%%= link_to_remote "Cancel",
29
- { :url => cancel_params,
30
- :loading => "Element.show('#{loading_indicator_id(@options)}');" },
31
- { :href => url_for(cancel_params) } %>
32
- <%%= loading_indicator_tag @options %>
33
- </p>
34
- <%%= end_form_tag %>
35
- </td>
36
- </tr>
37
- <%% if not request.xhr? %>
38
- </tbody>
39
- </table>
1
+ <%% if not request.xhr? %>
2
+ <table class="ajax-scaffold" cellpadding="0" cellspacing="0">
3
+ <tbody>
4
+ <%% end %>
5
+ <tr id="<%%= element_row_id(@options) %>" <%%= "style=\"display:none;\"" if request.xhr? %>>
6
+ <td id="<%%= element_cell_id(@options) %>" class="<%%= @options[:action] %>" colspan="<%%= num_columns %>">
7
+
8
+ <%%= form_remote_tag :url => @options.merge(:controller => '<%= controller_file_path %>'),
9
+ :loading => "Element.show('#{loading_indicator_id(@options)}'); Form.disable('#{element_form_id(@options)}');",
10
+ :html => { :href => url_for(@options.merge(:controller => '<%= controller_file_path %>')),
11
+ :id => element_form_id(@options) } %>
12
+
13
+ <%%= hidden_field_tag "scaffold_id", @options[:scaffold_id] %>
14
+
15
+ <h4><%%= Inflector.titleize(@options[:action]) %> <%= Inflector.titleize(singular_name) %></h4>
16
+
17
+ <%% if request.xhr? %>
18
+ <div id="<%%= element_messages_id(@options) %>" class="messages-container"></div>
19
+ <%% else %>
20
+ <%%= render :partial => 'form_messages' %>
21
+ <%% end %>
22
+
23
+ <%%= render :partial => 'form' %>
24
+
25
+ <p class="form-footer">
26
+ <%%= submit_tag Inflector.titleize(@options[:action]), :class => "submit" %>
27
+ <%% cancel_params = @options.merge(:controller => '<%= controller_file_path %>', :action => 'cancel', :referring_action => @options[:action]) %>
28
+ <%%= link_to_remote "Cancel",
29
+ { :url => cancel_params,
30
+ :loading => "Element.show('#{loading_indicator_id(@options)}');" },
31
+ { :href => url_for(cancel_params) } %>
32
+ <%%= loading_indicator_tag @options %>
33
+ </p>
34
+ <%%= end_form_tag %>
35
+ </td>
36
+ </tr>
37
+ <%% if not request.xhr? %>
38
+ </tbody>
39
+ </table>
40
40
  <%% end %>
@@ -1,16 +1,16 @@
1
- <%% pagination_params = params.merge(:controller => '<%= controller_file_path %>', :action => 'component_update') %>
2
- <%% indicator_params = pagination_params.merge(:action => 'pagination') %>
3
- <%%= loading_indicator_tag indicator_params %>
4
- <%%= link_to_remote('Previous',
5
- { :url => pagination_params.merge(:page => paginator.current.previous),
6
- :loading => "Element.show('#{loading_indicator_id(indicator_params)}');",
7
- :update => scaffold_content_id(pagination_params) },
8
- { :href => url_for(pagination_params.merge(:page => paginator.current.previous)),
9
- :class => "previous"}) if @paginator.current.previous %>
10
- <%%= pagination_ajax_links @paginator, pagination_params %>
11
- <%%= link_to_remote('Next',
12
- { :url => pagination_params.merge(:page => paginator.current.next),
13
- :loading => "Element.show('#{loading_indicator_id(indicator_params)}');",
14
- :update => scaffold_content_id(pagination_params) },
15
- { :href => url_for(pagination_params.merge(:page => paginator.current.next)),
1
+ <%% pagination_params = params.merge(:controller => '<%= controller_file_path %>', :action => 'component_update') %>
2
+ <%% indicator_params = pagination_params.merge(:action => 'pagination') %>
3
+ <%%= loading_indicator_tag indicator_params %>
4
+ <%%= link_to_remote('Previous',
5
+ { :url => pagination_params.merge(:page => paginator.current.previous),
6
+ :loading => "Element.show('#{loading_indicator_id(indicator_params)}');",
7
+ :update => scaffold_content_id(pagination_params) },
8
+ { :href => url_for(pagination_params.merge(:page => paginator.current.previous)),
9
+ :class => "previous"}) if @paginator.current.previous %>
10
+ <%%= pagination_ajax_links @paginator, pagination_params %>
11
+ <%%= link_to_remote('Next',
12
+ { :url => pagination_params.merge(:page => paginator.current.next),
13
+ :loading => "Element.show('#{loading_indicator_id(indicator_params)}');",
14
+ :update => scaffold_content_id(pagination_params) },
15
+ { :href => url_for(pagination_params.merge(:page => paginator.current.next)),
16
16
  :class => "next"}) if @paginator.current.next %>