lato 0.1.7 → 0.1.9
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/README.md +1 -1
- data/app/helpers/lato/components_helper.rb +1 -1
- data/app/models/concerns/lato_user_application.rb +9 -0
- data/app/models/lato/user.rb +2 -0
- data/app/views/lato/components/_index.html.erb +79 -71
- data/app/views/layouts/lato/application.html.erb +1 -1
- data/lib/lato/config.rb +5 -0
- data/lib/lato/version.rb +1 -1
- data/lib/lato.rb +1 -0
- data/lib/tasks/lato_tasks.rake +7 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92d512245037704ff364d01fcf316cf114677b4dcf2ec487f1c0423a58a42562
|
4
|
+
data.tar.gz: cfe5526f94a5595c27b95b4c6d4ec59a7e1af30689a2cc64a96e9a01ef115097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c4c8d773c626d1d82f27fa0f40065cccf822a8c77b24a8b8509379da0c1afabdf2b488c515892e464e695e16d8a68afd2ca9fb808c28eba75e44a967865287b
|
7
|
+
data.tar.gz: 6695fa93944e55adc432f0fe2da98f1dd000bce6063ace5fbb3a80533d3bdbb2b45764a002fa4ddb22757382d3f28b9523c36470a6fd800fe46cff84a8c0e588
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ module Lato
|
|
44
44
|
columns = options[:columns] || @_lato_index[key][:columns] || collection.column_names || []
|
45
45
|
sortable_columns = @_lato_index[key][:sortable_columns] || []
|
46
46
|
searchable_columns = @_lato_index[key][:searchable_columns] || []
|
47
|
-
model_name_underscore = collection.model.name.underscore
|
47
|
+
model_name_underscore = options[:model_name] || collection.model.name.gsub('/', '_').underscore
|
48
48
|
|
49
49
|
render(
|
50
50
|
'lato/components/index',
|
data/app/models/lato/user.rb
CHANGED
@@ -4,86 +4,94 @@
|
|
4
4
|
<%= hidden_field_tag :key, key %>
|
5
5
|
<%= hidden_field_tag :sort_by, params[:sort_by] %>
|
6
6
|
|
7
|
-
|
8
|
-
<table class="table table-striped table-bordered">
|
9
|
-
<thead>
|
10
|
-
<% if custom_actions.any? || searchable_columns.any? %>
|
11
|
-
<tr>
|
12
|
-
<td colspan="<%= columns.length %>">
|
13
|
-
<div class="d-flex justify-content-between">
|
14
|
-
<% if searchable_columns.any? %>
|
15
|
-
<div class="input-group">
|
16
|
-
<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] %>">
|
17
|
-
<button class="btn btn-outline-primary" type="submit"><i class="bi bi-search"></i></button>
|
18
|
-
</div>
|
19
|
-
<% else %>
|
20
|
-
<div></div>
|
21
|
-
<% end %>
|
7
|
+
<% if false && browser.device.mobile? %>
|
22
8
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<%= link_to action_params[:path], { class: 'btn btn-primary' }.merge(action_params) do %>
|
27
|
-
<i class="<%= action_params[:icon] %>"></i>
|
28
|
-
<% end %>
|
29
|
-
<% end %>
|
30
|
-
<% end %>
|
31
|
-
</div>
|
32
|
-
</div>
|
33
|
-
</td>
|
34
|
-
</tr>
|
35
|
-
<% end %>
|
36
|
-
<tr class="align-middle">
|
37
|
-
<% columns.each do |column| %>
|
38
|
-
<th scope="col">
|
39
|
-
<div class="d-flex align-items-center">
|
40
|
-
<span><%= collection.model.human_attribute_name column %></span>
|
41
|
-
<% if sortable_columns.include?(column) %>
|
42
|
-
<div class="btn-group ms-3">
|
43
|
-
<div class="position-relative btn btn-sm <%= params[:sort_by] == "#{column}|ASC" ? 'btn-primary' : 'btn-outline-primary' %>">
|
44
|
-
<input type="submit" name="sort_by" value="<%= column %>|ASC" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0">
|
45
|
-
<i class="bi bi-sort-up"></i>
|
46
|
-
</div>
|
9
|
+
<p>Work in progress</p>
|
10
|
+
|
11
|
+
<% else %>
|
47
12
|
|
48
|
-
|
49
|
-
|
50
|
-
|
13
|
+
<div class="table-responsive">
|
14
|
+
<table class="table table-striped table-bordered">
|
15
|
+
<thead>
|
16
|
+
<% if custom_actions.any? || searchable_columns.any? %>
|
17
|
+
<tr>
|
18
|
+
<td colspan="<%= columns.length %>">
|
19
|
+
<div class="d-flex justify-content-between">
|
20
|
+
<% if searchable_columns.any? %>
|
21
|
+
<div class="input-group">
|
22
|
+
<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] %>">
|
23
|
+
<button class="btn btn-outline-primary" type="submit"><i class="bi bi-search"></i></button>
|
51
24
|
</div>
|
25
|
+
<% else %>
|
26
|
+
<div></div>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<div class="btn-group ms-2">
|
30
|
+
<% if custom_actions.any? %>
|
31
|
+
<% custom_actions.each do |action_key, action_params| %>
|
32
|
+
<%= link_to action_params[:path], { class: 'btn btn-primary' }.merge(action_params) do %>
|
33
|
+
<i class="<%= action_params[:icon] %>"></i>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
52
37
|
</div>
|
53
|
-
|
54
|
-
</
|
55
|
-
</
|
38
|
+
</div>
|
39
|
+
</td>
|
40
|
+
</tr>
|
56
41
|
<% end %>
|
57
|
-
|
58
|
-
</thead>
|
59
|
-
<tbody>
|
60
|
-
<% collection.each do |member| %>
|
61
|
-
<tr>
|
42
|
+
<tr class="align-middle">
|
62
43
|
<% columns.each do |column| %>
|
63
|
-
<
|
64
|
-
|
65
|
-
|
66
|
-
|
44
|
+
<th scope="col">
|
45
|
+
<div class="d-flex align-items-center">
|
46
|
+
<span><%= collection.model.human_attribute_name column %></span>
|
47
|
+
<% if sortable_columns.include?(column) %>
|
48
|
+
<div class="btn-group ms-3">
|
49
|
+
<div class="position-relative btn btn-sm <%= params[:sort_by] == "#{column}|ASC" ? 'btn-primary' : 'btn-outline-primary' %>">
|
50
|
+
<input type="submit" name="sort_by" value="<%= column %>|ASC" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0">
|
51
|
+
<i class="bi bi-sort-up"></i>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<div class="position-relative btn btn-sm <%= params[:sort_by] == "#{column}|DESC" ? 'btn-primary' : 'btn-outline-primary' %>">
|
55
|
+
<input type="submit" name="sort_by" value="<%= column %>|DESC" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0">
|
56
|
+
<i class="bi bi-sort-down"></i>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
<% end %>
|
60
|
+
</div>
|
61
|
+
</th>
|
67
62
|
<% end %>
|
68
63
|
</tr>
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
<div></div>
|
64
|
+
</thead>
|
65
|
+
<tbody>
|
66
|
+
<% collection.each do |member| %>
|
67
|
+
<tr>
|
68
|
+
<% columns.each do |column| %>
|
69
|
+
<td>
|
70
|
+
<% viewer_function_name = "#{model_name_underscore}_#{column}" %>
|
71
|
+
<%= respond_to?(viewer_function_name) ? send(viewer_function_name, member) : member.send(column) %>
|
72
|
+
</td>
|
79
73
|
<% end %>
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
74
|
+
</tr>
|
75
|
+
<% end %>
|
76
|
+
</tbody>
|
77
|
+
<tfoot>
|
78
|
+
<tr>
|
79
|
+
<td colspan="<%= columns.length %>">
|
80
|
+
<div class="d-flex justify-content-between align-items-center">
|
81
|
+
<% if collection.respond_to?(:total_pages) %>
|
82
|
+
<div><%= paginate collection %></div>
|
83
|
+
<% else %>
|
84
|
+
<div></div>
|
85
|
+
<% end %>
|
86
|
+
<span class="text-muted"><%= collection.count %> risultati visualizzati
|
87
|
+
</div>
|
88
|
+
</td>
|
89
|
+
</tr>
|
90
|
+
</tfoot>
|
91
|
+
</table>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<% end %>
|
87
95
|
<% end %>
|
88
96
|
|
89
97
|
<% end %>
|
data/lib/lato/config.rb
CHANGED
@@ -12,6 +12,9 @@ module Lato
|
|
12
12
|
# Authentication configs
|
13
13
|
attr_accessor :auth_disable_signup
|
14
14
|
|
15
|
+
# Assets configs
|
16
|
+
attr_accessor :assets_stylesheet_entry
|
17
|
+
|
15
18
|
# Email configs
|
16
19
|
attr_accessor :email_from
|
17
20
|
|
@@ -25,6 +28,8 @@ module Lato
|
|
25
28
|
|
26
29
|
@auth_disable_signup = false
|
27
30
|
|
31
|
+
@assets_stylesheet_entry = 'application'
|
32
|
+
|
28
33
|
@session_lifetime = 30.days
|
29
34
|
@session_root_path = nil # :tutorial_path
|
30
35
|
|
data/lib/lato/version.rb
CHANGED
data/lib/lato.rb
CHANGED
data/lib/tasks/lato_tasks.rake
CHANGED
@@ -5,6 +5,8 @@ namespace :lato do
|
|
5
5
|
desc 'Install Lato engine and run tasks on main rails application'
|
6
6
|
task :application do
|
7
7
|
# Copy all "_content.html.erb" parials on layouts/lato from gem to main application
|
8
|
+
##
|
9
|
+
|
8
10
|
gem_layout_path = Lato::Engine.root.join('app', 'views', 'layouts', 'lato').to_s
|
9
11
|
app_layout_path = Rails.root.join('app', 'views', 'layouts', 'lato').to_s
|
10
12
|
|
@@ -23,6 +25,11 @@ namespace :lato do
|
|
23
25
|
|
24
26
|
FileUtils.copy(src_file_path, dest_file_path) unless File.exist? dest_file_path
|
25
27
|
end
|
28
|
+
|
29
|
+
# Copy "lato_user_application.rb" model concern from ghem to main application
|
30
|
+
gem_concern_path = Lato::Engine.root.join('app', 'models', 'concerns', 'lato_user_application.rb').to_s
|
31
|
+
app_concern_path = Rails.root.join('app', 'models', 'concerns', 'lato_user_application.rb').to_s
|
32
|
+
FileUtils.copy(gem_concern_path, app_concern_path) unless File.exist? app_concern_path
|
26
33
|
end
|
27
34
|
end
|
28
35
|
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.
|
4
|
+
version: 0.1.9
|
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-11-
|
11
|
+
date: 2022-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: browser
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: A Rails engine that includes what you need to build a new project!
|
84
98
|
email:
|
85
99
|
- me@gregoriogalante.com
|
@@ -117,6 +131,7 @@ files:
|
|
117
131
|
- app/jobs/lato/application_job.rb
|
118
132
|
- app/mailers/lato/application_mailer.rb
|
119
133
|
- app/mailers/lato/user_mailer.rb
|
134
|
+
- app/models/concerns/lato_user_application.rb
|
120
135
|
- app/models/lato/application_record.rb
|
121
136
|
- app/models/lato/operation.rb
|
122
137
|
- app/models/lato/session.rb
|