inline_forms 3.0.11 → 3.0.12
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWY0MDc0YTVkZmRkZjM2NmZkMjdmZGU3NDI0NTNhMDkwOWE0NThjYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDZjMjBmMGExYzJiNWQzMDcxYzVhMjY2ZWMwOTkwOGRhZjE5MzQ1Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzYzM2QzODlhMWY5YjdlNTU1ZDBkYzY5N2I4ZDY2NzFiYzA5NWMwNWQ1ZmI3
|
10
|
+
Y2FkMmZkMWMwN2JhM2U4YzVhNTZiYTUxOTI5ZTMyNzVjZDRlNjcyNjkzZDEz
|
11
|
+
Y2IyNjFjMzQ2NmNkYWMwMmM0ZWE5NzBhYTg1NDI2ZDQyZTcwZjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjRlOTZlYmI0Mzk2ZjYwMTFkZGVkZDYyY2JlNDY2YjljMjE5ZWQ1ODc5MDE0
|
14
|
+
MGM4NjA5ZDQxYjhmYzhhOTExOTFlOGNlNTI1MWY2M2EzZjI3YzUzMWVhMDIx
|
15
|
+
MGM3MWFhYTM2MmRkZWNkZTA2MWEwMDRlNjY2ODE1ZDJmMjBjZDI=
|
@@ -175,6 +175,10 @@ class InlineFormsController < ApplicationController
|
|
175
175
|
@associated_record = @object.send(@attribute)[@associated_record_id]
|
176
176
|
end
|
177
177
|
end
|
178
|
+
if @form_element == "has_one"
|
179
|
+
@associated_record = @object.send(@attribute)
|
180
|
+
@associated_record_id = @associated_record.id
|
181
|
+
end
|
178
182
|
@update_span = params[:update]
|
179
183
|
if @attribute.nil?
|
180
184
|
respond_to do |format|
|
@@ -23,15 +23,21 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% else %>
|
25
25
|
<% # here we come from _show %>
|
26
|
-
<%
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<%
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
<% if form_element == :has_one %>
|
27
|
+
<% update_span = "#{parent_class.to_s.underscore}_#{parent_id}_#{attribute}_list" -%>
|
28
|
+
<% objects = [ parent_class.find(parent_id).send(attribute) ] %>
|
29
|
+
<% pagination = false %>
|
30
|
+
<% else %>
|
31
|
+
<% update_span = "#{parent_class.to_s.underscore}_#{parent_id}_#{attribute}_list" -%>
|
32
|
+
<% path_to_new='new_' + attribute.to_s.singularize + '_path' %>
|
33
|
+
<% foreign_key = parent_class.reflect_on_association(attribute.to_sym).options[:foreign_key] || parent_class.name.foreign_key -%>
|
34
|
+
<% model = attribute.to_s.singularize.camelcase.constantize %>
|
35
|
+
<% conditions = [ "#{model.table_name}.#{foreign_key} = ?", parent_id ] %>
|
36
|
+
<% objects = parent_class.find(parent_id).send(attribute) %>
|
37
|
+
<% objects = parent_class.find(parent_id).send(attribute).accessible_by(current_ability) if cancan_enabled? %>
|
38
|
+
<% objects = objects.order(attribute.to_s.singularize.camelcase.constantize.order_by_clause) if attribute.to_s.singularize.camelcase.constantize.respond_to?(:order_by_clause) && ! attribute.to_s.singularize.camelcase.constantize.order_by_clause.nil? %>
|
39
|
+
<% objects = objects.paginate :page => params[:page], :per_page => @PER_PAGE || 5, :conditions => conditions %>
|
40
|
+
<% end %>
|
35
41
|
<% end %>
|
36
42
|
|
37
43
|
<%= raw "<div class=\"list_container\" id=\"#{update_span}\">" if ul_needed -%>
|
@@ -68,7 +74,9 @@
|
|
68
74
|
<% if parent_id.nil? -%>
|
69
75
|
<% pagination = will_paginate objects -%>
|
70
76
|
<% else %>
|
71
|
-
<% pagination
|
77
|
+
<% if pagination %>
|
78
|
+
<% pagination = will_paginate objects, :remote => true, :params => {:controller => attribute, :action => :index, :id => nil, :parent_class => parent_class, :parent_id => parent_id, :update => "#{parent_class.to_s.underscore}_#{parent_id}_#{attribute}", :ul_needed => true } %>
|
79
|
+
<% end %>
|
72
80
|
<% end %>
|
73
81
|
<% if pagination %>
|
74
82
|
<div class="row <%= cycle('odd', 'even') %>">
|
@@ -45,7 +45,7 @@
|
|
45
45
|
:attribute => attribute } %>
|
46
46
|
</div>
|
47
47
|
</div>
|
48
|
-
<% else
|
48
|
+
<% else %>
|
49
49
|
<% if form_element == :associated -%>
|
50
50
|
<div class="row form_element_header associated_auto_header" id="<%= css_class_id -%>_list_auto_header" >
|
51
51
|
<div class='medium-11 large-11 column' >
|
@@ -63,31 +63,55 @@
|
|
63
63
|
<%= render :partial => "inline_forms/list",
|
64
64
|
:locals => { :parent_class => @object.class,
|
65
65
|
:parent_id => @object.id,
|
66
|
-
|
66
|
+
:attribute => attribute,
|
67
|
+
:form_element => form_element } %>
|
67
68
|
</div>
|
68
69
|
</div>
|
69
|
-
<% else
|
70
|
-
|
71
|
-
<div class=
|
72
|
-
|
73
|
-
<span data-tooltip class="has-tip tip-top" title="<%= validation_hints_as_list_for(@object, attribute).html_safe -%>">
|
74
|
-
<%= @object.class.human_attribute_name(attribute) -%>
|
75
|
-
</span>
|
76
|
-
<% else %>
|
70
|
+
<% else %>
|
71
|
+
<% if form_element == :has_one %>
|
72
|
+
<div class="row form_element_header associated_auto_header" id="<%= css_class_id -%>_list_auto_header" >
|
73
|
+
<div class='medium-11 large-11 column' >
|
77
74
|
<%= @object.class.human_attribute_name(attribute) -%>
|
78
|
-
|
75
|
+
</div>
|
76
|
+
<div class='medium-1 large-1 column'>
|
77
|
+
|
78
|
+
</div>
|
79
79
|
</div>
|
80
|
-
<div class=
|
81
|
-
<
|
82
|
-
|
83
|
-
</
|
80
|
+
<div class="row <%= cycle('odd', 'even') %>">
|
81
|
+
<div class='medium-1 large-1 column'>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
<div id="<%= css_class_id -%>" class='small-11 column' >
|
85
|
+
<%= render :partial => "inline_forms/list",
|
86
|
+
:locals => { :parent_class => @object.class,
|
87
|
+
:parent_id => @object.id,
|
88
|
+
:attribute => attribute,
|
89
|
+
:form_element => form_element } %>
|
90
|
+
</div>
|
84
91
|
</div>
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
92
|
+
<% else %>
|
93
|
+
<div class="row <%= cycle('odd', 'even') %>">
|
94
|
+
<div class='medium-5 large-5 column' >
|
95
|
+
<% if @object.has_validations_for?(attribute) -%>
|
96
|
+
<span data-tooltip class="has-tip tip-top" title="<%= validation_hints_as_list_for(@object, attribute).html_safe -%>">
|
97
|
+
<%= @object.class.human_attribute_name(attribute) -%>
|
98
|
+
</span>
|
99
|
+
<% else %>
|
100
|
+
<%= @object.class.human_attribute_name(attribute) -%>
|
101
|
+
<% end %>
|
102
|
+
</div>
|
103
|
+
<div class='medium-7 large-7 column' >
|
104
|
+
<span id="<%= css_class_id -%>" >
|
105
|
+
<%= send("#{form_element}_show", @object, attribute) -%>
|
106
|
+
</span>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
<% end %>
|
110
|
+
<% end %>
|
111
|
+
<% end %>
|
112
|
+
<% end %>
|
113
|
+
<% end %>
|
114
|
+
<% end %>
|
91
115
|
<div class="record_footer"></div>
|
92
116
|
</div>
|
93
117
|
</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: 3.0.
|
4
|
+
version: 3.0.12
|
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-
|
11
|
+
date: 2014-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rvm
|