lato 0.1.18 → 0.1.21

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: 9f403e8807c165027e5eb53e21b340bbc3008d4109e63f6cad74ae3960e04efb
4
- data.tar.gz: 8862715e36ef3e00ff0a732c4b5da401811bc731fdceca688c9daf514b643e6b
3
+ metadata.gz: e341af1abdc45fd1bd1676413dda8067d5d4e304162595688d39238a1ac0f76b
4
+ data.tar.gz: 260f04739041cbbabf4228ea860acca5be4a1a8c66c82832267b4f468eded4aa
5
5
  SHA512:
6
- metadata.gz: 416723f51c87c0c5591c0ed691a45fcd52f61a2c8970ff68155dbb866933eba6e5101a39a7a98b5a37906e363302d7fbac7b45fcda819fb1789246016a0ec4c8
7
- data.tar.gz: dbd3d0cae8f7a5315b718cea57dd2d543b6dbd28d0b911b3ebdb102fd75dcb6e9fb0a31fcd0a97dfc4095932400152055518d4c2109c9366a74f28c7d77d2699
6
+ metadata.gz: 511960e3a047e5d80547ac0b83ddf4ca4270bf3248ba608c62c72da1ecf5cf330eb7f79a06e3e9ea47e99e9364d5da643da114f36836419bb99349d30554245c
7
+ data.tar.gz: 9e5e79926336ec3a85c1304214cfad71b41d93aedd2623a128a0f9735b24f2a8dfcdf94aa2c33166a8e91f51a4ea309965fc979bf4dcd0fed522b5460370c8b7
@@ -57,7 +57,7 @@ module Lato
57
57
 
58
58
  def update_accepted_privacy_policy_version_action
59
59
  respond_to do |format|
60
- if @session.user.update(params.require(:user).permit(:accepted_privacy_policy_version))
60
+ if @session.user.update_accepted_privacy_policy_version(params.require(:user).permit(:confirm))
61
61
  format.html { redirect_to lato.account_path }
62
62
  format.json { render json: @session.user }
63
63
  else
@@ -69,7 +69,7 @@ module Lato
69
69
 
70
70
  def update_accepted_terms_and_conditions_version_action
71
71
  respond_to do |format|
72
- if @session.user.update(params.require(:user).permit(:accepted_terms_and_conditions_version))
72
+ if @session.user.update_accepted_terms_and_conditions_version(params.require(:user).permit(:confirm))
73
73
  format.html { redirect_to lato.account_path }
74
74
  format.json { render json: @session.user }
75
75
  else
@@ -171,6 +171,24 @@ module Lato
171
171
  form.file_field key, options
172
172
  end
173
173
 
174
+ def lato_form_item_input_textarea(form, key, options = {})
175
+ _lato_form_input_options(form, key, options, :keyup, 'form-control')
176
+
177
+ form.text_area key, options
178
+ end
179
+
180
+ def lato_form_item_input_date(form, key, options = {})
181
+ _lato_form_input_options(form, key, options, :change, 'form-control')
182
+
183
+ form.date_field key, options
184
+ end
185
+
186
+ def lato_form_item_input_datetime(form, key, options = {})
187
+ _lato_form_input_options(form, key, options, :change, 'form-control')
188
+
189
+ form.datetime_field key, options
190
+ end
191
+
174
192
  def lato_form_submit(form, label, options = {})
175
193
  options[:class] ||= []
176
194
  options[:class].push('btn')
@@ -46,7 +46,7 @@ module Lato
46
46
  end
47
47
 
48
48
  def valid_accepted_terms_and_conditions_version?
49
- @valid_accepted_terms_and_conditions_version ||= accepted_terms_and_conditions_version >= Lato.config.legal_privacy_policy_version
49
+ @valid_accepted_terms_and_conditions_version ||= accepted_terms_and_conditions_version >= Lato.config.legal_terms_and_conditions_version
50
50
  end
51
51
 
52
52
  # Helpers
@@ -162,5 +162,23 @@ module Lato
162
162
 
163
163
  update(params.permit(:password, :password_confirmation))
164
164
  end
165
+
166
+ def update_accepted_privacy_policy_version(params)
167
+ unless params[:confirm]
168
+ errors.add(:base, 'Per accettare la privacy policy devi selezionare la checkbox di conferma')
169
+ return
170
+ end
171
+
172
+ update(accepted_privacy_policy_version: Lato.config.legal_privacy_policy_version)
173
+ end
174
+
175
+ def update_accepted_terms_and_conditions_version(params)
176
+ unless params[:confirm]
177
+ errors.add(:base, 'Per accettare i termini e condizioni devi selezionare la checkbox di conferma')
178
+ return
179
+ end
180
+
181
+ update(accepted_terms_and_conditions_version: Lato.config.legal_terms_and_conditions_version)
182
+ end
165
183
  end
166
184
  end
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
  <%= form_with model: @session.user, url: lato.account_update_accepted_privacy_policy_version_action_path, data: { turbo_frame: '_self' } do |form| %>
11
11
  <%= lato_form_errors @session.user, class: %w[mb-3] %>
12
- <%= lato_form_item_input_check form, :accepted_privacy_policy_version, "Dichiaro di aver letto e accettato la <a href=#{Lato.config.legal_privacy_policy_url} target=_blank>privacy policy</a>.", checked: false, value: Lato.config.legal_privacy_policy_version, required: true %>
12
+ <%= lato_form_item_input_check form, :confirm, "Dichiaro di aver letto e accettato la <a href=#{Lato.config.legal_privacy_policy_url} target=_blank>privacy policy</a>.", checked: false, required: true %>
13
13
 
14
14
  <div class="mt-3">
15
15
  <%= lato_form_submit form, 'Conferma' %>
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
  <%= form_with model: @session.user, url: lato.account_update_accepted_terms_and_conditions_version_action_path, data: { turbo_frame: '_self' } do |form| %>
11
11
  <%= lato_form_errors @session.user, class: %w[mb-3] %>
12
- <%= lato_form_item_input_check form, :accepted_terms_and_conditions_version, "Dichiaro di aver letto e accettato i <a href=#{Lato.config.legal_terms_and_conditions_url} target=_blank>termini e condizioni</a> di utilizzo.", checked: false, value: Lato.config.legal_terms_and_conditions_version, required: true %>
12
+ <%= lato_form_item_input_check form, :confirm, "Dichiaro di aver letto e accettato i <a href=#{Lato.config.legal_terms_and_conditions_url} target=_blank>termini e condizioni</a> di utilizzo.", checked: false, required: true %>
13
13
 
14
14
  <div class="mt-3">
15
15
  <%= lato_form_submit form, 'Conferma' %>
@@ -7,43 +7,38 @@
7
7
  <% end %>
8
8
 
9
9
  <% if false && browser.device.mobile? %>
10
+ <!-- Free for custom mobile version -->
11
+ <% else %>
10
12
 
11
- <p>Work in progress</p>
13
+ <% if custom_actions.any? || searchable_columns.any? %>
14
+ <div class="d-flex justify-content-between mb-3">
15
+ <% if searchable_columns.any? %>
16
+ <div class="input-group">
17
+ <input type="text" name="search" class="form-control" placeholder="Ricerca per: <%= searchable_columns.map { |c| collection.model.human_attribute_name(c) }.to_sentence %>" value="<%= params[:search] %>">
18
+ <button class="btn btn-outline-primary" type="submit"><i class="bi bi-search"></i></button>
19
+ </div>
20
+ <% else %>
21
+ <div></div>
22
+ <% end %>
12
23
 
13
- <% else %>
24
+ <div class="btn-group ms-2">
25
+ <% if custom_actions.any? %>
26
+ <% custom_actions.each do |action_key, action_params| %>
27
+ <%= link_to action_params[:path], { class: 'btn btn-primary' }.merge(action_params) do %>
28
+ <i class="<%= action_params[:icon] %>"></i>
29
+ <% end %>
30
+ <% end %>
31
+ <% end %>
32
+ </div>
33
+ </div>
34
+ <% end %>
14
35
 
15
36
  <div class="table-responsive">
16
37
  <table class="table table-striped table-bordered">
17
38
  <thead>
18
- <% if custom_actions.any? || searchable_columns.any? %>
19
- <tr>
20
- <td colspan="<%= columns.length %>">
21
- <div class="d-flex justify-content-between">
22
- <% if searchable_columns.any? %>
23
- <div class="input-group">
24
- <input type="text" name="search" class="form-control" placeholder="Ricerca per: <%= searchable_columns.map { |c| collection.model.human_attribute_name(c) }.to_sentence %>" value="<%= params[:search] %>">
25
- <button class="btn btn-outline-primary" type="submit"><i class="bi bi-search"></i></button>
26
- </div>
27
- <% else %>
28
- <div></div>
29
- <% end %>
30
-
31
- <div class="btn-group ms-2">
32
- <% if custom_actions.any? %>
33
- <% custom_actions.each do |action_key, action_params| %>
34
- <%= link_to action_params[:path], { class: 'btn btn-primary' }.merge(action_params) do %>
35
- <i class="<%= action_params[:icon] %>"></i>
36
- <% end %>
37
- <% end %>
38
- <% end %>
39
- </div>
40
- </div>
41
- </td>
42
- </tr>
43
- <% end %>
44
39
  <tr class="align-middle">
45
40
  <% columns.each do |column| %>
46
- <th scope="col">
41
+ <th scope="col" class="lato-index-col-<%= column %>">
47
42
  <div class="d-flex align-items-center">
48
43
  <span><%= collection.model.human_attribute_name column %></span>
49
44
  <% if sortable_columns.include?(column) %>
@@ -68,7 +63,7 @@
68
63
  <% collection.each do |member| %>
69
64
  <tr>
70
65
  <% columns.each do |column| %>
71
- <td>
66
+ <td class="lato-index-col-<%= column %>">
72
67
  <% viewer_function_name = "#{model_name_underscore}_#{column}" %>
73
68
  <%= respond_to?(viewer_function_name) ? send(viewer_function_name, member) : member.send(column) %>
74
69
  </td>
data/lib/lato/btstrap.rb CHANGED
@@ -29,7 +29,7 @@ module Lato
29
29
  @content_container = 'container-fluid'
30
30
 
31
31
  # Footer defaults
32
- @footer = 'bg-light px-md-3 py-2'
32
+ @footer = 'bg-light px-md-3 py-2 border-top'
33
33
  @footer_container = 'container-fluid text-center text-muted d-md-flex justify-content-between p-3'
34
34
  end
35
35
  end
data/lib/lato/config.rb CHANGED
@@ -36,9 +36,9 @@ module Lato
36
36
  @email_from = 'lato@example.com'
37
37
 
38
38
  @legal_privacy_policy_url = '#'
39
- @legal_privacy_policy_version = 1
39
+ @legal_privacy_policy_version = 3
40
40
  @legal_terms_and_conditions_url = '#'
41
- @legal_terms_and_conditions_version = 1
41
+ @legal_terms_and_conditions_version = 2
42
42
  end
43
43
  end
44
44
  end
data/lib/lato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "0.1.18"
2
+ VERSION = "0.1.21"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-07 00:00:00.000000000 Z
11
+ date: 2022-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails