moduler 0.3.0 → 0.5.0

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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/moduler/tailwind.css +852 -2
  3. data/app/assets/javascripts/moduler/controllers/wysiwyg_controller.js +126 -0
  4. data/app/assets/javascripts/moduler/vendor/marked.esm.js +77 -0
  5. data/app/components/moduler/form/file_component.html.erb +14 -0
  6. data/app/components/moduler/form/file_component.rb +11 -0
  7. data/app/components/moduler/form/select_component.html.erb +1 -1
  8. data/app/components/moduler/form/textarea_component.html.erb +14 -0
  9. data/app/components/moduler/form/textarea_component.rb +11 -0
  10. data/app/components/moduler/form/wysiwyg_component.html.erb +30 -0
  11. data/app/components/moduler/form/wysiwyg_component.rb +62 -0
  12. data/app/controllers/concerns/moduler/authentication.rb +1 -1
  13. data/app/controllers/concerns/moduler/require_document_acceptance.rb +31 -0
  14. data/app/controllers/moduler/administration/application_controller.rb +2 -0
  15. data/app/controllers/moduler/administration/articles_controller.rb +57 -0
  16. data/app/controllers/moduler/administration/documents_controller.rb +56 -0
  17. data/app/controllers/moduler/administration/users_controller.rb +2 -2
  18. data/app/controllers/moduler/application_controller.rb +1 -0
  19. data/app/controllers/moduler/articles_controller.rb +16 -0
  20. data/app/controllers/moduler/document_acceptances_controller.rb +25 -0
  21. data/app/controllers/moduler/profile/sessions/revocation_controller.rb +2 -0
  22. data/app/controllers/moduler/profile/sessions_controller.rb +2 -0
  23. data/app/controllers/moduler/profile_controller.rb +2 -0
  24. data/app/controllers/moduler/sessions_controller.rb +15 -6
  25. data/app/controllers/moduler/users_controller.rb +1 -0
  26. data/app/models/moduler/article.rb +25 -0
  27. data/app/models/moduler/document.rb +17 -0
  28. data/app/models/moduler/user.rb +8 -0
  29. data/app/models/moduler/user_document.rb +8 -0
  30. data/app/policies/moduler/administration/article_policy.rb +29 -0
  31. data/app/policies/moduler/administration/document_policy.rb +25 -0
  32. data/app/services/moduler/document_acceptance.rb +43 -0
  33. data/app/views/layouts/moduler/articles.html.erb +18 -0
  34. data/app/views/moduler/administration/articles/_article.html.erb +13 -0
  35. data/app/views/moduler/administration/articles/_form.html.erb +18 -0
  36. data/app/views/moduler/administration/articles/edit.html.erb +1 -0
  37. data/app/views/moduler/administration/articles/index.html.erb +13 -0
  38. data/app/views/moduler/administration/articles/new.html.erb +1 -0
  39. data/app/views/moduler/administration/documents/_document.html.erb +19 -0
  40. data/app/views/moduler/administration/documents/_form.html.erb +23 -0
  41. data/app/views/moduler/administration/documents/edit.html.erb +1 -0
  42. data/app/views/moduler/administration/documents/index.html.erb +13 -0
  43. data/app/views/moduler/administration/documents/new.html.erb +1 -0
  44. data/app/views/moduler/administration/users/edit.html.erb +1 -0
  45. data/app/views/moduler/administration/users/new.html.erb +1 -0
  46. data/app/views/moduler/articles/_article.html.erb +16 -0
  47. data/app/views/moduler/articles/index.html.erb +15 -0
  48. data/app/views/moduler/articles/show.html.erb +21 -0
  49. data/app/views/moduler/common/_sidebar.html.erb +3 -2
  50. data/app/views/moduler/common/administration/_sidebar.html.erb +7 -0
  51. data/app/views/moduler/common/profile/_sidebar.html.erb +6 -0
  52. data/app/views/moduler/document_acceptances/new.html.erb +36 -0
  53. data/app/views/moduler/home/index.html.erb +6 -0
  54. data/app/views/moduler/profile/edit.html.erb +1 -1
  55. data/app/views/moduler/profile/sessions/index.html.erb +1 -1
  56. data/config/importmap.rb +2 -0
  57. data/config/locales/moduler/administration/articles/en.yml +37 -0
  58. data/config/locales/moduler/administration/documents/en.yml +35 -0
  59. data/config/locales/moduler/administration/users/en.yml +6 -0
  60. data/config/locales/moduler/articles/en.yml +13 -0
  61. data/config/locales/moduler/common/en.yml +12 -4
  62. data/config/locales/moduler/components/en.yml +16 -0
  63. data/config/locales/moduler/document_acceptances/en.yml +17 -0
  64. data/config/locales/moduler/sessions/en.yml +1 -0
  65. data/config/routes.rb +7 -0
  66. data/db/migrate/20261026203827_create_moduler_articles.rb +15 -0
  67. data/db/migrate/20261104120000_add_status_to_moduler_users.rb +6 -0
  68. data/db/migrate/20261104205837_create_moduler_documents.rb +10 -0
  69. data/db/migrate/20261104205950_create_moduler_user_documents.rb +12 -0
  70. data/lib/moduler/version.rb +1 -1
  71. data/lib/moduler.rb +3 -0
  72. metadata +73 -2
@@ -0,0 +1,37 @@
1
+ en:
2
+ moduler:
3
+ administration:
4
+ articles:
5
+ index:
6
+ title: Articles
7
+ description: Posts published on your own public site
8
+ empty: No articles found
9
+ action:
10
+ new: Create
11
+ article:
12
+ created: Created %{time} ago
13
+ action:
14
+ edit: Edit
15
+ destroy: Destroy
16
+ confirmation:
17
+ destroy: Are you sure?
18
+ create:
19
+ notice: Article has been created
20
+ update:
21
+ notice: Article has been updated
22
+ destroy:
23
+ notice: Article has been deleted
24
+ form:
25
+ title: Article
26
+ label:
27
+ title: Title
28
+ path: Path
29
+ description: Description
30
+ keywords: Keywords
31
+ content: Content
32
+ description:
33
+ path: The article's URL -- letters, numbers, and hyphens only.
34
+ description: Shown in search results and social previews.
35
+ keywords: Comma-separated, for search results and social previews.
36
+ action:
37
+ save: Save
@@ -0,0 +1,35 @@
1
+ en:
2
+ moduler:
3
+ administration:
4
+ documents:
5
+ kinds:
6
+ privacy_policy: Privacy policy
7
+ terms_and_conditions: Terms and conditions
8
+ data_processing_agreement: Data processing agreement
9
+ index:
10
+ title: Documents
11
+ description: Legal documents your users accept, such as the privacy policy or terms and conditions
12
+ empty: No documents found
13
+ action:
14
+ new: Create
15
+ document:
16
+ created: Created %{time} ago
17
+ action:
18
+ download: Download
19
+ edit: Edit
20
+ create:
21
+ notice: Document has been created
22
+ update:
23
+ notice: Document has been updated
24
+ form:
25
+ title: Document
26
+ label:
27
+ name: Name
28
+ kind: Kind
29
+ file: File
30
+ description:
31
+ file: PDF, smaller than 10 MB. The file cannot be changed after the document is created.
32
+ file_locked: The file cannot be changed.
33
+ no_file: No file
34
+ action:
35
+ save: Save
@@ -5,6 +5,10 @@ en:
5
5
  roles:
6
6
  member: Member
7
7
  administrator: Administrator
8
+ statuses:
9
+ waitlisted: Waitlisted
10
+ active: Active
11
+ inactive: Inactive
8
12
  index:
9
13
  title: Users
10
14
  description: Manage user accounts and their roles. Search users by email address.
@@ -16,6 +20,7 @@ en:
16
20
  label:
17
21
  email_address: Email address
18
22
  role: Role
23
+ status: Status
19
24
  password: Password
20
25
  description:
21
26
  password: Use at least 8 characters.
@@ -31,6 +36,7 @@ en:
31
36
  label:
32
37
  email_address: Email address
33
38
  role: Role
39
+ status: Status
34
40
  section:
35
41
  data: User data
36
42
  action:
@@ -0,0 +1,13 @@
1
+ en:
2
+ moduler:
3
+ articles:
4
+ index:
5
+ title: Articles
6
+ description: Read the latest articles.
7
+ empty: No articles have been published yet.
8
+ article:
9
+ action:
10
+ show: Read more
11
+ show:
12
+ action:
13
+ index: "← All articles"
@@ -1,10 +1,18 @@
1
1
  en:
2
2
  moduler:
3
3
  common:
4
- sidebar:
5
- action:
6
- profile: Profile
7
- sessions: Sessions
4
+ administration:
5
+ sidebar:
6
+ action:
7
+ users: Users
8
+ sessions: Sessions
9
+ articles: Articles
10
+ documents: Documents
11
+ profile:
12
+ sidebar:
13
+ action:
14
+ profile: Profile
15
+ sessions: Sessions
8
16
  header:
9
17
  nav:
10
18
  administration: Administration
@@ -9,3 +9,19 @@ en:
9
9
  clear: Clear
10
10
  list:
11
11
  empty: No results found.
12
+ form:
13
+ wysiwyg:
14
+ action:
15
+ bold: B
16
+ italic: I
17
+ h1: H1
18
+ h2: H2
19
+ h3: H3
20
+ quote: Quote
21
+ code: Code
22
+ ul: List
23
+ ol: 1. List
24
+ fenced_code: "</>"
25
+ link: Link
26
+ image: Image
27
+ upload: Upload
@@ -0,0 +1,17 @@
1
+ en:
2
+ activemodel:
3
+ errors:
4
+ models:
5
+ moduler/document_acceptance:
6
+ not_all_accepted: Accept all documents to continue.
7
+ moduler:
8
+ document_acceptances:
9
+ new:
10
+ title: Before you continue
11
+ description: Read and accept the documents below to get access to the panel.
12
+ accept: "I have read and accept: %{name}"
13
+ action:
14
+ read: Read the document
15
+ submit: Accept and continue
16
+ create:
17
+ notice: Thank you. You can now use the panel.
@@ -15,4 +15,5 @@ en:
15
15
  password: Enter your password
16
16
  create:
17
17
  invalid_credentials: Invalid credentials
18
+ inactive_account: Your account does not have access to the panel.
18
19
  rate_limited: Too many sign-in attempts. Please try again in a few minutes.
data/config/routes.rb CHANGED
@@ -1,7 +1,11 @@
1
1
  Moduler::Engine.routes.draw do
2
+ resources :articles, only: %i[ index show ], param: :path
3
+
2
4
  resource :session, only: %i[new create destroy]
3
5
  resource :user, only: %i[new create]
4
6
 
7
+ resource :document_acceptance, only: %i[ new create ]
8
+
5
9
  resource :profile, only: %i[ edit update ], controller: :profile
6
10
  namespace :profile do
7
11
  namespace :sessions do
@@ -14,6 +18,9 @@ Moduler::Engine.routes.draw do
14
18
  resources :users, only: %i[ index new create edit update ]
15
19
  resources :sessions, only: %i[ index destroy ]
16
20
 
21
+ resources :articles
22
+ resources :documents, only: %i[ index new create edit update ]
23
+
17
24
  root "home#index"
18
25
  end
19
26
 
@@ -0,0 +1,15 @@
1
+ class CreateModulerArticles < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_articles do |t|
4
+ t.string :path, null: false
5
+ t.string :title, null: false
6
+ t.string :description, null: false
7
+ t.string :keywords, null: false
8
+ t.text :content, null: false
9
+
10
+ t.timestamps null: false
11
+ end
12
+
13
+ add_index :moduler_articles, :path, unique: true
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ class AddStatusToModulerUsers < ActiveRecord::Migration[8.1]
2
+ def change
3
+ add_column :moduler_users, :status, :integer, default: 1, null: false
4
+ add_index :moduler_users, :status
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ class CreateModulerDocuments < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_documents do |t|
4
+ t.string :name, null: false
5
+ t.string :kind, null: false
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateModulerUserDocuments < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_user_documents do |t|
4
+ t.references :moduler_user, type: :uuid, null: false, foreign_key: true
5
+ t.references :moduler_document, null: false, foreign_key: true, index: false
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ add_index :moduler_user_documents, %i[ moduler_document_id moduler_user_id ], unique: true
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Moduler
2
- VERSION = "0.3.0"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/moduler.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  require "view_component"
2
2
  require "pg_search"
3
3
  require "pundit"
4
+ require "active_storage/engine"
5
+ require "active_storage_validations"
6
+ require "redcarpet"
4
7
 
5
8
  require "moduler/version"
6
9
  require "moduler/engine"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Kowalewski
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-10-25 00:00:00.000000000 Z
10
+ date: 2026-11-04 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -179,6 +179,34 @@ dependencies:
179
179
  - - "~>"
180
180
  - !ruby/object:Gem::Version
181
181
  version: '2.5'
182
+ - !ruby/object:Gem::Dependency
183
+ name: active_storage_validations
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '4.1'
189
+ type: :runtime
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: '4.1'
196
+ - !ruby/object:Gem::Dependency
197
+ name: redcarpet
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - "~>"
201
+ - !ruby/object:Gem::Version
202
+ version: '3.6'
203
+ type: :runtime
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - "~>"
208
+ - !ruby/object:Gem::Version
209
+ version: '3.6'
182
210
  email:
183
211
  - me@tkowalewski.pl
184
212
  executables: []
@@ -192,6 +220,8 @@ files:
192
220
  - app/assets/config/moduler/manifest.js
193
221
  - app/assets/javascripts/moduler/application.js
194
222
  - app/assets/javascripts/moduler/controllers/flash_controller.js
223
+ - app/assets/javascripts/moduler/controllers/wysiwyg_controller.js
224
+ - app/assets/javascripts/moduler/vendor/marked.esm.js
195
225
  - app/assets/stylesheets/moduler/application.css
196
226
  - app/assets/stylesheets/moduler/tailwind.css
197
227
  - app/components/moduler/administration/page_component.html.erb
@@ -208,6 +238,8 @@ files:
208
238
  - app/components/moduler/form/base_error_component.rb
209
239
  - app/components/moduler/form/email_component.html.erb
210
240
  - app/components/moduler/form/email_component.rb
241
+ - app/components/moduler/form/file_component.html.erb
242
+ - app/components/moduler/form/file_component.rb
211
243
  - app/components/moduler/form/password_component.html.erb
212
244
  - app/components/moduler/form/password_component.rb
213
245
  - app/components/moduler/form/section_component.html.erb
@@ -218,6 +250,10 @@ files:
218
250
  - app/components/moduler/form/submit_component.rb
219
251
  - app/components/moduler/form/text_component.html.erb
220
252
  - app/components/moduler/form/text_component.rb
253
+ - app/components/moduler/form/textarea_component.html.erb
254
+ - app/components/moduler/form/textarea_component.rb
255
+ - app/components/moduler/form/wysiwyg_component.html.erb
256
+ - app/components/moduler/form/wysiwyg_component.rb
221
257
  - app/components/moduler/list_component.html.erb
222
258
  - app/components/moduler/list_component.rb
223
259
  - app/components/moduler/list_item_component.html.erb
@@ -227,11 +263,16 @@ files:
227
263
  - app/components/moduler/sidebar_action_component.html.erb
228
264
  - app/components/moduler/sidebar_action_component.rb
229
265
  - app/controllers/concerns/moduler/authentication.rb
266
+ - app/controllers/concerns/moduler/require_document_acceptance.rb
230
267
  - app/controllers/moduler/administration/application_controller.rb
268
+ - app/controllers/moduler/administration/articles_controller.rb
269
+ - app/controllers/moduler/administration/documents_controller.rb
231
270
  - app/controllers/moduler/administration/home_controller.rb
232
271
  - app/controllers/moduler/administration/sessions_controller.rb
233
272
  - app/controllers/moduler/administration/users_controller.rb
234
273
  - app/controllers/moduler/application_controller.rb
274
+ - app/controllers/moduler/articles_controller.rb
275
+ - app/controllers/moduler/document_acceptances_controller.rb
235
276
  - app/controllers/moduler/home_controller.rb
236
277
  - app/controllers/moduler/profile/sessions/revocation_controller.rb
237
278
  - app/controllers/moduler/profile/sessions_controller.rb
@@ -245,20 +286,37 @@ files:
245
286
  - app/lib/moduler/form_builder.rb
246
287
  - app/mailers/moduler/application_mailer.rb
247
288
  - app/models/moduler/application_record.rb
289
+ - app/models/moduler/article.rb
248
290
  - app/models/moduler/current.rb
291
+ - app/models/moduler/document.rb
249
292
  - app/models/moduler/session.rb
250
293
  - app/models/moduler/user.rb
294
+ - app/models/moduler/user_document.rb
295
+ - app/policies/moduler/administration/article_policy.rb
251
296
  - app/policies/moduler/administration/base_policy.rb
297
+ - app/policies/moduler/administration/document_policy.rb
252
298
  - app/policies/moduler/administration/home_policy.rb
253
299
  - app/policies/moduler/administration/session_policy.rb
254
300
  - app/policies/moduler/administration/user_policy.rb
255
301
  - app/policies/moduler/application_policy.rb
302
+ - app/services/moduler/document_acceptance.rb
256
303
  - app/views/kaminari/_gap.html.erb
257
304
  - app/views/kaminari/_next_page.html.erb
258
305
  - app/views/kaminari/_page.html.erb
259
306
  - app/views/kaminari/_paginator.html.erb
260
307
  - app/views/kaminari/_prev_page.html.erb
261
308
  - app/views/layouts/moduler/application.html.erb
309
+ - app/views/layouts/moduler/articles.html.erb
310
+ - app/views/moduler/administration/articles/_article.html.erb
311
+ - app/views/moduler/administration/articles/_form.html.erb
312
+ - app/views/moduler/administration/articles/edit.html.erb
313
+ - app/views/moduler/administration/articles/index.html.erb
314
+ - app/views/moduler/administration/articles/new.html.erb
315
+ - app/views/moduler/administration/documents/_document.html.erb
316
+ - app/views/moduler/administration/documents/_form.html.erb
317
+ - app/views/moduler/administration/documents/edit.html.erb
318
+ - app/views/moduler/administration/documents/index.html.erb
319
+ - app/views/moduler/administration/documents/new.html.erb
262
320
  - app/views/moduler/administration/home/index.html.erb
263
321
  - app/views/moduler/administration/sessions/_session.html.erb
264
322
  - app/views/moduler/administration/sessions/index.html.erb
@@ -266,10 +324,15 @@ files:
266
324
  - app/views/moduler/administration/users/edit.html.erb
267
325
  - app/views/moduler/administration/users/index.html.erb
268
326
  - app/views/moduler/administration/users/new.html.erb
327
+ - app/views/moduler/articles/_article.html.erb
328
+ - app/views/moduler/articles/index.html.erb
329
+ - app/views/moduler/articles/show.html.erb
269
330
  - app/views/moduler/common/_flash.html.erb
270
331
  - app/views/moduler/common/_header.html.erb
271
332
  - app/views/moduler/common/_sidebar.html.erb
272
333
  - app/views/moduler/common/administration/_sidebar.html.erb
334
+ - app/views/moduler/common/profile/_sidebar.html.erb
335
+ - app/views/moduler/document_acceptances/new.html.erb
273
336
  - app/views/moduler/home/index.html.erb
274
337
  - app/views/moduler/profile/edit.html.erb
275
338
  - app/views/moduler/profile/sessions/_session.html.erb
@@ -277,10 +340,14 @@ files:
277
340
  - app/views/moduler/sessions/new.html.erb
278
341
  - app/views/moduler/users/new.html.erb
279
342
  - config/importmap.rb
343
+ - config/locales/moduler/administration/articles/en.yml
344
+ - config/locales/moduler/administration/documents/en.yml
280
345
  - config/locales/moduler/administration/sessions/en.yml
281
346
  - config/locales/moduler/administration/users/en.yml
347
+ - config/locales/moduler/articles/en.yml
282
348
  - config/locales/moduler/common/en.yml
283
349
  - config/locales/moduler/components/en.yml
350
+ - config/locales/moduler/document_acceptances/en.yml
284
351
  - config/locales/moduler/en.yml
285
352
  - config/locales/moduler/profile/en.yml
286
353
  - config/locales/moduler/profile/sessions/en.yml
@@ -291,6 +358,10 @@ files:
291
358
  - db/migrate/20260322153744_create_moduler_sessions.rb
292
359
  - db/migrate/20261015171504_add_role_to_moduler_users.rb
293
360
  - db/migrate/20261020191709_enable_pg_trgm.rb
361
+ - db/migrate/20261026203827_create_moduler_articles.rb
362
+ - db/migrate/20261104120000_add_status_to_moduler_users.rb
363
+ - db/migrate/20261104205837_create_moduler_documents.rb
364
+ - db/migrate/20261104205950_create_moduler_user_documents.rb
294
365
  - lib/moduler.rb
295
366
  - lib/moduler/configuration.rb
296
367
  - lib/moduler/engine.rb