viniBaxter-spa-nested_has_many 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f0681883855d076314d1abf5c0f7d58a09964b64084e0d4fcb97e0983ddd7e0
4
- data.tar.gz: 22b48b33944d5632503d980a12c938457df237645469e9f2077039be395cb816
3
+ metadata.gz: 57b76c10c7a702dbcb0103c7d117a1b0921fed84d1746062fb3447e28dc5a776
4
+ data.tar.gz: b419ce2e16ce717bddbd869c2efc630eb4e98e13d1f05a9b83bbe4650b54d5d5
5
5
  SHA512:
6
- metadata.gz: 325ed2793bf85e0f51f56cade39cd088ebcaef8a76d4b65c24971c7d3e8ab219578121f93e3b5160b65ac5f65ac0afa066ac58aa10e8b90ca768f95000a709d2
7
- data.tar.gz: d79b6fb66eecc9daab6e58ae1e550758e9a014008693872905f76cc6ce481a06f41651e50ce923f6260ffd5ffb245a4d4275d0be2928e7683f9cd7ebe7754edd
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: $base-spacing;
8
- padding-bottom: $base-spacing;
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
- <div class="nested-fields nested-fields_<%= field.attribute %>">
4
- <div class="card light-shadow">
5
- <div class="card-body">
6
-
7
- <% if giveArrayOfNonDateForm(field,f).any? %>
8
- <% giveArrayOfNonDateForm(field,f).each do |attribute| -%>
9
- <div class="form-group field-unit field-unit--<%= attribute.html_class %>">
10
- <%= render_field attribute, f: f %>
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
- <% end -%>
13
- <%end %>
14
- <% if giveArrayOfDateForm(field,f).any? %>
15
- <div class="row">
16
- <% giveArrayOfDateForm(field,f).each do |attribute| -%>
17
- <div class="col-12 col-md-6">
18
- <div class="form-group field-unit field-unit--<%= attribute.html_class %>">
19
- <%= render_field attribute, f: f %>
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
- <% end -%>
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
- </div>
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
- <fieldset
2
- class="field-unit--nested field-unit--nested_<%= field.attribute %>"
3
- data="field-unit--nested_<%= field.attribute %>">
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
- <% end %>
14
-
15
-
16
-
17
- <div>
18
- <%= link_to_add_association(
19
- I18n.t("administrate.fields.nested_has_many.add", resource: field.associated_class_name.titleize).html_safe,
20
- f,
21
- field.association_name,
22
- class: 'btn btn-outline-primary mb-2',
23
- partial: "fields/nested_has_many/fields",
24
- render_options: { locals: { field: field} },
25
- ) %>
26
- </div>
27
- </fieldset>
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
- <%= pluralize(field.data.size, field.attribute.to_s.humanize.downcase) %>
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 %>
@@ -40,5 +40,5 @@ from the associated resource class's dashboard.
40
40
  </span>
41
41
  <% end %>
42
42
  <% else %>
43
- <%= t("administrate.fields.has_many.none", default: "–") %>
43
+ <%#= t("administrate.fields.has_many.none", default: "–") %>
44
44
  <% 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 = "3.0.0"
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: 3.0.0
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-04-30 00:00:00.000000000 Z
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