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,12 +1,12 @@
1
- @options = { :scaffold_id => params[:scaffold_id], :action => params[:referring_action], :id => params[:id] }
2
-
3
- if @successful
4
- page.remove element_row_id(@options)
5
- if @options[:action] == "update"
6
- page.show element_row_id(@options.merge(:action => "view"))
7
- elsif @options[:action] == "create"
8
- page << "AjaxScaffold.displayMessageIfEmpty('#{scaffold_tbody_id(@options)}','#{empty_message_id(@options)}');"
9
- end
10
- else
11
- page.hide loading_indicator_id(@options)
1
+ @options = { :scaffold_id => params[:scaffold_id], :action => params[:referring_action], :id => params[:id] }
2
+
3
+ if @successful
4
+ page.remove element_row_id(@options)
5
+ if @options[:action] == "update"
6
+ page.show element_row_id(@options.merge(:action => "view"))
7
+ elsif @options[:action] == "create"
8
+ page << "AjaxScaffold.displayMessageIfEmpty('#{scaffold_tbody_id(@options)}','#{empty_message_id(@options)}');"
9
+ end
10
+ else
11
+ page.hide loading_indicator_id(@options)
12
12
  end
@@ -1,53 +1,53 @@
1
- require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
-
3
- class <%= class_name %>Test < Test::Unit::TestCase
4
- fixtures :<%= plural_name %>
5
-
6
- NEW_<%= singular_name.upcase %> = {} # e.g. {:name => 'Test <%= class_name %>', :description => 'Dummy'}
7
- REQ_ATTR_NAMES = %w( ) # name of fields that must be present, e.g. %(name description)
8
- DUPLICATE_ATTR_NAMES = %w( ) # name of fields that cannot be a duplicate, e.g. %(name description)
9
-
10
- def setup
11
- # Retrieve fixtures via their name
12
- # @first = <%= plural_name %>(:first)
13
- end
14
-
15
- def test_raw_validation
16
- <%= singular_name %> = <%= class_name %>.new
17
- if REQ_ATTR_NAMES.blank?
18
- assert <%= singular_name %>.valid?, "<%= class_name %> should be valid without initialisation parameters"
19
- else
20
- # If <%= class_name %> has validation, then use the following:
21
- assert !<%= singular_name %>.valid?, "<%= class_name %> should not be valid without initialisation parameters"
22
- REQ_ATTR_NAMES.each {|attr_name| assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"}
23
- end
24
- end
25
-
26
- def test_new
27
- <%= singular_name %> = <%= class_name %>.new(NEW_<%= singular_name.upcase %>)
28
- assert <%= singular_name %>.valid?, "<%= class_name %> should be valid"
29
- NEW_<%= singular_name.upcase %>.each do |attr_name|
30
- assert_equal NEW_<%= singular_name.upcase %>[attr_name], <%= singular_name %>.attributes[attr_name], "<%= class_name %>.@#{attr_name.to_s} incorrect"
31
- end
32
- end
33
-
34
- def test_validates_presence_of
35
- REQ_ATTR_NAMES.each do |attr_name|
36
- tmp_<%= singular_name %> = NEW_<%= singular_name.upcase %>.clone
37
- tmp_<%= singular_name %>.delete attr_name.to_sym
38
- <%= singular_name %> = <%= class_name %>.new(tmp_<%= singular_name %>)
39
- assert !<%= singular_name %>.valid?, "<%= class_name %> should be invalid, as @#{attr_name} is invalid"
40
- assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"
41
- end
42
- end
43
-
44
- def test_duplicate
45
- current_<%= singular_name %> = <%= class_name %>.find_first
46
- DUPLICATE_ATTR_NAMES.each do |attr_name|
47
- <%= singular_name %> = <%= class_name %>.new(NEW_<%= singular_name.upcase %>.merge(attr_name.to_sym => current_<%= singular_name %>[attr_name]))
48
- assert !<%= singular_name %>.valid?, "<%= class_name %> should be invalid, as @#{attr_name} is a duplicate"
49
- assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"
50
- end
51
- end
52
- end
53
-
1
+ require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
+
3
+ class <%= class_name %>Test < Test::Unit::TestCase
4
+ fixtures :<%= plural_name %>
5
+
6
+ NEW_<%= singular_name.upcase %> = {} # e.g. {:name => 'Test <%= class_name %>', :description => 'Dummy'}
7
+ REQ_ATTR_NAMES = %w( ) # name of fields that must be present, e.g. %(name description)
8
+ DUPLICATE_ATTR_NAMES = %w( ) # name of fields that cannot be a duplicate, e.g. %(name description)
9
+
10
+ def setup
11
+ # Retrieve fixtures via their name
12
+ # @first = <%= plural_name %>(:first)
13
+ end
14
+
15
+ def test_raw_validation
16
+ <%= singular_name %> = <%= class_name %>.new
17
+ if REQ_ATTR_NAMES.blank?
18
+ assert <%= singular_name %>.valid?, "<%= class_name %> should be valid without initialisation parameters"
19
+ else
20
+ # If <%= class_name %> has validation, then use the following:
21
+ assert !<%= singular_name %>.valid?, "<%= class_name %> should not be valid without initialisation parameters"
22
+ REQ_ATTR_NAMES.each {|attr_name| assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"}
23
+ end
24
+ end
25
+
26
+ def test_new
27
+ <%= singular_name %> = <%= class_name %>.new(NEW_<%= singular_name.upcase %>)
28
+ assert <%= singular_name %>.valid?, "<%= class_name %> should be valid"
29
+ NEW_<%= singular_name.upcase %>.each do |attr_name|
30
+ assert_equal NEW_<%= singular_name.upcase %>[attr_name], <%= singular_name %>.attributes[attr_name], "<%= class_name %>.@#{attr_name.to_s} incorrect"
31
+ end
32
+ end
33
+
34
+ def test_validates_presence_of
35
+ REQ_ATTR_NAMES.each do |attr_name|
36
+ tmp_<%= singular_name %> = NEW_<%= singular_name.upcase %>.clone
37
+ tmp_<%= singular_name %>.delete attr_name.to_sym
38
+ <%= singular_name %> = <%= class_name %>.new(tmp_<%= singular_name %>)
39
+ assert !<%= singular_name %>.valid?, "<%= class_name %> should be invalid, as @#{attr_name} is invalid"
40
+ assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"
41
+ end
42
+ end
43
+
44
+ def test_duplicate
45
+ current_<%= singular_name %> = <%= class_name %>.find_first
46
+ DUPLICATE_ATTR_NAMES.each do |attr_name|
47
+ <%= singular_name %> = <%= class_name %>.new(NEW_<%= singular_name.upcase %>.merge(attr_name.to_sym => current_<%= singular_name %>[attr_name]))
48
+ assert !<%= singular_name %>.valid?, "<%= class_name %> should be invalid, as @#{attr_name} is a duplicate"
49
+ assert <%= singular_name %>.errors.invalid?(attr_name.to_sym), "Should be an error message for :#{attr_name}"
50
+ end
51
+ end
52
+ end
53
+
@@ -1,50 +1,50 @@
1
- <%% if @show_wrapper %>
2
- <div id="<%%= params[:scaffold_id] %>" class="ajax-scaffold">
3
- <div id="<%%= scaffold_content_id(params) %>">
4
- <%% end %>
5
- <div class="ajax-scaffold-header">
6
- <div class="actions">
7
- <%% new_params = params.merge(:controller => '<%= controller_file_path %>', :action => 'new') %>
8
- <%%= loading_indicator_tag(new_params) %>
9
- <%%= link_to_remote "Create New",
10
- { :url => new_params,
11
- :loading => "Element.show('#{loading_indicator_id(new_params)}');" },
12
- { :href => url_for(new_params),
13
- :class => "create" } %>
14
- </div>
15
- <h2><%= Inflector.titleize(plural_name) %></h2>
16
- </div>
17
- <table cellpadding="0" cellspacing="0">
18
- <thead>
19
- <tr>
20
- <%%= render :partial => 'column_headings' %>
21
- </tr>
22
- </thead>
23
- <tbody>
24
- <tr>
25
- <td colspan="<%%= num_columns %>" class="messages-container">
26
- <div id="<%%= scaffold_messages_id(params) %>">
27
- <%%= render :partial => 'messages' %>
28
- </div>
29
- <p id="<%%= empty_message_id(params) %>" class="empty-message" <%%= " style=\"display:none;\" " if !@<%= plural_name %>.empty? %>>
30
- No Entries
31
- </p>
32
- </td>
33
- </tr>
34
- </tbody>
35
- <tbody id="<%%= scaffold_tbody_id(params) %>">
36
- <%% if !@<%= plural_name %>.empty? %>
37
- <%%= render :partial => '<%= singular_name %>', :collection => @<%= plural_name %>, :locals => { :hidden => false } %>
38
- <%% end %>
39
- </tbody>
40
- </table>
41
- <div class="ajax-scaffold-footer">
42
- <%%= render :partial => 'pagination_links', :locals => { :paginator => @paginator } %>
43
- </div>
44
- <%% if @show_wrapper %>
45
- </div>
46
- </div>
47
- <script type="text/javascript">
48
- Rico.Corner.round('<%%= params[:scaffold_id] %>', {color: '#005CB8', bgColor: '#fff', compact: true});
49
- </script>
1
+ <%% if @show_wrapper %>
2
+ <div id="<%%= params[:scaffold_id] %>" class="ajax-scaffold">
3
+ <div id="<%%= scaffold_content_id(params) %>">
4
+ <%% end %>
5
+ <div class="ajax-scaffold-header">
6
+ <div class="actions">
7
+ <%% new_params = params.merge(:controller => '<%= controller_file_path %>', :action => 'new') %>
8
+ <%%= loading_indicator_tag(new_params) %>
9
+ <%%= link_to_remote "Create New",
10
+ { :url => new_params,
11
+ :loading => "Element.show('#{loading_indicator_id(new_params)}');" },
12
+ { :href => url_for(new_params),
13
+ :class => "create" } %>
14
+ </div>
15
+ <h2><%= Inflector.titleize(plural_name) %></h2>
16
+ </div>
17
+ <table cellpadding="0" cellspacing="0">
18
+ <thead>
19
+ <tr>
20
+ <%%= render :partial => 'column_headings' %>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ <tr>
25
+ <td colspan="<%%= num_columns %>" class="messages-container">
26
+ <div id="<%%= scaffold_messages_id(params) %>">
27
+ <%%= render :partial => 'messages' %>
28
+ </div>
29
+ <p id="<%%= empty_message_id(params) %>" class="empty-message" <%%= " style=\"display:none;\" " if !@<%= plural_name %>.empty? %>>
30
+ No Entries
31
+ </p>
32
+ </td>
33
+ </tr>
34
+ </tbody>
35
+ <tbody id="<%%= scaffold_tbody_id(params) %>">
36
+ <%% if !@<%= plural_name %>.empty? %>
37
+ <%%= render :partial => '<%= singular_name %>', :collection => @<%= plural_name %>, :locals => { :hidden => false } %>
38
+ <%% end %>
39
+ </tbody>
40
+ </table>
41
+ <div class="ajax-scaffold-footer">
42
+ <%%= render :partial => 'pagination_links', :locals => { :paginator => @paginator } %>
43
+ </div>
44
+ <%% if @show_wrapper %>
45
+ </div>
46
+ </div>
47
+ <script type="text/javascript">
48
+ Rico.Corner.round('<%%= params[:scaffold_id] %>', {color: '#005CB8', bgColor: '#fff', compact: true});
49
+ </script>
50
50
  <%% end %>
Binary file
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.1.5
7
- date: 2006-07-18 00:00:00 -06:00
6
+ version: 3.1.6
7
+ date: 2006-09-10 00:00:00 -06:00
8
8
  summary: Ajax scaffold generator is a rails generator for ajaxified scaffolds
9
9
  require_paths:
10
10
  - lib