lato 0.1.27 → 0.1.29
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 +4 -4
- data/app/helpers/lato/components_helper.rb +11 -1
- data/app/models/lato/log/user_signin.rb +13 -4
- data/app/models/lato/log.rb +0 -7
- data/app/views/lato/components/_index.html.erb +28 -4
- data/lib/lato/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 505a5328530dfe6f82d0266cafa0cff2521f91752f7daefda830bb9446161159
|
4
|
+
data.tar.gz: 5a6dfae7a9ec10819ad03103911e9ec7699553c112040a282ab5e8346ea00955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 024e97ced309186611c34f43985fbb187de4cfdb2043be3298ad754f61e240e7483ee01f63c5e6688455fdf0c257c1466bb02f18912abdabe474f7d2f7e14dd4
|
7
|
+
data.tar.gz: 64b12a0759709892ff85d2298ea23f107c1d9cf4ec4b040ce495238200a830bc9f90e47402bdafdd8f00543b2ec9970b079d9a4a030ef64be8df1714657ce087
|
@@ -50,7 +50,8 @@ module Lato
|
|
50
50
|
columns = options[:columns] || @_lato_index[key][:columns] || collection.column_names || []
|
51
51
|
sortable_columns = @_lato_index[key][:sortable_columns] || []
|
52
52
|
searchable_columns = @_lato_index[key][:searchable_columns] || []
|
53
|
-
|
53
|
+
model_name = options[:model_name] || collection.model.name
|
54
|
+
model_name_underscore = options[:model_name] || model_name.underscore.gsub('/', '_')
|
54
55
|
|
55
56
|
render(
|
56
57
|
'lato/components/index',
|
@@ -59,11 +60,20 @@ module Lato
|
|
59
60
|
columns: columns,
|
60
61
|
sortable_columns: sortable_columns,
|
61
62
|
searchable_columns: searchable_columns,
|
63
|
+
model_name: model_name,
|
62
64
|
model_name_underscore: model_name_underscore,
|
63
65
|
custom_actions: options[:custom_actions] || {}
|
64
66
|
)
|
65
67
|
end
|
66
68
|
|
69
|
+
def lato_index_dynamic_label(params = {})
|
70
|
+
'Please override the method lato_index_dynamic_label in your application_helper.rb'
|
71
|
+
end
|
72
|
+
|
73
|
+
def lato_index_dynamic_value(params = {})
|
74
|
+
'Please override the method lato_index_dynamic_value in your application_helper.rb'
|
75
|
+
end
|
76
|
+
|
67
77
|
# Operation
|
68
78
|
##
|
69
79
|
|
@@ -1,8 +1,17 @@
|
|
1
1
|
module Lato
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
module Log
|
3
|
+
class UserSignin < ApplicationRecord
|
4
|
+
# Relations
|
5
|
+
##
|
5
6
|
|
6
|
-
|
7
|
+
belongs_to :lato_user, class_name: 'Lato::User', foreign_key: :lato_user_id, optional: true
|
8
|
+
|
9
|
+
# Hooks
|
10
|
+
##
|
11
|
+
|
12
|
+
before_destroy do
|
13
|
+
throw :abort
|
14
|
+
end
|
15
|
+
end
|
7
16
|
end
|
8
17
|
end
|
data/app/models/lato/log.rb
CHANGED
@@ -1,12 +1,5 @@
|
|
1
1
|
module Lato
|
2
2
|
module Log
|
3
|
-
# This module is used to add log to the application.
|
4
|
-
# Log are used to track user actions without sensitive data.
|
5
|
-
# Log should not be destroyed.
|
6
|
-
before_destroy do
|
7
|
-
throw :abort
|
8
|
-
end
|
9
|
-
|
10
3
|
def self.table_name_prefix
|
11
4
|
'lato_log_'
|
12
5
|
end
|
@@ -1,3 +1,9 @@
|
|
1
|
+
<%
|
2
|
+
|
3
|
+
collection_test_istance = collection.model.new
|
4
|
+
|
5
|
+
%>
|
6
|
+
|
1
7
|
<%= turbo_frame_tag "lato_index_#{key}_#{model_name_underscore}", class: 'lato-index' do %>
|
2
8
|
|
3
9
|
<%= form_tag request.path, method: :get, data: { turbo_frame: '_self' } do %>
|
@@ -38,10 +44,19 @@
|
|
38
44
|
<tbody>
|
39
45
|
<% columns.each do |column| %>
|
40
46
|
<tr>
|
41
|
-
<th><%= collection.model.human_attribute_name
|
47
|
+
<th><%= collection_test_istance.respond_to?(column) ? collection.model.human_attribute_name(column) : lato_index_dynamic_label({
|
48
|
+
key: key,
|
49
|
+
model_name: model_name,
|
50
|
+
column: column
|
51
|
+
}) %></th>
|
42
52
|
<td class="lato-index-col-<%= column %>">
|
43
53
|
<% viewer_function_name = "#{model_name_underscore}_#{column}" %>
|
44
|
-
<%= respond_to?(viewer_function_name) ? send(viewer_function_name, member) : member.send(column)
|
54
|
+
<%= respond_to?(viewer_function_name) ? send(viewer_function_name, member) : (collection_test_istance.respond_to?(column) ? member.send(column) : lato_index_dynamic_value({
|
55
|
+
key: key,
|
56
|
+
model_name: model_name,
|
57
|
+
column: column,
|
58
|
+
member: member
|
59
|
+
})) %>
|
45
60
|
</td>
|
46
61
|
</tr>
|
47
62
|
<% end %>
|
@@ -67,7 +82,11 @@
|
|
67
82
|
<% columns.each do |column| %>
|
68
83
|
<th scope="col" class="lato-index-col-<%= column %>">
|
69
84
|
<div class="d-flex align-items-center">
|
70
|
-
<span><%= collection.model.human_attribute_name
|
85
|
+
<span><%= collection_test_istance.respond_to?(column) ? collection.model.human_attribute_name(column) : lato_index_dynamic_label({
|
86
|
+
key: key,
|
87
|
+
model_name: model_name,
|
88
|
+
column: column
|
89
|
+
}) %></span>
|
71
90
|
<% if sortable_columns.include?(column) %>
|
72
91
|
<div class="btn-group ms-3">
|
73
92
|
<div class="position-relative btn btn-sm <%= params[:sort_by] == "#{column}|ASC" ? 'btn-primary' : 'btn-outline-primary' %>">
|
@@ -92,7 +111,12 @@
|
|
92
111
|
<% columns.each do |column| %>
|
93
112
|
<td class="lato-index-col-<%= column %>">
|
94
113
|
<% viewer_function_name = "#{model_name_underscore}_#{column}" %>
|
95
|
-
<%= respond_to?(viewer_function_name) ? send(viewer_function_name, member) : member.send(column)
|
114
|
+
<%= respond_to?(viewer_function_name) ? send(viewer_function_name, member) : (collection_test_istance.respond_to?(column) ? member.send(column) : lato_index_dynamic_value({
|
115
|
+
key: key,
|
116
|
+
model_name: model_name,
|
117
|
+
column: column,
|
118
|
+
member: member
|
119
|
+
})) %>
|
96
120
|
</td>
|
97
121
|
<% end %>
|
98
122
|
</tr>
|
data/lib/lato/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|