viniBaxter-spa-nested_has_many 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/administrate-field-nested_has_many/base.scss +12 -2
- data/app/views/fields/nested_has_many/_fields.html.erb +98 -31
- data/app/views/fields/nested_has_many/_fieldset.html.erb +33 -0
- data/app/views/fields/nested_has_many/_form.html.erb +24 -23
- data/app/views/fields/nested_has_many/_index.html.erb +10 -2
- data/app/views/fields/nested_has_many/_show_current.html.erb +1 -1
- data/app/views/fields/nested_has_many/period/_logic_if_period_page.html.erb +59 -0
- data/app/views/fields/nested_has_many/periodPack/_logic_if_periodPack_page.html.erb +59 -0
- data/viniBaxter-spa-nested_has_many.gemspec +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57b76c10c7a702dbcb0103c7d117a1b0921fed84d1746062fb3447e28dc5a776
|
4
|
+
data.tar.gz: b419ce2e16ce717bddbd869c2efc630eb4e98e13d1f05a9b83bbe4650b54d5d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 207188c5693418733badf156e89391f92858ea5c0c30f46722954d0fa3136add3b5f989d8ce661e0cbf7f13e86662e52f75cdf92fd40bbc1db2d23c877e4bf5d
|
7
|
+
data.tar.gz: 9718e4967a590a7a06dba14e3b7674731daaed09a91d55c19da5e19b93493267335259df79a548b7bb00168f1f3e242d369833efa64f65c14c37ca4ba3e106da
|
@@ -4,11 +4,21 @@
|
|
4
4
|
.field-unit--nested-has-many {
|
5
5
|
.nested-fields {
|
6
6
|
@include administrate-clearfix;
|
7
|
-
margin-bottom:
|
8
|
-
padding-bottom:
|
7
|
+
margin-bottom: 0.3em;
|
8
|
+
padding-bottom: 0.3em;
|
9
9
|
}
|
10
10
|
|
11
11
|
.remove_fields, .add_fields {
|
12
12
|
float: right;
|
13
13
|
}
|
14
14
|
}
|
15
|
+
.row.field-unit--nested.field-unit--nested_period_selected_ranges{
|
16
|
+
padding-bottom: 1.5rem;
|
17
|
+
position: relative;
|
18
|
+
}
|
19
|
+
.btn-fixed_period_selected_ranges{
|
20
|
+
margin-top: 1.5rem;
|
21
|
+
position: absolute;
|
22
|
+
bottom: 0;
|
23
|
+
right: 0;
|
24
|
+
}
|
@@ -1,37 +1,104 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
<% if @page.class == PeriodPack %>
|
2
|
+
<!-- / page is PeriodPack and weekly and period_refunds -->
|
3
|
+
<% if field.attribute == :period_selected_ranges%>
|
4
|
+
<div class="col-12 col-lg-6 col-xl-6">
|
5
|
+
<div class="nested-fields nested-fields_<%= field.attribute %> " >
|
6
|
+
<div class="card light-shadow">
|
7
|
+
<div class="card-body d-flex justify-content-between align-items-center">
|
8
|
+
<% if giveArrayOfNonDateForm(field,f).any? %>
|
9
|
+
<% giveArrayOfNonDateForm(field,f).each do |attribute| -%>
|
10
|
+
<!-- / Date -->
|
11
|
+
<div class="form-group field-unit field-unit--<%= attribute.html_class %> flex-grow-1 mr-5">
|
12
|
+
<%= render_field attribute, f: f, page: @page %>
|
13
|
+
</div>
|
14
|
+
<% end -%>
|
15
|
+
<%end %>
|
16
|
+
<% if giveArrayOfDateForm(field,f).any? %>
|
17
|
+
<div class="row">
|
18
|
+
<% giveArrayOfDateForm(field,f).each do |attribute| -%>
|
19
|
+
<!-- / not a Date -->
|
20
|
+
<div class="col-12 col-lg-6 col-xl-6">
|
21
|
+
<div class="form-group field-unit field-unit--<%= attribute.html_class %>">
|
22
|
+
<%= render_field attribute, f: f, page: @page %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<% end -%>
|
26
|
+
</div>
|
27
|
+
<%end %>
|
28
|
+
<div class="">
|
29
|
+
<%= link_to_remove_association( t("administrate.fields.nested_has_many.remove.#{field.association_name}").html_safe,
|
30
|
+
f,
|
31
|
+
# class: 'btn btn-outline-danger mb-2 mt-3',
|
32
|
+
class: 'mb-2 mt-3'
|
33
|
+
)%>
|
34
|
+
</div>
|
11
35
|
</div>
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
<% else %>
|
40
|
+
<div class="nested-fields nested-fields_<%= field.attribute %> " >
|
41
|
+
<div class="card light-shadow">
|
42
|
+
<div class="card-body dfsfqsff">
|
43
|
+
<% if giveArrayOfNonDateForm(field,f).any? %>
|
44
|
+
<% giveArrayOfNonDateForm(field,f).each do |attribute| -%>
|
45
|
+
<div class="form-group field-unit field-unit--<%= attribute.html_class %>">
|
46
|
+
<%= render_field attribute, f: f, page: @page %>
|
47
|
+
</div>
|
48
|
+
<% end -%>
|
49
|
+
<%end %>
|
50
|
+
<% if giveArrayOfDateForm(field,f).any? %>
|
51
|
+
<div class="row">
|
52
|
+
<% giveArrayOfDateForm(field,f).each do |attribute| -%>
|
53
|
+
<div class="col-12 col-md-6">
|
54
|
+
<div class="form-group field-unit field-unit--<%= attribute.html_class %>">
|
55
|
+
<%= render_field attribute, f: f, page: @page %>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<% end -%>
|
59
|
+
</div>
|
60
|
+
<%end %>
|
61
|
+
<div>
|
62
|
+
<%= link_to_remove_association( t("administrate.fields.nested_has_many.remove.#{field.association_name}").html_safe,
|
63
|
+
f,
|
64
|
+
# class: 'btn btn-outline-danger mb-2 mt-3',
|
65
|
+
class: 'mb-2 mt-3'
|
66
|
+
)%>
|
20
67
|
</div>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
<% end %>
|
72
|
+
<%else %>
|
73
|
+
<div class="nested-fields nested-fields_<%= field.attribute %> " >
|
74
|
+
<div class="card light-shadow">
|
75
|
+
<div class="card-body dfsfqsff">
|
76
|
+
<% if giveArrayOfNonDateForm(field,f).any? %>
|
77
|
+
<% giveArrayOfNonDateForm(field,f).each do |attribute| -%>
|
78
|
+
<div class="form-group field-unit field-unit--<%= attribute.html_class %>">
|
79
|
+
<%= render_field attribute, f: f, page: @page %>
|
21
80
|
</div>
|
22
|
-
|
81
|
+
<% end -%>
|
82
|
+
<%end %>
|
83
|
+
<% if giveArrayOfDateForm(field,f).any? %>
|
84
|
+
<div class="row">
|
85
|
+
<% giveArrayOfDateForm(field,f).each do |attribute| -%>
|
86
|
+
<div class="col-12 col-md-6">
|
87
|
+
<div class="form-group field-unit field-unit--<%= attribute.html_class %>">
|
88
|
+
<%= render_field attribute, f: f, page: @page %>
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
<% end -%>
|
92
|
+
</div>
|
93
|
+
<%end %>
|
94
|
+
<div>
|
95
|
+
<%= link_to_remove_association( t("administrate.fields.nested_has_many.remove.#{field.association_name}").html_safe,
|
96
|
+
f,
|
97
|
+
# class: 'btn btn-outline-danger mb-2 mt-3',
|
98
|
+
class: 'mb-2 mt-3'
|
99
|
+
)%>
|
100
|
+
</div>
|
23
101
|
</div>
|
24
|
-
|
25
|
-
<%end %>
|
26
|
-
|
27
|
-
|
28
|
-
<%= link_to_remove_association( I18n.t(
|
29
|
-
"administrate.fields.nested_has_many.remove", resource: field.associated_class_name.titleize).html_safe,
|
30
|
-
f,
|
31
|
-
class: 'btn btn-outline-danger mb-2 mt-3'
|
32
|
-
)%>
|
33
|
-
|
34
|
-
|
35
102
|
</div>
|
36
103
|
</div>
|
37
|
-
|
104
|
+
<% end %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<div class="container-fluid mt-5">
|
2
|
+
<!-- <div class="row"> -->
|
3
|
+
<<%= fieldset %>
|
4
|
+
class="row field-unit--nested field-unit--nested_<%= field.attribute %>"
|
5
|
+
data="field-unit--nested_<%= field.attribute %>">
|
6
|
+
<legend>
|
7
|
+
<%= f.label field.attribute %>
|
8
|
+
</legend>
|
9
|
+
|
10
|
+
<%= f.fields_for field.association_name do |nested_form| %>
|
11
|
+
<%= render(
|
12
|
+
partial: "fields/nested_has_many/fields",
|
13
|
+
locals: {
|
14
|
+
f: nested_form,
|
15
|
+
field: field
|
16
|
+
},
|
17
|
+
) %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<div class='btn-fixed_<%= field.attribute %> '>
|
21
|
+
<%= link_to_add_association(
|
22
|
+
t("administrate.fields.nested_has_many.add.#{field.association_name}").html_safe,
|
23
|
+
# I18n.t("administrate.fields.nested_has_many.add", resource: t("administrate.helpers.model.#{field.association_name}")).html_safe,
|
24
|
+
f,
|
25
|
+
field.association_name,
|
26
|
+
class: 'btn btn-outline-primary mb-2',
|
27
|
+
partial: "fields/nested_has_many/fields",
|
28
|
+
render_options: { locals: { field: field} },
|
29
|
+
) %>
|
30
|
+
</div>
|
31
|
+
</<%= fieldset %>>
|
32
|
+
</div>
|
33
|
+
<!-- </div> -->
|
@@ -1,27 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<legend><%= f.label field.attribute %></legend>
|
5
|
-
<%= f.fields_for field.association_name do |nested_form| %>
|
6
|
-
<%= render(
|
7
|
-
partial: "fields/nested_has_many/fields",
|
1
|
+
<% if @page.class == PeriodPack %>
|
2
|
+
<%= render(
|
3
|
+
partial: "fields/nested_has_many/periodPack/logic_if_periodPack_page",
|
8
4
|
locals: {
|
9
|
-
f: nested_form,
|
10
5
|
field: field,
|
6
|
+
f: f,
|
7
|
+
fieldset: "fieldset"
|
11
8
|
},
|
12
9
|
) %>
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
10
|
+
<% elsif @page.class == Period %>
|
11
|
+
<%= render(
|
12
|
+
partial: "fields/nested_has_many/period/logic_if_period_page",
|
13
|
+
locals: {
|
14
|
+
field: field,
|
15
|
+
f: f,
|
16
|
+
fieldset: "fieldset"
|
17
|
+
},
|
18
|
+
) %>
|
19
|
+
<%else %>
|
20
|
+
<%= render(
|
21
|
+
partial: "fields/nested_has_many/fieldset",
|
22
|
+
locals: {
|
23
|
+
field: field,
|
24
|
+
f: f,
|
25
|
+
fieldset: "fieldset"
|
26
|
+
},
|
27
|
+
) %>
|
28
|
+
<% end %>
|
@@ -15,5 +15,13 @@ as a count of how many objects are associated through the relationship.
|
|
15
15
|
|
16
16
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
|
17
17
|
%>
|
18
|
-
|
19
|
-
|
18
|
+
<%#= pluralize(field.data.size, field.attribute.to_s.humanize.downcase) %>
|
19
|
+
<% if field.attribute == :period_selected_ranges && @page.class == Place%>
|
20
|
+
<% if @page.period_pack.weekly? %>
|
21
|
+
Option semaine aucun range
|
22
|
+
<% else %>
|
23
|
+
<%= t("administrate.fields.#{field.attribute.to_s}",total_count: field.data.count).html_safe %>
|
24
|
+
<% end %>
|
25
|
+
<% else %>
|
26
|
+
<%= t("administrate.fields.#{field.attribute.to_s}",total_count: field.data.count).html_safe %>
|
27
|
+
<% end %>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<% if current_owner.super_admin? %>
|
2
|
+
<ul>
|
3
|
+
<li><%= "page weekly : #{@page.weekly}" %></li>
|
4
|
+
<li><%= "page yearly : #{@page.yearly}" %></li>
|
5
|
+
<li><%= "page display refund : #{@page.refund_on_period}" %></li>
|
6
|
+
</ul>
|
7
|
+
<% end %>
|
8
|
+
<% if @page.weekly %>
|
9
|
+
<!-- / page is PeriodPack and weekly -->
|
10
|
+
<% if @page.refund_on_period %>
|
11
|
+
<!-- / page is PeriodPack and weekly and period_refunds -->
|
12
|
+
<% if field.attribute != :period_selected_ranges%>
|
13
|
+
<%= render(
|
14
|
+
partial: "fields/nested_has_many/fieldset",
|
15
|
+
locals: {
|
16
|
+
field: field,
|
17
|
+
f: f,
|
18
|
+
fieldset: "fieldset"
|
19
|
+
},
|
20
|
+
) %>
|
21
|
+
<% end %>
|
22
|
+
<% else %>
|
23
|
+
<!-- / .weekly but hide period_selected_ranges and hide period_refunds-->
|
24
|
+
<% if field.attribute != :period_selected_ranges && field.attribute != :period_refunds%>
|
25
|
+
<%= render(
|
26
|
+
partial: "fields/nested_has_many/fieldset",
|
27
|
+
locals: {
|
28
|
+
field: field,
|
29
|
+
f: f,
|
30
|
+
fieldset: "fieldset"
|
31
|
+
},
|
32
|
+
) %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
<!-- / page is PeriodPack but not weekly -->
|
36
|
+
<%else %>
|
37
|
+
<% if @page.refund_on_period %>
|
38
|
+
<%= render(
|
39
|
+
partial: "fields/nested_has_many/fieldset",
|
40
|
+
locals: {
|
41
|
+
field: field,
|
42
|
+
f: f,
|
43
|
+
fieldset: field.attribute == :period_selected_ranges ? "div" : "fieldset"
|
44
|
+
},
|
45
|
+
) %>
|
46
|
+
<% else %>
|
47
|
+
<% if field.attribute != :period_refunds%>
|
48
|
+
<%= render(
|
49
|
+
partial: "fields/nested_has_many/fieldset",
|
50
|
+
locals: {
|
51
|
+
field: field,
|
52
|
+
f: f,
|
53
|
+
fieldset: field.attribute == :period_selected_ranges ? "div" : "fieldset"
|
54
|
+
},
|
55
|
+
) %>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
<!-- / page is not PeriodPack -->
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<% if current_owner.super_admin? %>
|
2
|
+
<ul>
|
3
|
+
<li><%= "page weekly : #{@page.weekly}" %></li>
|
4
|
+
<li><%= "page yearly : #{@page.yearly}" %></li>
|
5
|
+
<li><%= "page display refund : #{@page.refund_on_period}" %></li>
|
6
|
+
</ul>
|
7
|
+
<% end %>
|
8
|
+
<% if @page.weekly %>
|
9
|
+
<!-- / page is PeriodPack and weekly -->
|
10
|
+
<% if @page.refund_on_period %>
|
11
|
+
<!-- / page is PeriodPack and weekly and period_refunds -->
|
12
|
+
<% if field.attribute != :period_selected_ranges%>
|
13
|
+
<%= render(
|
14
|
+
partial: "fields/nested_has_many/fieldset",
|
15
|
+
locals: {
|
16
|
+
field: field,
|
17
|
+
f: f,
|
18
|
+
fieldset: "fieldset"
|
19
|
+
},
|
20
|
+
) %>
|
21
|
+
<% end %>
|
22
|
+
<% else %>
|
23
|
+
<!-- / .weekly but hide period_selected_ranges and hide period_refunds-->
|
24
|
+
<% if field.attribute != :period_selected_ranges && field.attribute != :period_refunds%>
|
25
|
+
<%= render(
|
26
|
+
partial: "fields/nested_has_many/fieldset",
|
27
|
+
locals: {
|
28
|
+
field: field,
|
29
|
+
f: f,
|
30
|
+
fieldset: "fieldset"
|
31
|
+
},
|
32
|
+
) %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
<!-- / page is PeriodPack but not weekly -->
|
36
|
+
<%else %>
|
37
|
+
<% if @page.refund_on_period %>
|
38
|
+
<%= render(
|
39
|
+
partial: "fields/nested_has_many/fieldset",
|
40
|
+
locals: {
|
41
|
+
field: field,
|
42
|
+
f: f,
|
43
|
+
fieldset: field.attribute == :period_selected_ranges ? "div" : "fieldset"
|
44
|
+
},
|
45
|
+
) %>
|
46
|
+
<% else %>
|
47
|
+
<% if field.attribute != :period_refunds%>
|
48
|
+
<%= render(
|
49
|
+
partial: "fields/nested_has_many/fieldset",
|
50
|
+
locals: {
|
51
|
+
field: field,
|
52
|
+
f: f,
|
53
|
+
fieldset: field.attribute == :period_selected_ranges ? "div" : "fieldset"
|
54
|
+
},
|
55
|
+
) %>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
<!-- / page is not PeriodPack -->
|
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "viniBaxter-spa-nested_has_many"
|
5
|
-
gem.version = "
|
5
|
+
gem.version = "4.0.0"
|
6
6
|
gem.authors = ["Nick Charlton", "Grayson Wright"]
|
7
7
|
gem.email = ["vinybaxter@gmail.com"]
|
8
8
|
# gem.homepage = "https://github.com/nickcharlton/" \
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viniBaxter-spa-nested_has_many
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Charlton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: administrate
|
@@ -184,11 +184,14 @@ files:
|
|
184
184
|
- app/assets/stylesheets/administrate-field-nested_has_many/base.scss
|
185
185
|
- app/views/fields/nested_has_many/_fields.html.erb
|
186
186
|
- app/views/fields/nested_has_many/_fields_backUp.html.erb
|
187
|
+
- app/views/fields/nested_has_many/_fieldset.html.erb
|
187
188
|
- app/views/fields/nested_has_many/_form.html.erb
|
188
189
|
- app/views/fields/nested_has_many/_index.html.erb
|
189
190
|
- app/views/fields/nested_has_many/_show.html.erb
|
190
191
|
- app/views/fields/nested_has_many/_show_current.html.erb
|
191
192
|
- app/views/fields/nested_has_many/_show_old.html.erb
|
193
|
+
- app/views/fields/nested_has_many/period/_logic_if_period_page.html.erb
|
194
|
+
- app/views/fields/nested_has_many/periodPack/_logic_if_periodPack_page.html.erb
|
192
195
|
- bin/rails
|
193
196
|
- config/i18n-tasks.yml
|
194
197
|
- config/locales/administrate-field-nested_has_many.en.yml
|