inline_forms 1.3.6 → 1.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/Gemfile.lock +1 -1
  2. data/bin/inline_forms +2 -1
  3. data/lib/app/assets/stylesheets/inline_forms.css +34 -0
  4. data/lib/app/controllers/inline_forms_application_controller.rb +21 -0
  5. data/lib/app/controllers/inline_forms_controller.rb +222 -189
  6. data/lib/app/helpers/form_elements/text_area.rb +1 -1
  7. data/lib/app/helpers/form_elements/text_area_without_ckeditor.rb +13 -0
  8. data/lib/app/helpers/inline_forms_helper.rb +33 -19
  9. data/lib/app/validators/is_a_curacao_id_number_validator.rb +4 -6
  10. data/lib/app/validators/is_email_address_validator.rb +0 -4
  11. data/lib/app/validators/must_be_a_value_validator.rb +0 -1
  12. data/lib/app/validators/must_be_unique_validator.rb +0 -3
  13. data/lib/app/views/devise/confirmations/new.html.erb +5 -8
  14. data/lib/app/views/devise/passwords/edit.html.erb +12 -11
  15. data/lib/app/views/devise/passwords/new.html.erb +5 -8
  16. data/lib/app/views/devise/registrations/new.html.erb +5 -8
  17. data/lib/app/views/devise/sessions/new.html.erb +4 -8
  18. data/lib/app/views/devise/shared/_header_and_errors.html.erb +4 -0
  19. data/lib/app/views/devise/shared/_links.erb +21 -19
  20. data/lib/app/views/devise/unlocks/new.html.erb +5 -8
  21. data/lib/app/views/inline_forms/_close.html.erb +1 -1
  22. data/lib/app/views/inline_forms/_list.html.erb +8 -11
  23. data/lib/app/views/inline_forms/_new.html.erb +9 -3
  24. data/lib/app/views/inline_forms/_show.html.erb +2 -2
  25. data/lib/app/views/inline_forms/extract_translations.erb +4 -0
  26. data/lib/app/views/inline_forms/show_undo.js.erb +1 -1
  27. data/lib/app/views/layouts/devise.html.erb +1 -1
  28. data/lib/app/views/layouts/inline_forms.html.erb +1 -1
  29. data/lib/inline_forms.rb +2 -0
  30. data/lib/inline_forms/version.rb +1 -1
  31. data/lib/locales/inline_forms.en.yml +38 -0
  32. data/lib/locales/inline_forms.nl.yml +4 -0
  33. metadata +11 -6
  34. data/lib/app/views/inline_forms/_show_undo.html.erb +0 -1
@@ -1,7 +1,7 @@
1
1
  InlineForms::SPECIAL_COLUMN_TYPES[:text_area]=:text
2
2
 
3
3
  def text_area_show(object, attribute)
4
- if defined? Ckeditor
4
+ if defined? Ckeditor
5
5
  link_to_inline_edit object,
6
6
  attribute,
7
7
  '<div class="ckeditor_area">'.html_safe +
@@ -0,0 +1,13 @@
1
+ InlineForms::SPECIAL_COLUMN_TYPES[:text_area_without_ckeditor]=:text
2
+
3
+ def text_area_without_ckeditor_show(object, attribute)
4
+ link_to_inline_edit object, attribute, object[attribute]
5
+ end
6
+
7
+ def text_area_without_ckeditor_edit(object, attribute)
8
+ text_area_tag attribute, object[attribute], :class => 'attribute_text_area'
9
+ end
10
+
11
+ def text_area_without_ckeditor_update(object, attribute)
12
+ object[attribute.to_sym] = params[attribute.to_sym]
13
+ end
@@ -9,17 +9,14 @@ module InlineFormsHelper
9
9
 
10
10
  private
11
11
 
12
- def inline_forms_version
13
- InlineForms::VERSION
14
- end
15
-
12
+ # used as class name
16
13
  def has_validations(object, attribute)
17
14
  "has_validations " unless object.class.validators_on(attribute).empty?
18
15
  end
19
16
 
20
17
  def validation_help_as_list_for(object, attribute)
21
18
  "" and return if object.class.validators_on(attribute).empty?
22
- content_tag(:ul, validation_help_for(object, attribute).map { |help_message| content_tag(:li, help_message.html_safe ) }.to_s.html_safe )
19
+ content_tag(:ul, validation_help_for(object, attribute).map { |help_message| content_tag(:li, help_message ) }.to_s.html_safe )
23
20
  end
24
21
 
25
22
  # validation_help_for(object, attribute) extracts the help messages for
@@ -27,7 +24,7 @@ module InlineFormsHelper
27
24
  def validation_help_for(object, attribute)
28
25
  "" and return if object.class.validators_on(attribute).empty?
29
26
  object.class.validators_on(attribute).map do |v|
30
- v.help_message if v.respond_to?(:help_message)
27
+ t("inline_forms.validators.help.#{ActiveModel::Name.new(v.class).i18n_key.to_s.gsub(/active_model\/validations\//, '')}")
31
28
  end.compact
32
29
  end
33
30
 
@@ -35,7 +32,7 @@ module InlineFormsHelper
35
32
  def close_link( object, update_span )
36
33
  link_to image_tag( 'close.png',
37
34
  :class => "close_icon",
38
- :title => 'close' ),
35
+ :title => t('inline_forms.view.close') ),
39
36
  send( object.class.to_s.underscore + '_path',
40
37
  object,
41
38
  :update => update_span,
@@ -44,11 +41,11 @@ module InlineFormsHelper
44
41
  end
45
42
 
46
43
  # destroy link
47
- def link_to_destroy( msg, object, update_span )
44
+ def link_to_destroy( object, update_span )
48
45
  if cancan_disabled? || ( can? :destroy, object )
49
46
  link_to image_tag( 'trash.png',
50
47
  :class => "trash_icon",
51
- :title => 'trash' ),
48
+ :title => t('inline_forms.view.trash') ),
52
49
  send( object.class.to_s.underscore + '_path',
53
50
  object,
54
51
  :update => update_span ),
@@ -57,12 +54,10 @@ module InlineFormsHelper
57
54
  end
58
55
  end
59
56
 
60
- # undo link
61
- def link_to_undo_destroy(msg, object, update_span )
62
- link_to("undo", revert_version_path(object.versions.scoped.last), :method => :post)
63
- end
64
-
65
-
57
+ # # undo link
58
+ # def link_to_undo_destroy(object, update_span )
59
+ # link_to(t('inline_forms.view.undo'), revert_version_path(object.versions.scoped.last), :method => :post)
60
+ # end
66
61
 
67
62
  # link_to_inline_edit
68
63
  def link_to_inline_edit(object, attribute, attribute_value='')
@@ -83,19 +78,19 @@ module InlineFormsHelper
83
78
  end
84
79
 
85
80
  # link to new record
86
- def link_to_new_record(text, model, path_to_new, update_span, parent_class, parent_id)
81
+ def link_to_new_record(model, path_to_new, update_span, parent_class, parent_id)
87
82
  out = ""
88
83
  out << "<li class='new_record_link'>"
89
84
  out << (link_to image_tag( 'add.png',
90
85
  :class => "new_record_icon",
91
- :title => text ),
86
+ :title => t('inline_forms.view.add_new', :model => model.model_name.human ) ),
92
87
  send(path_to_new, :update => update_span, :parent_class => parent_class, :parent_id => parent_id ),
93
88
  :remote => true)
94
89
  out << "<div style='clear: both;'></div>"
95
90
  out << "</li>"
96
91
  ""
97
92
  if cancan_enabled?
98
- if can?(:create, model.constantize)
93
+ if can?(:create, model)
99
94
  if parent_class.nil?
100
95
  raw out
101
96
  else
@@ -107,6 +102,25 @@ module InlineFormsHelper
107
102
  end
108
103
  end
109
104
 
105
+ # url to other language
106
+ def locale_url(request, locale)
107
+ subdomains = request.subdomains
108
+ # if there are no subdomains, prepend the locale to the domain
109
+ return request.protocol + [ locale, request.domain ].join('.') + request.port_string if subdomains.empty?
110
+ # if there is a subdomain, find out if it's an available locale and strip it
111
+ subdomains.shift if I18n.available_locales.include?(subdomains.first.to_sym)
112
+ # if there are no subdomains, prepend the locale to the domain
113
+ return request.protocol + [ locale, request.domain ].join('.') + request.port_string if subdomains.empty?
114
+ # else return the rest
115
+ request.protocol + [ locale, subdomains.join('.'), request.domain ].join('.') + request.port_string
116
+ end
117
+
118
+ def translated_attribute(object,attribute)
119
+ t("activerecord.attributes.#{object.class.name.underscore}.#{attribute}")
120
+ # "activerecord.attributes.#{attribute}",
121
+ # "attributes.#{attribute}" ] )
122
+ end
123
+
110
124
  # get the values for an attribute
111
125
  #
112
126
  # values should be a Hash { integer => string, ... }
@@ -142,7 +156,7 @@ module InlineFormsHelper
142
156
 
143
157
  attributes = @inline_forms_attribute_list || object.inline_forms_attribute_list # if we do this as a form_element, @inline.. is nil!!!
144
158
  values = attributes.assoc(attribute.to_sym)[3]
145
- raise "No Values defined in #{@Klass}, #{attribute}" if values.nil?
159
+ raise t("fatal.no_values_defined_in", @Klass, attribute) if values.nil?
146
160
  if values.is_a?(Hash)
147
161
  temp = Array.new
148
162
  values.to_a.each do |k,v|
@@ -3,10 +3,6 @@
3
3
  # validates :id_number, must_be_present => true, is_a_curacao_id_number => true;
4
4
  class IsACuracaoIdNumberValidator < ActiveModel::EachValidator
5
5
 
6
- def help_message
7
- "Een geldig ID nummer bestaat uit:<br />4 cijfers voor het jaar<br />2 cijfers voor de maand<br />2 cijfers voor de dag<br />2 cijfers voor het volgnummer<br />Bijvoorbeeld: 1990021123."
8
- end
9
-
10
6
  def validate_each(record, attribute, value)
11
7
  if value =~ /^[0-9]{10}$/
12
8
  year = value[0..3].to_i
@@ -16,11 +12,13 @@ class IsACuracaoIdNumberValidator < ActiveModel::EachValidator
16
12
  begin
17
13
  DateTime.civil(year, month, day)
18
14
  rescue ArgumentError
19
- record.errors[attribute] << (options[:message] || "is geen geldig ID nummer voor Curacao." )
15
+ record.errors.add(attribute.to_sym, options[:message] || "too_short" )
20
16
  end
21
17
  else
22
- record.errors[attribute] << (options[:message] || "moet bestaan uit tien cijfers (bijvoorbeeld 1983040812)." )
18
+ record.errors.add(attribute.to_sym, options[:message] || "not_a_number" )
23
19
  end
24
20
  end
25
21
 
26
22
  end
23
+
24
+ #"moet bestaan uit tien cijfers (bijvoorbeeld 1983040812)."
@@ -25,10 +25,6 @@ class IsEmailAddressValidator < ActiveModel::EachValidator
25
25
  "is not a valid email address."
26
26
  end
27
27
 
28
- def help_message
29
- "Needs to be a valid email address."
30
- end
31
-
32
28
  def validate_each(record, attribute, value)
33
29
  unless value =~ EmailAddress
34
30
  record.errors[attribute] << (options[:message] || error_message )
@@ -10,7 +10,6 @@ class MustBeAValueValidator < ActiveModel::EachValidator
10
10
  end
11
11
 
12
12
  def help_message
13
- "U dient een keuze te maken."
14
13
  end
15
14
 
16
15
  def validate_each(record, attribute, value)
@@ -4,8 +4,5 @@ class MustBeUniqueValidator < ActiveRecord::Validations::UniquenessValidator
4
4
  "is not a unique."
5
5
  end
6
6
 
7
- def help_message
8
- "Moet uniek zijn (mag niet twee keer voorkomen)."
9
- end
10
7
 
11
8
  end
@@ -1,16 +1,13 @@
1
- <div id="large_title"><%= application_name -%></div>
2
- <div id="flash_message">
3
- <%= devise_error_messages!.empty? ? 'Please provide your email and we will send you instructions' : devise_error_messages! -%>
4
- </div>
1
+ <% @default_message = 'provide_email_and_we_send_instructions' -%>
2
+ <%= render :partial => "devise/shared/header_and_errors" %>
5
3
 
6
4
  <div id="sign_in">
7
5
  <div id="sign_in_form">
8
6
  <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
9
7
  <br /> <%= f.email_field :email %><br /><br />
10
- <div><%= f.submit "Send me instructions" %></div>
8
+ <div><%= f.submit t("inline_forms.devise.send_instructions") %></div>
11
9
  <% end %>
12
10
  </div>
13
11
  </div>
14
- <div id="shared_links">
15
- <%= render :partial => "devise/shared/links" %>
16
- </div>
12
+
13
+ <%= render :partial => "devise/shared/links" %>
@@ -1,16 +1,17 @@
1
- <h2>Change your password</h2>
1
+ <% @default_message = 'change_password' -%>
2
+ <%= render :partial => "devise/shared/header_and_errors" %>
2
3
 
4
+ <div id="sign_in">
5
+ <div id="sign_in_form">
3
6
  <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4
- <%= devise_error_messages! %>
5
7
  <%= f.hidden_field :reset_password_token %>
6
-
7
- <p><%= f.label :password, "New password" %><br />
8
- <%= f.password_field :password %></p>
9
-
10
- <p><%= f.label :password_confirmation, "Confirm new password" %><br />
11
- <%= f.password_field :password_confirmation %></p>
12
-
13
- <p><%= f.submit "Change my password" %></p>
14
- <% end %>
8
+ <div class="float_right"><%= f.label :password %>&nbsp;&nbsp;<%= f.password_field :password %></div>
9
+ <div style="clear: both"></div>
10
+ <div class="float_right"><%= f.label :password_confirmation %>&nbsp;&nbsp;<%= f.password_field :password_confirmation %></div>
11
+ <div style="clear: both"></div>
12
+ <div><%= f.submit t("inline_forms.devise.submit.change_password") %></div>
13
+ <% end %>
14
+ </div>
15
+ </div>
15
16
 
16
17
  <%= render :partial => "devise/shared/links" %>
@@ -1,17 +1,14 @@
1
- <div id="large_title"><%= application_name -%></div>
2
- <div id="flash_message">
3
- <%= devise_error_messages!.empty? ? 'Please provide your email and we will send you instructions' : devise_error_messages! -%>
4
- </div>
1
+ <% @default_message = 'provide_email_and_we_send_instructions' -%>
2
+ <%= render :partial => "devise/shared/header_and_errors" %>
5
3
 
6
4
  <div id="sign_in">
7
5
  <div id="sign_in_form">
8
6
  <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
9
7
  <br /> <%= f.email_field :email %><br /><br />
10
- <div><%= f.submit "Send me instructions" %></div>
8
+ <div><%= f.submit t("inline_forms.devise.send_instructions") %></div>
11
9
  <% end %>
12
10
  </div>
13
11
  </div>
14
- <div id="shared_links">
15
- <%= render :partial => "devise/shared/links" %>
16
- </div>
12
+
13
+ <%= render :partial => "devise/shared/links" %>
17
14
 
@@ -1,7 +1,5 @@
1
- <div id="large_title"><%= application_name -%></div>
2
- <div id="flash_message">
3
- <%= devise_error_messages!.empty? ? 'Please signup with your name, email and password' : devise_error_messages! -%>
4
- </div>
1
+ <% @default_message = 'signup_with_email_name_and_password' -%>
2
+ <%= render :partial => "devise/shared/header_and_errors" %>
5
3
 
6
4
  <div id="sign_in">
7
5
  <div id="sign_in_form">
@@ -15,11 +13,10 @@
15
13
  <div class="float_right"><%= f.label :password_confirmation %>&nbsp;&nbsp;<%= f.password_field :password_confirmation %></div>
16
14
  <div style="clear: both"></div>
17
15
 
18
- <div><%= f.submit "Sign up" %></div>
16
+ <div><%= f.submit t("inline_forms.devise.sign_up") %></div>
19
17
  <% end %>
20
18
  </div>
21
19
  </div>
22
- <div id="shared_links">
23
- <%= render :partial => "devise/shared/links" %>
24
- </div>
20
+
21
+ <%= render :partial => "devise/shared/links" %>
25
22
 
@@ -1,17 +1,13 @@
1
- <div id="large_title"><%= application_name -%></div>
2
- <div id="flash_message">
3
- <%= devise_error_messages!.empty? ? 'Please login with your email address and password' : devise_error_messages! -%>
4
- </div>
1
+ <% @default_message = 'login_with_email_and_password' -%>
2
+ <%= render :partial => "devise/shared/header_and_errors" %>
5
3
 
6
4
  <div id="sign_in">
7
5
  <div id="sign_in_form">
8
6
  <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
9
7
  <br /> <%= f.email_field :email %><br />
10
8
  <%= f.password_field :password %><br />
11
- <p><%= f.submit "Sign in" %></p>
9
+ <p><%= f.submit t("inline_forms.devise.sign_in") %></p>
12
10
  <% end %>
13
11
  </div>
14
12
  </div>
15
- <div id="shared_links">
16
- <%= render :partial => "devise/shared/links" %>
17
- </div>
13
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,4 @@
1
+ <div id="large_title"><%= t application_name -%></div>
2
+ <div id="flash_message">
3
+ <%= devise_error_messages!.empty? ? t("inline_forms.devise.#{@default_message}") : devise_error_messages! -%>
4
+ </div>
@@ -1,25 +1,27 @@
1
- | <%- if controller_name != 'sessions' %>
2
- <%= link_to "Sign in", new_session_path(resource_name) %> |
3
- <% end -%>
1
+ <div id="shared_links">
2
+ | <%- if controller_name != 'sessions' %>
3
+ <%= link_to t("inline_forms.devise.links.sign_in"), new_session_path(resource_name) %> |
4
+ <% end -%>
4
5
 
5
- <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
- <%= link_to "Sign up", new_registration_path(resource_name) %> |
7
- <% end -%>
6
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
7
+ <%= link_to t("inline_forms.devise.links.sign_up"), new_registration_path(resource_name) %> |
8
+ <% end -%>
8
9
 
9
- <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10
- <%= link_to "Forgot your password?", new_password_path(resource_name) %> |
11
- <% end -%>
10
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
11
+ <%= link_to t("inline_forms.devise.links.forgot_password"), new_password_path(resource_name) %> |
12
+ <% end -%>
12
13
 
13
- <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %> |
15
- <% end -%>
14
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
15
+ <%= link_to t("inline_forms.devise.links.no_instructions"), new_confirmation_path(resource_name) %> |
16
+ <% end -%>
16
17
 
17
- <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
- <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %> |
19
- <% end -%>
18
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
19
+ <%= link_to t("inline_forms.devise.links.no_unlock_instructions"), new_unlock_path(resource_name) %> |
20
+ <% end -%>
20
21
 
21
- <%- if devise_mapping.omniauthable? %>
22
- <%- resource_class.omniauth_providers.each do |provider| %>
23
- <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %> |
22
+ <%- if devise_mapping.omniauthable? %>
23
+ <%- resource_class.omniauth_providers.each do |provider| %>
24
+ <%= link_to t("inline_forms.devise.links.sign_in_with", :provider => provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) %> |
25
+ <% end -%>
24
26
  <% end -%>
25
- <% end -%>
27
+ </div>
@@ -1,16 +1,13 @@
1
- <div id="large_title"><%= application_name -%></div>
2
- <div id="flash_message">
3
- <%= devise_error_messages!.empty? ? 'Please provide your email and we will send you instructions' : devise_error_messages! -%>
4
- </div>
1
+ <% @default_message = 'provide_email_and_we_send_instructions' -%>
2
+ <%= render :partial => "devise/shared/header_and_errors" %>
5
3
 
6
4
  <div id="sign_in">
7
5
  <div id="sign_in_form">
8
6
  <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
9
7
  <br /> <%= f.email_field :email %><br /><br />
10
- <div><%= f.submit "Send me instructions" %></div>
8
+ <div><%= f.submit t("inline_forms.devise.send_instructions") %></div>
11
9
  <% end %>
12
10
  </div>
13
11
  </div>
14
- <div id="shared_links">
15
- <%= render :partial => "devise/shared/links" %>
16
- </div>
12
+
13
+ <%= render :partial => "devise/shared/links" %>
@@ -1,2 +1,2 @@
1
- <%= link_to_destroy('del',@object, @update_span) -%>
1
+ <%= link_to_destroy(@object, @update_span) -%>
2
2
  <%= link_to h(@object._presentation), send(@object.class.to_s.underscore + "_path", @object, :update => @update_span), :remote => true -%>
@@ -1,8 +1,8 @@
1
1
  <% flash.each do |key, value| %>
2
2
  <div id="flash" class="flash <%= key %>"><%= value %></div>
3
- <script type="text/javascript">
4
- $(function() { $("#flash").delay(1000).fadeToggle('2000'); } );
5
- </script>
3
+ <%#*<script type="text/javascript">%>
4
+ <%#*$(function() { $("#flash").delay(1000).fadeToggle('2000'); } );%>
5
+ <%#*</script>%>
6
6
  <% end %>
7
7
 
8
8
  <!-- purpose: list objects. we come here from #index and from #new.
@@ -18,31 +18,28 @@ they are @object. We need this magic here to rewrite all the @variables to varia
18
18
  <% # the controller didn't give us a parent_class, this means we are here for the 'first' time %>
19
19
  <% # we have to rely on the @Klass set in the controller %>
20
20
  <% update_span = @Klass.to_s.pluralize.downcase + '_list' %>
21
- <% human_readable_class = @Klass.to_s.humanize.downcase %>
22
21
  <% path_to_new = "new_#{@Klass.to_s.singularize.underscore}_path" %>
23
22
  <% parent_class = nil %>
24
23
  <% parent_id = nil %>
25
24
  <% objects = @objects %>
26
- <% model_name = @Klass.to_s %>
25
+ <% model = @Klass %>
27
26
  <% else %>
28
27
  <% # the controller gave us an @parent_class, so ... %>
29
28
  <% attribute = @Klass.to_s.underscore.pluralize %>
30
29
  <% update_span = "#{@parent_class.to_s.underscore}_#{@parent_id}_#{attribute}_list" -%>
31
- <% human_readable_class= attribute.to_s.singularize.humanize.downcase %>
32
30
  <% path_to_new='new_' + attribute.to_s.underscore.singularize + '_path' %>
33
31
  <% parent_class=@parent_class.constantize %>
34
32
  <% parent_id=@parent_id %>
35
33
  <% objects = @objects %>
36
34
  <% ul_needed = false unless @ul_needed %>
37
- <% model_name = attribute.to_s.singularize.camelcase %>
35
+ <% model = attribute.to_s.singularize.camelcase.constantize %>
38
36
  <% end %>
39
37
  <% else %>
40
38
  <% # here we come from _show %>
41
39
  <% update_span = "#{parent_class.to_s.underscore}_#{parent_id}_#{attribute}_list" -%>
42
- <% human_readable_class = attribute.to_s.singularize.humanize.downcase %>
43
40
  <% path_to_new='new_' + attribute.to_s.singularize + '_path' %>
44
41
  <% conditions = [ "#{parent_class.name.foreign_key} = ?", parent_id ] %>
45
- <% model_name = attribute.to_s.singularize.camelcase %>
42
+ <% model = attribute.to_s.singularize.camelcase.constantize %>
46
43
 
47
44
  <% if cancan_enabled? %>
48
45
  <% objects = parent_class.find(parent_id).send(attribute).accessible_by(current_ability).order(attribute.to_s.singularize.camelcase.constantize.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 5, :conditions => conditions %>
@@ -54,7 +51,7 @@ they are @object. We need this magic here to rewrite all the @variables to varia
54
51
 
55
52
  <%= raw "<ul id=\"#{update_span}\" class=\"inline_forms_list\">" if ul_needed -%>
56
53
  <!-- # link to new -->
57
- <%= link_to_new_record("Add a new #{human_readable_class}", model_name, path_to_new, update_span, parent_class, parent_id) -%>
54
+ <%= link_to_new_record(model, path_to_new, update_span, parent_class, parent_id) -%>
58
55
  <!-- # list of objects -->
59
56
  <% for object in objects %>
60
57
  <% if parent_class.nil? %>
@@ -65,7 +62,7 @@ they are @object. We need this magic here to rewrite all the @variables to varia
65
62
  <% path_to_object = attribute.to_s.singularize.underscore + "_path" %>
66
63
  <% end %>
67
64
  <li id="<%= css_class_id -%>" class="<%= cycle('odd', 'even') -%>" >
68
- <%= link_to_destroy('del',object, css_class_id) -%>
65
+ <%= link_to_destroy(object, css_class_id) -%>
69
66
  <%= link_to h(object._presentation),
70
67
  send( path_to_object, object, :update => css_class_id),
71
68
  :remote => true -%>