lato 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '068d1c201b840125377b8642cd80521f5a0a4666e0b1610dd5652e3cddd3bbb3'
4
- data.tar.gz: 2cbe84bb4f4c2f9de5ea1784bd0bcfed5895a1b0d904f9ab5338f90897cca601
3
+ metadata.gz: d6adeb777cb566b2e9d542140ebf059a817c6f94a7afa11b508f194d3ffe6a1a
4
+ data.tar.gz: 6e462303df7baf36f4dac902c5c25d1a5da45abeeaf3dca434c6333cc3793555
5
5
  SHA512:
6
- metadata.gz: db9aabc6b8fa9d03b0267112d34f89ad6724caadcdf3f2b7d7c070fa2197e182e8511f91c479280d128d38b172767916870823af3d147b7387fd7dbbd4ee511c
7
- data.tar.gz: eb095e507554d867bd6ea8d24a3639bf507cac2e3e80b58c3ab64f96164f66b4cfd96fe1d8134450c1ba3cc0a85d5b588696eaf07e1b0dadcb153171a20d34d1
6
+ metadata.gz: fb537cf7b8d676714301243ed815eb50e3ee9216ce72d10c0f034a38119952c8c5e8b404e70d641ba26c576c89de5a5ebe04085404cc5cb3749cee0ccbbbd931
7
+ data.tar.gz: 8b9ef05c50607bce795873155a4be715162abe82c96f9792299fd4aeb91f4f07f50f8e5721d1361c11a9fe916dd13ce8b5531e0a8a8c1dd059d50634a0db0921
@@ -0,0 +1,9 @@
1
+ module LatoUserApplication
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ # Add here custom relations, scopes, ecc.
6
+ end
7
+
8
+ # Add here custom methods
9
+ end
@@ -1,5 +1,7 @@
1
1
  module Lato
2
2
  class User < ApplicationRecord
3
+ include LatoUserApplication
4
+
3
5
  has_secure_password
4
6
 
5
7
  # Kredis
@@ -4,86 +4,94 @@
4
4
  <%= hidden_field_tag :key, key %>
5
5
  <%= hidden_field_tag :sort_by, params[:sort_by] %>
6
6
 
7
- <div class="table-responsive">
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
- <div class="btn-group ms-2">
24
- <% if custom_actions.any? %>
25
- <% custom_actions.each do |action_key, action_params| %>
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
- <div class="position-relative btn btn-sm <%= params[:sort_by] == "#{column}|DESC" ? 'btn-primary' : 'btn-outline-primary' %>">
49
- <input type="submit" name="sort_by" value="<%= column %>|DESC" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0">
50
- <i class="bi bi-sort-down"></i>
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
- <% end %>
54
- </div>
55
- </th>
38
+ </div>
39
+ </td>
40
+ </tr>
56
41
  <% end %>
57
- </tr>
58
- </thead>
59
- <tbody>
60
- <% collection.each do |member| %>
61
- <tr>
42
+ <tr class="align-middle">
62
43
  <% columns.each do |column| %>
63
- <td>
64
- <% viewer_function_name = "#{model_name_underscore}_#{column}" %>
65
- <%= respond_to?(viewer_function_name) ? send(viewer_function_name, member) : member.send(column) %>
66
- </td>
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
- <% end %>
70
- </tbody>
71
- <tfoot>
72
- <tr>
73
- <td colspan="<%= columns.length %>">
74
- <div class="d-flex justify-content-between align-items-center">
75
- <% if collection.respond_to?(:total_pages) %>
76
- <div><%= paginate collection %></div>
77
- <% else %>
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
- <span class="text-muted"><%= collection.count %> risultati visualizzati
81
- </div>
82
- </td>
83
- </tr>
84
- </tfoot>
85
- </table>
86
- </div>
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 %>
@@ -7,7 +7,7 @@
7
7
  <%= csrf_meta_tags %>
8
8
  <%= csp_meta_tag %>
9
9
 
10
- <%= stylesheet_link_tag "application", media: "all" %>
10
+ <%= stylesheet_link_tag Lato.config.assets_stylesheet_entry, media: "all" %>
11
11
  <%= javascript_importmap_tags %>
12
12
  </head>
13
13
  <body
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
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
data/lib/lato.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "kaminari"
2
2
  require "bootstrap"
3
+ require "browser"
3
4
 
4
5
  require "lato/version"
5
6
  require "lato/engine"
@@ -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.7
4
+ version: 0.1.8
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-27 00:00:00.000000000 Z
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