inline_forms 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/app/helpers/form_elements/devise_password_field.rb +5 -1
- data/lib/app/helpers/form_elements/info.rb +10 -8
- data/lib/app/helpers/inline_forms_helper.rb +3 -3
- data/lib/app/views/inline_forms/_new.html.erb +0 -1
- data/lib/app/views/inline_forms/_show.html.erb +3 -10
- data/lib/inline_forms/version.rb +1 -1
- metadata +1 -1
@@ -10,6 +10,10 @@ def devise_password_field_edit(object, attribute)
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def devise_password_field_update(object, attribute)
|
13
|
-
|
13
|
+
if params[attribute.to_sym].blank?
|
14
|
+
# nothing happens
|
15
|
+
else
|
16
|
+
object.password = params[attribute.to_sym]
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
@@ -2,13 +2,15 @@
|
|
2
2
|
# not needed here, since this is only used in the views InlineForms::SPECIAL_COLUMN_TYPES[:info]=:string
|
3
3
|
|
4
4
|
def info_show(object, attribute)
|
5
|
-
object.send attribute.to_sym
|
6
|
-
|
7
|
-
|
8
|
-
def info_edit(object, attribute)
|
9
|
-
object[attribute]
|
10
|
-
end
|
11
|
-
|
12
|
-
def info_update(object, attribute)
|
5
|
+
o = object.send attribute.to_sym
|
6
|
+
o = o.to_s + " (" + distance_of_time_in_words_to_now(o) + " ago )" if o.is_a?(Time)
|
7
|
+
o
|
13
8
|
end
|
14
9
|
|
10
|
+
#def info_edit(object, attribute)
|
11
|
+
# object[attribute]
|
12
|
+
#end
|
13
|
+
#
|
14
|
+
#def info_update(object, attribute)
|
15
|
+
#end
|
16
|
+
#
|
@@ -52,10 +52,10 @@ module InlineFormsHelper
|
|
52
52
|
# link_to_inline_edit
|
53
53
|
def link_to_inline_edit(object, attribute, attribute_value='')
|
54
54
|
spaces = attribute_value.length > 40 ? 0 : 40 - attribute_value.length
|
55
|
-
h(attribute_value)
|
55
|
+
value = h(attribute_value) + (" " * spaces).html_safe
|
56
56
|
css_class_id = "#{object.class.to_s.underscore}_#{object.id}_#{attribute}"
|
57
57
|
if cancan_disabled? || ( can? :update, object )
|
58
|
-
link_to
|
58
|
+
link_to value,
|
59
59
|
send( 'edit_' + object.class.to_s.underscore + '_path',
|
60
60
|
object,
|
61
61
|
:attribute => attribute.to_s,
|
@@ -63,7 +63,7 @@ module InlineFormsHelper
|
|
63
63
|
:update => css_class_id ),
|
64
64
|
:remote => true
|
65
65
|
else
|
66
|
-
attribute_value
|
66
|
+
h(attribute_value)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -11,7 +11,6 @@
|
|
11
11
|
<script type="text/javascript">
|
12
12
|
$(function() { $("#flash").delay(1000).fadeTo('slow', 0.33); } );
|
13
13
|
</script>
|
14
|
-
<span class="tfdssdfsdfsdranslation_missing" title="translation missing: en.activerecord.attributes.apartment.name">Name</span>
|
15
14
|
<%= form_tag send(@Klass.to_s.underscore.pluralize + '_path', :update => @update_span,
|
16
15
|
:parent_class => @parent_class,
|
17
16
|
:parent_id => @parent_id ),
|
@@ -15,17 +15,10 @@
|
|
15
15
|
<% attributes.each do | attribute, name, form_element | -%>
|
16
16
|
<% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_#{attribute}" -%>
|
17
17
|
<tr>
|
18
|
-
<td valign="top">
|
19
|
-
<div class='<%=
|
20
|
-
<%=
|
18
|
+
<td valign="top" class="<%= 'has_validations ' if @object.has_validations_for?(attribute) -%>" validation-hint="<%= validation_hints_as_list_for(@object, attribute) -%>">
|
19
|
+
<div class='<%= "attribute_name attribute_#{attribute} form_element_#{form_element}" -%>' >
|
20
|
+
<%= @object.class.human_attribute_name(attribute) -%>
|
21
21
|
</div>
|
22
|
-
<% if @object.has_validations_for?(attribute) %>
|
23
|
-
<div class='validation_help_tooltip'>
|
24
|
-
<div class='validation_help_content'>
|
25
|
-
<%= validation_hints_as_list_for(@object, attribute) -%>
|
26
|
-
</div>
|
27
|
-
</div>
|
28
|
-
<% end -%>
|
29
22
|
</td>
|
30
23
|
<td valign="top">
|
31
24
|
<div class='<%= "attribute_value attribute_#{attribute} form_element_#{form_element}" -%>' >
|
data/lib/inline_forms/version.rb
CHANGED