lato 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +95 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/config/lato_manifest.js +5 -0
  6. data/app/assets/images/lato/user-150x150.jpg +0 -0
  7. data/app/assets/images/lato/user-300x300.jpg +0 -0
  8. data/app/assets/images/lato/user-600x600.jpg +0 -0
  9. data/app/assets/images/lato/user-900x900.jpg +0 -0
  10. data/app/assets/javascripts/lato/application.js +6 -0
  11. data/app/assets/javascripts/lato/controllers/application.js +9 -0
  12. data/app/assets/javascripts/lato/controllers/index.js +11 -0
  13. data/app/assets/javascripts/lato/controllers/lato_action_controller.js +92 -0
  14. data/app/assets/javascripts/lato/controllers/lato_aside_opener_controller.js +21 -0
  15. data/app/assets/javascripts/lato/controllers/lato_feedback_controller.js +13 -0
  16. data/app/assets/javascripts/lato/controllers/lato_form_controller.js +60 -0
  17. data/app/assets/javascripts/lato/controllers/lato_hello_controller.js +12 -0
  18. data/app/assets/javascripts/lato/controllers/lato_operation_controller.js +24 -0
  19. data/app/assets/stylesheets/lato/application.scss +73 -0
  20. data/app/controllers/concerns/lato/componentable.rb +52 -0
  21. data/app/controllers/concerns/lato/layoutable.rb +27 -0
  22. data/app/controllers/concerns/lato/sessionable.rb +45 -0
  23. data/app/controllers/lato/account_controller.rb +82 -0
  24. data/app/controllers/lato/application_controller.rb +21 -0
  25. data/app/controllers/lato/authentication_controller.rb +121 -0
  26. data/app/controllers/lato/operations_controller.rb +23 -0
  27. data/app/helpers/lato/application_helper.rb +5 -0
  28. data/app/helpers/lato/components_helper.rb +183 -0
  29. data/app/jobs/lato/application_job.rb +59 -0
  30. data/app/mailers/lato/application_mailer.rb +6 -0
  31. data/app/mailers/lato/user_mailer.rb +23 -0
  32. data/app/models/lato/application_record.rb +5 -0
  33. data/app/models/lato/operation.rb +96 -0
  34. data/app/models/lato/session.rb +36 -0
  35. data/app/models/lato/user.rb +164 -0
  36. data/app/views/lato/account/_alert-accepted-privacy-policy-version.html.erb +20 -0
  37. data/app/views/lato/account/_alert-accepted-terms-and-conditions-version.html.erb +20 -0
  38. data/app/views/lato/account/_form-destroy.html.erb +21 -0
  39. data/app/views/lato/account/_form-password.html.erb +28 -0
  40. data/app/views/lato/account/_form-user.html.erb +40 -0
  41. data/app/views/lato/account/index.html.erb +65 -0
  42. data/app/views/lato/authentication/_form-recover-password.html.erb +20 -0
  43. data/app/views/lato/authentication/_form-signin.html.erb +31 -0
  44. data/app/views/lato/authentication/_form-signup.html.erb +47 -0
  45. data/app/views/lato/authentication/_form-update-password.html.erb +30 -0
  46. data/app/views/lato/authentication/_form-verify-email.html.erb +22 -0
  47. data/app/views/lato/authentication/recover_password.html.erb +13 -0
  48. data/app/views/lato/authentication/signin.html.erb +13 -0
  49. data/app/views/lato/authentication/signout.html.erb +11 -0
  50. data/app/views/lato/authentication/signup.html.erb +13 -0
  51. data/app/views/lato/authentication/update_password.html.erb +13 -0
  52. data/app/views/lato/authentication/verify_email.html.erb +7 -0
  53. data/app/views/lato/components/_index.html.erb +89 -0
  54. data/app/views/lato/components/_navbar_nav_item.html.erb +5 -0
  55. data/app/views/lato/components/_operation.html.erb +68 -0
  56. data/app/views/lato/components/_page_head.html.erb +15 -0
  57. data/app/views/lato/components/_sidebar_nav_item.html.erb +5 -0
  58. data/app/views/lato/mailer/user/email_verification_mail.html.erb +9 -0
  59. data/app/views/lato/mailer/user/password_update_mail.html.erb +9 -0
  60. data/app/views/lato/operations/show.html.erb +3 -0
  61. data/app/views/layouts/lato/_action.html.erb +17 -0
  62. data/app/views/layouts/lato/_aside-opener.html.erb +7 -0
  63. data/app/views/layouts/lato/_content.html.erb +5 -0
  64. data/app/views/layouts/lato/_feedbacks.html.erb +16 -0
  65. data/app/views/layouts/lato/_footer.html.erb +11 -0
  66. data/app/views/layouts/lato/_mailer-foot_content.html.erb +2 -0
  67. data/app/views/layouts/lato/_mailer-head_content.html.erb +2 -0
  68. data/app/views/layouts/lato/_navbar-brand_content.html.erb +1 -0
  69. data/app/views/layouts/lato/_navbar-nav_content.html.erb +15 -0
  70. data/app/views/layouts/lato/_navbar.html.erb +16 -0
  71. data/app/views/layouts/lato/_sidebar-nav_content.html.erb +3 -0
  72. data/app/views/layouts/lato/_sidebar.html.erb +5 -0
  73. data/app/views/layouts/lato/application.html.erb +44 -0
  74. data/app/views/layouts/lato/mailer.html.erb +3 -0
  75. data/config/importmap.rb +8 -0
  76. data/config/locales/it.yml +235 -0
  77. data/config/routes.rb +35 -0
  78. data/db/migrate/20221022205744_create_lato_users.rb +14 -0
  79. data/db/migrate/20221118072130_create_lato_operations.rb +14 -0
  80. data/lib/lato/btstrap.rb +36 -0
  81. data/lib/lato/config.rb +39 -0
  82. data/lib/lato/engine.rb +13 -0
  83. data/lib/lato/version.rb +3 -0
  84. data/lib/lato.rb +27 -0
  85. data/lib/tasks/lato_tasks.rake +28 -0
  86. metadata +199 -0
@@ -0,0 +1,14 @@
1
+ class CreateLatoUsers < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :lato_users do |t|
4
+ t.string :first_name
5
+ t.string :last_name
6
+ t.string :email
7
+ t.datetime :email_verified_at
8
+ t.string :password_digest
9
+ t.integer :accepted_privacy_policy_version
10
+ t.integer :accepted_terms_and_conditions_version
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class CreateLatoOperations < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :lato_operations do |t|
4
+ t.string :active_job_name
5
+ t.json :active_job_input
6
+ t.json :active_job_output
7
+ t.integer :status
8
+ t.integer :percentage, min: 0, max: 100
9
+ t.datetime :closed_at
10
+ t.references :lato_user, index: true, foreign_key: true
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,36 @@
1
+ module Lato
2
+ # Btstrap
3
+ # This class contains the default boostrap classes used on layout elements of the application.
4
+ ##
5
+ class Btstrap
6
+ # Navbar classes
7
+ attr_accessor :navbar, :navbar_container, :navbar_collapse
8
+
9
+ # Sidebar classes
10
+ attr_accessor :sidebar
11
+
12
+ # Content classes
13
+ attr_accessor :content, :content_container
14
+
15
+ # Footer classes
16
+ attr_accessor :footer, :footer_container
17
+
18
+ def initialize
19
+ # Navbar defaults
20
+ @navbar = 'navbar-light navbar-expand-lg fixed-top bg-light shadow-sm px-md-3'
21
+ @navbar_container = 'container-fluid'
22
+ @navbar_collapse = 'justify-content-end'
23
+
24
+ # Sidebar defaults
25
+ @sidebar = 'p-3 bg-light border-end'
26
+
27
+ # Content defaults
28
+ @content = 'px-md-3 py-3'
29
+ @content_container = 'container-fluid'
30
+
31
+ # Footer defaults
32
+ @footer = 'bg-light px-md-3 py-2'
33
+ @footer_container = 'container-fluid text-center text-muted d-md-flex justify-content-between p-3'
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,39 @@
1
+ module Lato
2
+ # Config
3
+ # This class contains the default configuration of the engine.
4
+ ##
5
+ class Config
6
+ # Applicaction configs
7
+ attr_accessor :application_title, :application_company_name, :application_company_url
8
+
9
+ # Session configs
10
+ attr_accessor :session_lifetime, :session_root_path
11
+
12
+ # Authentication configs
13
+ attr_accessor :auth_disable_signup
14
+
15
+ # Email configs
16
+ attr_accessor :email_from
17
+
18
+ # Legal settings
19
+ attr_accessor :legal_privacy_policy_url, :legal_privacy_policy_version, :legal_terms_and_conditions_url, :legal_terms_and_conditions_version
20
+
21
+ def initialize
22
+ @application_title = 'Lato'
23
+ @application_company_name = 'Lato Team'
24
+ @application_company_url = 'https://github.com/Lato-GAM'
25
+
26
+ @auth_disable_signup = false
27
+
28
+ @session_lifetime = 30.days
29
+ @session_root_path = nil # :tutorial_path
30
+
31
+ @email_from = 'lato@example.com'
32
+
33
+ @legal_privacy_policy_url = '#'
34
+ @legal_privacy_policy_version = 1
35
+ @legal_terms_and_conditions_url = '#'
36
+ @legal_terms_and_conditions_version = 1
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,13 @@
1
+ module Lato
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Lato
4
+
5
+ initializer 'lato.importmap', before: 'importmap' do |app|
6
+ app.config.importmap.paths << root.join('config/importmap.rb')
7
+ end
8
+
9
+ initializer "lato.precompile" do |app|
10
+ app.config.assets.precompile << "lato_manifest.js"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Lato
2
+ VERSION = "0.1.0"
3
+ end
data/lib/lato.rb ADDED
@@ -0,0 +1,27 @@
1
+ require "kaminari"
2
+ require "bootstrap"
3
+
4
+ require "lato/version"
5
+ require "lato/engine"
6
+ require "lato/config"
7
+ require "lato/btstrap"
8
+
9
+ module Lato
10
+ class << self
11
+ def config
12
+ @config ||= Config.new
13
+ end
14
+
15
+ def configure
16
+ yield config
17
+ end
18
+
19
+ def btstrap
20
+ @btstrap ||= Btstrap.new
21
+ end
22
+
23
+ def bootstrap
24
+ yield btstrap
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ require 'fileutils'
2
+
3
+ namespace :lato do
4
+ namespace :install do
5
+ desc 'Install Lato engine and run tasks on main rails application'
6
+ task :application do
7
+ # Copy all "_content.html.erb" parials on layouts/lato from gem to main application
8
+ gem_layout_path = Lato::Engine.root.join('app', 'views', 'layouts', 'lato').to_s
9
+ app_layout_path = Rails.root.join('app', 'views', 'layouts', 'lato').to_s
10
+
11
+ # create app layout path if not exists
12
+ FileUtils.mkdir_p(app_layout_path)
13
+
14
+ # list patials inside gem_layout_path
15
+ partials_content_files = Dir.glob("#{gem_layout_path}/*_content.html.erb")
16
+
17
+ # copy partials from gem to main app
18
+ partials_content_files.each do |src_file_pathname|
19
+ src_file_path = src_file_pathname.to_s
20
+ dest_file_path = src_file_path.gsub(gem_layout_path, app_layout_path)
21
+ file_name = src_file_path.gsub(gem_layout_path, '')
22
+ next if file_name == '/_content.html.erb'
23
+
24
+ FileUtils.copy(src_file_path, dest_file_path) unless File.exist? dest_file_path
25
+ end
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,199 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lato
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gregorio Galante
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-11-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 7.0.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 7.0.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails-i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bcrypt
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bootstrap
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: kaminari
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Engine that includes users and plans management
84
+ email:
85
+ - me@gregoriogalante.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - MIT-LICENSE
91
+ - README.md
92
+ - Rakefile
93
+ - app/assets/config/lato_manifest.js
94
+ - app/assets/images/lato/user-150x150.jpg
95
+ - app/assets/images/lato/user-300x300.jpg
96
+ - app/assets/images/lato/user-600x600.jpg
97
+ - app/assets/images/lato/user-900x900.jpg
98
+ - app/assets/javascripts/lato/application.js
99
+ - app/assets/javascripts/lato/controllers/application.js
100
+ - app/assets/javascripts/lato/controllers/index.js
101
+ - app/assets/javascripts/lato/controllers/lato_action_controller.js
102
+ - app/assets/javascripts/lato/controllers/lato_aside_opener_controller.js
103
+ - app/assets/javascripts/lato/controllers/lato_feedback_controller.js
104
+ - app/assets/javascripts/lato/controllers/lato_form_controller.js
105
+ - app/assets/javascripts/lato/controllers/lato_hello_controller.js
106
+ - app/assets/javascripts/lato/controllers/lato_operation_controller.js
107
+ - app/assets/stylesheets/lato/application.scss
108
+ - app/controllers/concerns/lato/componentable.rb
109
+ - app/controllers/concerns/lato/layoutable.rb
110
+ - app/controllers/concerns/lato/sessionable.rb
111
+ - app/controllers/lato/account_controller.rb
112
+ - app/controllers/lato/application_controller.rb
113
+ - app/controllers/lato/authentication_controller.rb
114
+ - app/controllers/lato/operations_controller.rb
115
+ - app/helpers/lato/application_helper.rb
116
+ - app/helpers/lato/components_helper.rb
117
+ - app/jobs/lato/application_job.rb
118
+ - app/mailers/lato/application_mailer.rb
119
+ - app/mailers/lato/user_mailer.rb
120
+ - app/models/lato/application_record.rb
121
+ - app/models/lato/operation.rb
122
+ - app/models/lato/session.rb
123
+ - app/models/lato/user.rb
124
+ - app/views/lato/account/_alert-accepted-privacy-policy-version.html.erb
125
+ - app/views/lato/account/_alert-accepted-terms-and-conditions-version.html.erb
126
+ - app/views/lato/account/_form-destroy.html.erb
127
+ - app/views/lato/account/_form-password.html.erb
128
+ - app/views/lato/account/_form-user.html.erb
129
+ - app/views/lato/account/index.html.erb
130
+ - app/views/lato/authentication/_form-recover-password.html.erb
131
+ - app/views/lato/authentication/_form-signin.html.erb
132
+ - app/views/lato/authentication/_form-signup.html.erb
133
+ - app/views/lato/authentication/_form-update-password.html.erb
134
+ - app/views/lato/authentication/_form-verify-email.html.erb
135
+ - app/views/lato/authentication/recover_password.html.erb
136
+ - app/views/lato/authentication/signin.html.erb
137
+ - app/views/lato/authentication/signout.html.erb
138
+ - app/views/lato/authentication/signup.html.erb
139
+ - app/views/lato/authentication/update_password.html.erb
140
+ - app/views/lato/authentication/verify_email.html.erb
141
+ - app/views/lato/components/_index.html.erb
142
+ - app/views/lato/components/_navbar_nav_item.html.erb
143
+ - app/views/lato/components/_operation.html.erb
144
+ - app/views/lato/components/_page_head.html.erb
145
+ - app/views/lato/components/_sidebar_nav_item.html.erb
146
+ - app/views/lato/mailer/user/email_verification_mail.html.erb
147
+ - app/views/lato/mailer/user/password_update_mail.html.erb
148
+ - app/views/lato/operations/show.html.erb
149
+ - app/views/layouts/lato/_action.html.erb
150
+ - app/views/layouts/lato/_aside-opener.html.erb
151
+ - app/views/layouts/lato/_content.html.erb
152
+ - app/views/layouts/lato/_feedbacks.html.erb
153
+ - app/views/layouts/lato/_footer.html.erb
154
+ - app/views/layouts/lato/_mailer-foot_content.html.erb
155
+ - app/views/layouts/lato/_mailer-head_content.html.erb
156
+ - app/views/layouts/lato/_navbar-brand_content.html.erb
157
+ - app/views/layouts/lato/_navbar-nav_content.html.erb
158
+ - app/views/layouts/lato/_navbar.html.erb
159
+ - app/views/layouts/lato/_sidebar-nav_content.html.erb
160
+ - app/views/layouts/lato/_sidebar.html.erb
161
+ - app/views/layouts/lato/application.html.erb
162
+ - app/views/layouts/lato/mailer.html.erb
163
+ - config/importmap.rb
164
+ - config/locales/it.yml
165
+ - config/routes.rb
166
+ - db/migrate/20221022205744_create_lato_users.rb
167
+ - db/migrate/20221118072130_create_lato_operations.rb
168
+ - lib/lato.rb
169
+ - lib/lato/btstrap.rb
170
+ - lib/lato/config.rb
171
+ - lib/lato/engine.rb
172
+ - lib/lato/version.rb
173
+ - lib/tasks/lato_tasks.rake
174
+ homepage: https://github.com/Lato-GAM/lato
175
+ licenses:
176
+ - MIT
177
+ metadata:
178
+ homepage_uri: https://github.com/Lato-GAM/lato
179
+ source_code_uri: https://github.com/Lato-GAM/lato
180
+ post_install_message:
181
+ rdoc_options: []
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ requirements: []
195
+ rubygems_version: 3.2.19
196
+ signing_key:
197
+ specification_version: 4
198
+ summary: Basic engine for all Lato projects
199
+ test_files: []