inline_forms 1.6.50 → 1.6.51
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/app/assets/javascripts/inline_forms.js +11 -3
- data/lib/app/assets/javascripts/inline_forms_application.js +2 -2
- data/lib/app/assets/stylesheets/inline_forms.css +0 -15
- data/lib/app/assets/stylesheets/inline_forms_application.css +2 -1
- data/lib/app/helpers/form_elements/check_list.rb +4 -10
- data/lib/app/helpers/form_elements/date.rb +2 -2
- data/lib/app/helpers/form_elements/dropdown.rb +1 -1
- data/lib/app/helpers/form_elements/dropdown_with_values.rb +1 -1
- data/lib/app/helpers/form_elements/plain_text_area.rb +1 -1
- data/lib/app/helpers/form_elements/radio_button.rb +5 -6
- data/lib/app/helpers/form_elements/text_area_without_ckeditor.rb +1 -1
- data/lib/app/helpers/form_elements/text_field.rb +1 -1
- data/lib/app/views/inline_forms/_new.html.erb +3 -11
- data/lib/app/views/inline_forms/_new_nested.html.erb +43 -0
- data/lib/app/views/inline_forms/_show.html.erb +59 -55
- data/lib/inline_forms/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzJiZTRmZmVlYzA5OTVkNGFhMDE4ZGZmMGI1MGI5MzY0MTA2N2QwYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDIyZDhjMTUxNmQyOTk0M2ViNzkyY2M5YjFiZDhjYTY2NTA4Y2VhMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGEyYWViNjA5YzE0MmZhYWFjM2ZkZDAxYjQyZTI4MjM1ZmZkYzdlNmVkYzlj
|
10
|
+
OWExZDg1NGE5NWM0NTE4YTI3ZGYxYThkNDY2YmVmYWU2NjQ1NjMxZTdlODc5
|
11
|
+
YjRlYjI2Mjg0YzMyNzBlOTkzZjA1YWYwZWRlNDA1Y2EzZThmNmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDBlYmVhNWU1ZDBlOWQyNzQyMWMzYjBlZGM2MzY5ZDdkMmE1YTAxMjhhMTcz
|
14
|
+
MTE1MTNlYWRmOGQxOGFkNTJlOWQyMTcyYzk3M2YwOGU2YzJjYjE5ZTk4MWFk
|
15
|
+
MDVkOWJlNjU1ZjgwNTkxZDI4YWZhOWMzY2JmNTgwMmYwYTNhNDk=
|
@@ -1,6 +1,14 @@
|
|
1
|
+
$(document).foundation();
|
2
|
+
|
1
3
|
$(document).ready(function() {
|
4
|
+
// initialize datepickers
|
5
|
+
$.datepicker.setDefaults({
|
6
|
+
changeMonth : true,
|
7
|
+
changeYear : true,
|
8
|
+
yearRange: '-100:+1'
|
9
|
+
});
|
2
10
|
// get rid of translation_missing tooltips
|
3
|
-
|
4
|
-
|
5
|
-
|
11
|
+
$(this).on("mouseover", ".translation_missing", function() {
|
12
|
+
$(this).attr('title', '');
|
13
|
+
});
|
6
14
|
});
|
@@ -6,11 +6,11 @@
|
|
6
6
|
//
|
7
7
|
//= require jquery
|
8
8
|
//= require jquery_ujs
|
9
|
+
//= require jquery.ui.all
|
10
|
+
//= require jquery.ui.datepicker-nl.js
|
9
11
|
//= require foundation
|
10
|
-
//= require foundation-datetimepicker
|
11
12
|
//= require jquery-scrollto
|
12
13
|
//= require jquery.remotipart
|
13
14
|
//= require ckeditor/init
|
14
15
|
//= require inline_forms
|
15
16
|
|
16
|
-
$(document).foundation();
|
@@ -63,21 +63,6 @@
|
|
63
63
|
font-family: monospace;
|
64
64
|
}
|
65
65
|
|
66
|
-
.ui-tooltip-content ul {
|
67
|
-
padding: 0;
|
68
|
-
margin: 0;
|
69
|
-
list-style-type: none;
|
70
|
-
}
|
71
|
-
|
72
|
-
.ui-tooltip-content ul li {
|
73
|
-
margin-left: 20px;
|
74
|
-
}
|
75
|
-
|
76
|
-
.ui-tooltip-content ul li:first-letter
|
77
|
-
{
|
78
|
-
margin-left: -20px;
|
79
|
-
}
|
80
|
-
|
81
66
|
|
82
67
|
/* LEFT */
|
83
68
|
|
@@ -2,5 +2,6 @@
|
|
2
2
|
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
3
|
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
4
|
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
-
|
5
|
+
*
|
6
|
+
*= require inline_forms
|
6
7
|
*/
|
@@ -4,7 +4,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:check_list]=:no_migration
|
|
4
4
|
# checklist
|
5
5
|
def check_list_show(object, attribute)
|
6
6
|
out = '<ul class="checklist">'
|
7
|
-
out << link_to_inline_edit(object, attribute) if object.send(attribute).empty?
|
7
|
+
out << link_to_inline_edit(object, attribute, "<i class='fi-plus'></i>".html_safe) if object.send(attribute).empty?
|
8
8
|
object.send(attribute).sort.each do | item |
|
9
9
|
out << '<li>'
|
10
10
|
out << link_to_inline_edit(object, attribute, item._presentation )
|
@@ -21,19 +21,13 @@ def check_list_edit(object, attribute)
|
|
21
21
|
else
|
22
22
|
values = object.send(attribute).first.class.name.constantize.order(attribute.to_s.singularize.camelcase.constantize.order_by_clause)
|
23
23
|
end
|
24
|
-
out = '
|
25
|
-
out << '<ul>'
|
24
|
+
out = ''
|
26
25
|
values.each do | item |
|
27
|
-
out << '
|
26
|
+
out << "<div class='row #{cycle('odd', 'even')}'>"
|
28
27
|
out << check_box_tag( attribute.to_s + '[' + item.id.to_s + ']', 1, object.send(attribute.to_s.singularize + "_ids").include?(item.id) )
|
29
|
-
out <<
|
30
|
-
out << h(item._presentation)
|
28
|
+
out << "<label for=#{attribute.to_s + '[' + item.id.to_s + ']'}>#{h(item._presentation)}</label>"
|
31
29
|
out << '</div>'
|
32
|
-
out << '<div style="clear: both;"></div>'
|
33
|
-
out << '</li>'
|
34
30
|
end
|
35
|
-
out << '</ul>'
|
36
|
-
out << '</div>'
|
37
31
|
out.html_safe
|
38
32
|
end
|
39
33
|
|
@@ -3,13 +3,13 @@ InlineForms::SPECIAL_COLUMN_TYPES[:date_select]=:date
|
|
3
3
|
|
4
4
|
# date
|
5
5
|
def date_select_show(object, attribute)
|
6
|
-
link_to_inline_edit object, attribute, object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y")
|
6
|
+
link_to_inline_edit object, attribute, object.send(attribute).nil? ? "<i class='fi-plus'></i>".html_safe : object.send(attribute).strftime("%d-%m-%Y")
|
7
7
|
end
|
8
8
|
|
9
9
|
def date_select_edit(object, attribute)
|
10
10
|
css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
|
11
11
|
out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => css_id, :class =>'datepicker'
|
12
|
-
out << "<script>$('##{css_id}').
|
12
|
+
out << "<script>$('##{css_id}').datepicker();</script>".html_safe
|
13
13
|
end
|
14
14
|
|
15
15
|
def date_select_update(object, attribute)
|
@@ -3,7 +3,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown]=:belongs_to
|
|
3
3
|
|
4
4
|
# dropdown
|
5
5
|
def dropdown_show(object, attribute)
|
6
|
-
attribute_value = object.send(attribute)._presentation rescue
|
6
|
+
attribute_value = object.send(attribute)._presentation rescue "<i class='fi-plus'></i>".html_safe
|
7
7
|
link_to_inline_edit object, attribute, attribute_value
|
8
8
|
end
|
9
9
|
|
@@ -4,7 +4,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_values]=:integer
|
|
4
4
|
# dropdown_with_values
|
5
5
|
def dropdown_with_values_show(object, attribute)
|
6
6
|
values = attribute_values(object, attribute)
|
7
|
-
link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : ""
|
7
|
+
link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : "<i class='fi-plus'></i>".html_safe
|
8
8
|
end
|
9
9
|
def dropdown_with_values_edit(object, attribute)
|
10
10
|
# the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
|
@@ -2,7 +2,7 @@
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:plain_text_area]=:text
|
3
3
|
|
4
4
|
def plain_text_area_show(object, attribute)
|
5
|
-
link_to_inline_edit object, attribute, object[attribute]
|
5
|
+
link_to_inline_edit object, attribute, (object[attribute].nil? || object[attribute].empty?) ? "<i class='fi-plus'></i>".html_safe : object[attribute]
|
6
6
|
end
|
7
7
|
|
8
8
|
def plain_text_area_edit(object, attribute)
|
@@ -10,16 +10,15 @@ def radio_button_show(object, attribute)
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def radio_button_edit(object, attribute)
|
13
|
-
out ='
|
13
|
+
out =''
|
14
14
|
values = attribute_values(object, attribute)
|
15
15
|
values.each do |key,value|
|
16
|
-
out << '
|
16
|
+
out << "<div class='row #{cycle('odd', 'even')}'>"
|
17
17
|
out << radio_button_tag(attribute.to_s, key, key == object.send(attribute))
|
18
|
-
out << value
|
19
|
-
out << '</
|
18
|
+
out << "<label for=#{key}>#{value}</label>"
|
19
|
+
out << '</div>'
|
20
20
|
end
|
21
|
-
out
|
22
|
-
raw out
|
21
|
+
out.html_safe
|
23
22
|
end
|
24
23
|
|
25
24
|
def radio_button_update(object, attribute)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:text_area_without_ckeditor]=:text
|
3
3
|
|
4
4
|
def text_area_without_ckeditor_show(object, attribute)
|
5
|
-
link_to_inline_edit object, attribute, object[attribute]
|
5
|
+
link_to_inline_edit object, attribute, (object[attribute].nil? || object[attribute].empty?) ? "<i class='fi-plus'></i>".html_safe : object[attribute]
|
6
6
|
end
|
7
7
|
|
8
8
|
def text_area_without_ckeditor_edit(object, attribute)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:text_field]=:string
|
3
3
|
|
4
4
|
def text_field_show(object, attribute)
|
5
|
-
link_to_inline_edit object, attribute, (object.
|
5
|
+
link_to_inline_edit object, attribute, (object[attribute].nil? || object[attribute].empty?) ? "<i class='fi-plus'></i>".html_safe : object[attribute]
|
6
6
|
end
|
7
7
|
|
8
8
|
def text_field_edit(object, attribute)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="new_record">
|
1
|
+
<div class="new_record"">
|
2
2
|
<% flash.each do |key, value| %>
|
3
3
|
<div id="flash" class="flash <%= key %>">
|
4
4
|
<ul>
|
@@ -10,16 +10,13 @@
|
|
10
10
|
</ul>
|
11
11
|
</div>
|
12
12
|
<% end %>
|
13
|
-
|
14
|
-
$(function() {
|
15
|
-
$("#flash").delay(1000).fadeTo('slow', 0.33);
|
16
|
-
});
|
17
|
-
</script>
|
13
|
+
|
18
14
|
<div class="row" >
|
19
15
|
<div class="large-12 column object_presentation" >
|
20
16
|
<%= t('inline_forms.view.add_new', :model => @Klass.model_name.human ) -%>
|
21
17
|
</div>
|
22
18
|
</div>
|
19
|
+
|
23
20
|
<%= form_tag send(@Klass.to_s.underscore.pluralize + '_path', :update => @update_span,
|
24
21
|
:parent_class => @parent_class,
|
25
22
|
:parent_id => @parent_id ),
|
@@ -61,9 +58,4 @@
|
|
61
58
|
</div>
|
62
59
|
<div class="row record_footer"></div>
|
63
60
|
<% end %>
|
64
|
-
<script type="text/javascript">
|
65
|
-
$(function() {
|
66
|
-
$("#new_record").slideDown(4000);
|
67
|
-
});
|
68
|
-
</script>
|
69
61
|
</div>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
This goes in _new.html.erb
|
2
|
+
<% if form_element.to_sym == :associated -%>
|
3
|
+
<% @nested_model = @object.send(attribute) %>
|
4
|
+
<%= render 'new_nested' %>
|
5
|
+
<% end %>
|
6
|
+
********
|
7
|
+
|
8
|
+
<% @nested_object = @nested_model.build %>
|
9
|
+
|
10
|
+
<div class="new_nested_record">
|
11
|
+
<div class="row" >
|
12
|
+
<div class="large-12 column object_presentation" >
|
13
|
+
<%= t('inline_forms.view.add_new', :model => @nested_object.class ) -%>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<% nested_attributes = @nested_object.inline_forms_attribute_list -%>
|
17
|
+
<% nested_attributes.each do | nested_attribute, nested_name, nested_form_element | -%>
|
18
|
+
<% @nested_form_element = nested_form_element %>
|
19
|
+
<% @nested_attribute = nested_attribute %>
|
20
|
+
<% unless @nested_form_element.to_sym == :associated -%>
|
21
|
+
<% if @nested_form_element == :header %>
|
22
|
+
<div class="row form_element_header" >
|
23
|
+
<div class='large-12 column' >
|
24
|
+
<%= @nested_object.class.human_attribute_name(@nested_attribute) -%>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<% else %>
|
28
|
+
<div class="row <%= cycle('odd', 'even') %>">
|
29
|
+
<div class='medium-3 large-3 column' >
|
30
|
+
<%= @nested_object.class.human_attribute_name(@nested_attribute) -%>
|
31
|
+
</div>
|
32
|
+
<div class='medium-9 large-9 column' >
|
33
|
+
<%= send("#{@nested_form_element}_edit", @nested_object, @nested_attribute) -%>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
<% end -%>
|
37
|
+
<% end -%>
|
38
|
+
<% end -%>
|
39
|
+
<% if @nested_form_element.to_sym == :associated -%>
|
40
|
+
<%= render 'new_nested' %>
|
41
|
+
<% end %>
|
42
|
+
<div class="row record_footer"></div>
|
43
|
+
</div>
|
@@ -1,60 +1,64 @@
|
|
1
|
-
|
2
|
-
<div class=
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<% end %>
|
11
|
-
<% attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list -%>
|
12
|
-
<% attributes.each do | attribute, name, form_element | -%>
|
13
|
-
<% if cancan_disabled? || can?(:read, @object, attribute) %>
|
14
|
-
<% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_#{attribute}" -%>
|
15
|
-
<% if form_element == :header %>
|
16
|
-
<div class="row form_element_header">
|
17
|
-
<div class='large-12 column' >
|
18
|
-
<%= @object.class.human_attribute_name(attribute) -%>
|
19
|
-
</div>
|
1
|
+
<div class="row">
|
2
|
+
<div class='small-11 small-centered column'>
|
3
|
+
<% unless @skip %>
|
4
|
+
<div class="row object_presentation">
|
5
|
+
<div class="small-11 column object_presentation">
|
6
|
+
<%= h(@object._presentation) -%>
|
7
|
+
</div>
|
8
|
+
<div class="small-1 column close_link" >
|
9
|
+
<%= close_link(@object, @update_span) -%>
|
20
10
|
</div>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
</div>
|
31
|
-
<div class="row <%= cycle('odd', 'even') %>">
|
32
|
-
<div id="<%= css_class_id -%>" class='small-11 small-centered column' >
|
33
|
-
<%= render :partial => "inline_forms/list",
|
34
|
-
:locals => { :parent_class => @object.class,
|
35
|
-
:parent_id => @object.id,
|
36
|
-
:attribute => attribute } %>
|
37
|
-
</div>
|
38
|
-
</div>
|
39
|
-
<% else -%>
|
40
|
-
<div class="row <%= cycle('odd', 'even') %>">
|
41
|
-
<div class='medium-3 large-3 column' >
|
42
|
-
<% if @object.has_validations_for?(attribute) -%>
|
43
|
-
<span data-tooltip class="has-tip tip-top" title="<%= validation_hints_as_list_for(@object, attribute) -%>">
|
44
|
-
<%= @object.class.human_attribute_name(attribute) -%>
|
45
|
-
</span>
|
46
|
-
<% else %>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
<% attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list -%>
|
14
|
+
<% attributes.each do | attribute, name, form_element | -%>
|
15
|
+
<% if cancan_disabled? || can?(:read, @object, attribute) %>
|
16
|
+
<% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_#{attribute}" -%>
|
17
|
+
<% if form_element == :header %>
|
18
|
+
<div class="row form_element_header">
|
19
|
+
<div class='large-12 column' >
|
47
20
|
<%= @object.class.human_attribute_name(attribute) -%>
|
48
|
-
|
21
|
+
</div>
|
49
22
|
</div>
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
23
|
+
<% else %>
|
24
|
+
<% if form_element == :associated -%>
|
25
|
+
<div class="row form_element_header associated_auto_header" id="<%= css_class_id -%>_list_auto_header" >
|
26
|
+
<div class='medium-11 large-11 column' >
|
27
|
+
<%= @object.class.human_attribute_name(attribute) -%>
|
28
|
+
</div>
|
29
|
+
<div class='medium-1 large-1 column'>
|
30
|
+
<%= link_to_new_record(attribute.to_s.singularize.camelcase.constantize, "new_#{attribute.to_s.underscore.singularize}_path", css_class_id, @object.class, @object.id) -%>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
<div class="row <%= cycle('odd', 'even') %>">
|
34
|
+
<div id="<%= css_class_id -%>" class='small-11 small-centered column' >
|
35
|
+
<%= render :partial => "inline_forms/list",
|
36
|
+
:locals => { :parent_class => @object.class,
|
37
|
+
:parent_id => @object.id,
|
38
|
+
:attribute => attribute } %>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
<% else -%>
|
42
|
+
<div class="row <%= cycle('odd', 'even') %>">
|
43
|
+
<div class='medium-3 large-3 column' >
|
44
|
+
<% if @object.has_validations_for?(attribute) -%>
|
45
|
+
<span data-tooltip class="has-tip tip-top" title="<%= validation_hints_as_list_for(@object, attribute) -%>">
|
46
|
+
<%= @object.class.human_attribute_name(attribute) -%>
|
47
|
+
</span>
|
48
|
+
<% else %>
|
49
|
+
<%= @object.class.human_attribute_name(attribute) -%>
|
50
|
+
<% end %>
|
51
|
+
</div>
|
52
|
+
<div class='medium-9 large-9 column' >
|
53
|
+
<span id="<%= css_class_id -%>" >
|
54
|
+
<%= send("#{form_element}_show", @object, attribute) -%>
|
55
|
+
</span>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<% end -%>
|
59
|
+
<% end -%>
|
56
60
|
<% end -%>
|
57
61
|
<% end -%>
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
<div class="record_footer"></div>
|
63
|
+
</div>
|
64
|
+
</div>
|
data/lib/inline_forms/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ace Suares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rvm
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- lib/app/views/inline_forms/_header.html.erb
|
233
233
|
- lib/app/views/inline_forms/_list.html.erb
|
234
234
|
- lib/app/views/inline_forms/_new.html.erb
|
235
|
+
- lib/app/views/inline_forms/_new_nested.html.erb
|
235
236
|
- lib/app/views/inline_forms/_show.html.erb
|
236
237
|
- lib/app/views/inline_forms/close.js.erb
|
237
238
|
- lib/app/views/inline_forms/edit.js.erb
|