moduler 0.4.0 → 0.6.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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/moduler/tailwind.css +155 -1
  3. data/app/assets/javascripts/moduler/controllers/attachments_controller.js +30 -0
  4. data/app/assets/javascripts/moduler/controllers/dependent_select_controller.js +19 -0
  5. data/app/assets/javascripts/moduler/controllers/select_all_controller.js +15 -0
  6. data/app/components/moduler/filter_component.html.erb +9 -1
  7. data/app/components/moduler/filter_component.rb +12 -0
  8. data/app/components/moduler/form/attachments_component.html.erb +32 -0
  9. data/app/components/moduler/form/attachments_component.rb +28 -0
  10. data/app/components/moduler/form/checkboxes_component.html.erb +19 -0
  11. data/app/components/moduler/form/checkboxes_component.rb +13 -0
  12. data/app/components/moduler/form/file_component.html.erb +14 -0
  13. data/app/components/moduler/form/file_component.rb +11 -0
  14. data/app/components/moduler/form/select_component.html.erb +1 -1
  15. data/app/components/moduler/form/select_component.rb +5 -0
  16. data/app/components/moduler/form/wysiwyg_component.rb +1 -1
  17. data/app/controllers/concerns/moduler/authentication.rb +2 -2
  18. data/app/controllers/concerns/moduler/require_document_acceptance.rb +31 -0
  19. data/app/controllers/concerns/moduler/restrict_administrator_access.rb +32 -0
  20. data/app/controllers/moduler/administration/application_controller.rb +3 -0
  21. data/app/controllers/moduler/administration/articles_controller.rb +1 -1
  22. data/app/controllers/moduler/administration/documents_controller.rb +56 -0
  23. data/app/controllers/moduler/administration/emails/deliveries_controller.rb +42 -0
  24. data/app/controllers/moduler/administration/emails_controller.rb +68 -0
  25. data/app/controllers/moduler/administration/memberships_controller.rb +62 -0
  26. data/app/controllers/moduler/administration/organizations_controller.rb +51 -0
  27. data/app/controllers/moduler/administration/preferences_controller.rb +57 -0
  28. data/app/controllers/moduler/administration/roles_controller.rb +56 -0
  29. data/app/controllers/moduler/administration/users_controller.rb +2 -2
  30. data/app/controllers/moduler/application_controller.rb +3 -1
  31. data/app/controllers/moduler/articles_controller.rb +4 -2
  32. data/app/controllers/moduler/document_acceptances_controller.rb +25 -0
  33. data/app/controllers/moduler/profile/sent_emails_controller.rb +18 -0
  34. data/app/controllers/moduler/profile/sessions/revocation_controller.rb +3 -0
  35. data/app/controllers/moduler/profile/sessions_controller.rb +3 -0
  36. data/app/controllers/moduler/profile_controller.rb +6 -1
  37. data/app/controllers/moduler/sessions_controller.rb +16 -6
  38. data/app/controllers/moduler/users_controller.rb +3 -0
  39. data/app/filters/email_delivery_filter.rb +35 -0
  40. data/app/filters/organization_query_filter.rb +23 -0
  41. data/app/jobs/moduler/email_delivery_job.rb +14 -0
  42. data/app/lib/moduler/form_builder.rb +17 -3
  43. data/app/mailers/moduler/application_mailer.rb +27 -1
  44. data/app/mailers/moduler/email_mailer.rb +14 -0
  45. data/app/models/moduler/article.rb +2 -0
  46. data/app/models/moduler/document.rb +17 -0
  47. data/app/models/moduler/email.rb +59 -0
  48. data/app/models/moduler/membership.rb +25 -0
  49. data/app/models/moduler/organization.rb +13 -0
  50. data/app/models/moduler/preference.rb +44 -0
  51. data/app/models/moduler/role.rb +26 -0
  52. data/app/models/moduler/sent_email.rb +13 -0
  53. data/app/models/moduler/user.rb +21 -1
  54. data/app/models/moduler/user_document.rb +8 -0
  55. data/app/models/moduler/user_email.rb +15 -0
  56. data/app/policies/moduler/administration/document_policy.rb +25 -0
  57. data/app/policies/moduler/administration/email_policy.rb +26 -0
  58. data/app/policies/moduler/administration/membership_policy.rb +29 -0
  59. data/app/policies/moduler/administration/organization_policy.rb +25 -0
  60. data/app/policies/moduler/administration/preference_policy.rb +29 -0
  61. data/app/policies/moduler/administration/role_policy.rb +25 -0
  62. data/app/services/moduler/document_acceptance.rb +43 -0
  63. data/app/views/layouts/moduler/mailer.html.erb +30 -0
  64. data/app/views/layouts/moduler/mailer.text.erb +1 -0
  65. data/app/views/moduler/administration/articles/_article.html.erb +2 -0
  66. data/app/views/moduler/administration/articles/_form.html.erb +1 -0
  67. data/app/views/moduler/administration/documents/_document.html.erb +19 -0
  68. data/app/views/moduler/administration/documents/_form.html.erb +23 -0
  69. data/app/views/moduler/administration/documents/edit.html.erb +1 -0
  70. data/app/views/moduler/administration/documents/index.html.erb +13 -0
  71. data/app/views/moduler/administration/documents/new.html.erb +1 -0
  72. data/app/views/moduler/administration/emails/_email.html.erb +33 -0
  73. data/app/views/moduler/administration/emails/_form.html.erb +23 -0
  74. data/app/views/moduler/administration/emails/deliveries/new.html.erb +58 -0
  75. data/app/views/moduler/administration/emails/edit.html.erb +1 -0
  76. data/app/views/moduler/administration/emails/index.html.erb +13 -0
  77. data/app/views/moduler/administration/emails/new.html.erb +1 -0
  78. data/app/views/moduler/administration/memberships/_form.html.erb +38 -0
  79. data/app/views/moduler/administration/memberships/_membership.html.erb +23 -0
  80. data/app/views/moduler/administration/memberships/edit.html.erb +1 -0
  81. data/app/views/moduler/administration/memberships/index.html.erb +14 -0
  82. data/app/views/moduler/administration/memberships/new.html.erb +1 -0
  83. data/app/views/moduler/administration/organizations/_form.html.erb +13 -0
  84. data/app/views/moduler/administration/organizations/_organization.html.erb +23 -0
  85. data/app/views/moduler/administration/organizations/edit.html.erb +1 -0
  86. data/app/views/moduler/administration/organizations/index.html.erb +13 -0
  87. data/app/views/moduler/administration/organizations/new.html.erb +1 -0
  88. data/app/views/moduler/administration/preferences/_form.html.erb +16 -0
  89. data/app/views/moduler/administration/preferences/_preference.html.erb +24 -0
  90. data/app/views/moduler/administration/preferences/edit.html.erb +1 -0
  91. data/app/views/moduler/administration/preferences/index.html.erb +13 -0
  92. data/app/views/moduler/administration/preferences/new.html.erb +1 -0
  93. data/app/views/moduler/administration/roles/_form.html.erb +24 -0
  94. data/app/views/moduler/administration/roles/_role.html.erb +15 -0
  95. data/app/views/moduler/administration/roles/edit.html.erb +1 -0
  96. data/app/views/moduler/administration/roles/index.html.erb +14 -0
  97. data/app/views/moduler/administration/roles/new.html.erb +1 -0
  98. data/app/views/moduler/administration/users/_user.html.erb +4 -0
  99. data/app/views/moduler/administration/users/edit.html.erb +2 -0
  100. data/app/views/moduler/administration/users/new.html.erb +2 -0
  101. data/app/views/moduler/common/_header.html.erb +2 -7
  102. data/app/views/moduler/common/administration/_sidebar.html.erb +10 -0
  103. data/app/views/moduler/common/profile/_sidebar.html.erb +1 -0
  104. data/app/views/moduler/document_acceptances/new.html.erb +36 -0
  105. data/app/views/moduler/email_mailer/custom.html.erb +3 -0
  106. data/app/views/moduler/email_mailer/custom.text.erb +1 -0
  107. data/app/views/moduler/profile/edit.html.erb +1 -0
  108. data/app/views/moduler/profile/sent_emails/index.html.erb +26 -0
  109. data/config/locales/moduler/administration/articles/en.yml +5 -0
  110. data/config/locales/moduler/administration/documents/en.yml +35 -0
  111. data/config/locales/moduler/administration/emails/en.yml +75 -0
  112. data/config/locales/moduler/administration/memberships/en.yml +35 -0
  113. data/config/locales/moduler/administration/organizations/en.yml +26 -0
  114. data/config/locales/moduler/administration/preferences/en.yml +44 -0
  115. data/config/locales/moduler/administration/roles/en.yml +32 -0
  116. data/config/locales/moduler/administration/users/en.yml +12 -1
  117. data/config/locales/moduler/common/en.yml +7 -1
  118. data/config/locales/moduler/components/en.yml +5 -0
  119. data/config/locales/moduler/document_acceptances/en.yml +17 -0
  120. data/config/locales/moduler/models/en.yml +8 -0
  121. data/config/locales/moduler/profile/en.yml +2 -0
  122. data/config/locales/moduler/profile/sent_emails/en.yml +11 -0
  123. data/config/locales/moduler/sessions/en.yml +1 -0
  124. data/config/routes.rb +13 -0
  125. data/db/migrate/20261104120000_add_status_to_moduler_users.rb +6 -0
  126. data/db/migrate/20261104205837_create_moduler_documents.rb +10 -0
  127. data/db/migrate/20261104205950_create_moduler_user_documents.rb +12 -0
  128. data/db/migrate/20261111113522_create_moduler_organizations.rb +11 -0
  129. data/db/migrate/20261111150000_create_moduler_roles.rb +13 -0
  130. data/db/migrate/20261111160000_create_moduler_memberships.rb +13 -0
  131. data/db/migrate/20261111180000_add_name_to_moduler_users.rb +5 -0
  132. data/db/migrate/20261111190000_add_status_to_moduler_articles.rb +8 -0
  133. data/db/migrate/20261111200000_create_moduler_preferences.rb +13 -0
  134. data/db/migrate/20261111210000_create_moduler_emails.rb +15 -0
  135. data/db/migrate/20261111210001_create_moduler_user_emails.rb +13 -0
  136. data/db/migrate/20261111210002_create_moduler_sent_emails.rb +12 -0
  137. data/lib/moduler/configuration.rb +6 -0
  138. data/lib/moduler/version.rb +1 -1
  139. metadata +100 -2
@@ -0,0 +1,26 @@
1
+ <main class="mx-auto flex w-full flex-1 max-w-[120rem] flex-col gap-4 px-4 md:flex-row md:gap-8 md:pl-0 md:pr-6">
2
+ <%= render "moduler/common/profile/sidebar" %>
3
+
4
+ <div class="flex min-w-0 flex-1 flex-col pb-4 md:mt-8">
5
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"), description: t(".description"))) %>
6
+
7
+ <%= render(Moduler::ListComponent.new(@sent_emails, id: "sent_emails", empty: t(".empty"))) do %>
8
+ <% @sent_emails.each do |sent_email| %>
9
+ <%= render(Moduler::ListItemComponent.new(sent_email.subject, id: dom_id(sent_email))) do |item| %>
10
+ <% item.with_meta do %>
11
+ <%= time_tag sent_email.created_at, l(sent_email.created_at, format: :long) %>
12
+ <% sent_email.attachments.each do |attachment| %>
13
+ <span aria-hidden="true">&middot;</span>
14
+ <%= link_to attachment.filename, main_app.rails_blob_path(attachment, disposition: "attachment"), title: t(".action.download", filename: attachment.filename), class: "text-slate-500 underline hover:text-slate-900" %>
15
+ <% end %>
16
+ <% end %>
17
+
18
+ <% item.with_action do %>
19
+ <%= link_to t(".action.show"), moduler.profile_sent_email_path(sent_email), target: "_blank", rel: "noopener",
20
+ class: "shrink-0 rounded-md bg-white px-2.5 py-1 text-sm font-medium text-slate-600 shadow-sm ring-1 ring-inset ring-slate-300 hover:bg-slate-50 hover:text-slate-900" %>
21
+ <% end %>
22
+ <% end %>
23
+ <% end %>
24
+ <% end %>
25
+ </div>
26
+ </main>
@@ -2,6 +2,9 @@ en:
2
2
  moduler:
3
3
  administration:
4
4
  articles:
5
+ statuses:
6
+ unpublished: Unpublished
7
+ published: Published
5
8
  index:
6
9
  title: Articles
7
10
  description: Posts published on your own public site
@@ -25,11 +28,13 @@ en:
25
28
  title: Article
26
29
  label:
27
30
  title: Title
31
+ status: Status
28
32
  path: Path
29
33
  description: Description
30
34
  keywords: Keywords
31
35
  content: Content
32
36
  description:
37
+ status: Only published articles are shown on the public site.
33
38
  path: The article's URL -- letters, numbers, and hyphens only.
34
39
  description: Shown in search results and social previews.
35
40
  keywords: Comma-separated, for search results and social previews.
@@ -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
@@ -0,0 +1,75 @@
1
+ en:
2
+ moduler:
3
+ administration:
4
+ emails:
5
+ kinds:
6
+ custom: Custom
7
+ system: System
8
+ newsletter: Newsletter
9
+ index:
10
+ title: Emails
11
+ description: Emails composed here and sent to chosen users, or from code by their event.
12
+ empty: No emails found
13
+ action:
14
+ new: Compose
15
+ email:
16
+ sent:
17
+ zero: Not sent yet
18
+ one: Sent to 1 user
19
+ other: Sent to %{count} users
20
+ updated: Updated %{time} ago
21
+ action:
22
+ deliver: Send
23
+ edit: Edit
24
+ destroy: Delete
25
+ confirmation:
26
+ destroy: Delete "%{subject}"? Copies already sent stay in the recipients' profiles.
27
+ create:
28
+ notice: Email has been created
29
+ update:
30
+ notice: Email has been updated
31
+ destroy:
32
+ notice: Email has been deleted
33
+ form:
34
+ title: Email
35
+ label:
36
+ subject: Subject
37
+ sender: Sender
38
+ kind: Kind
39
+ event: Event
40
+ body: Body
41
+ attachments: Attachments
42
+ placeholder:
43
+ sender: Support <support@example.com>
44
+ event: order.paid
45
+ description:
46
+ sender: Optional. Overrides the default From address. An address or "Name <address>".
47
+ event: 'Optional. Lets code send the email with Moduler::Email.deliver_event("order.paid", to: user). Lowercase letters, digits and underscores, separated by dots. Each event can have one email. The application sends user.signup after a user signs up.'
48
+ body: Markdown.
49
+ action:
50
+ save: Save
51
+ deliveries:
52
+ new:
53
+ title: Send "%{subject}"
54
+ description: Choose who receives the email. Users it has already been sent or queued for cannot be chosen again.
55
+ empty: No users found
56
+ placeholder:
57
+ role: Any role
58
+ sent: Sent or not
59
+ sent:
60
+ "true": Sent
61
+ "false": Not sent
62
+ per_page:
63
+ other: "%{count} per page"
64
+ status:
65
+ sent: Sent %{time}
66
+ queued: Queued
67
+ not_sent: Not sent
68
+ action:
69
+ select_all: Select all on this page
70
+ submit: Send to selected
71
+ create:
72
+ notice:
73
+ zero: The email has not been queued for anyone
74
+ one: The email has been queued for 1 user
75
+ other: The email has been queued for %{count} users
@@ -0,0 +1,35 @@
1
+ en:
2
+ moduler:
3
+ administration:
4
+ memberships:
5
+ index:
6
+ title: Members
7
+ description: Users who belong to organizations and the role they have in each of them
8
+ empty: No members found
9
+ action:
10
+ new: Add
11
+ membership:
12
+ created: Added %{time} ago
13
+ action:
14
+ edit: Edit
15
+ destroy: Remove
16
+ confirmation:
17
+ destroy: Remove %{email_address} from %{organization}?
18
+ create:
19
+ notice: Member has been added
20
+ update:
21
+ notice: Member has been updated
22
+ destroy:
23
+ notice: Member has been removed
24
+ form:
25
+ title: Member
26
+ label:
27
+ organization: Organization
28
+ user: User
29
+ role: Role
30
+ description:
31
+ user: Only users with the member role can belong to organizations.
32
+ role: Roles of the selected organization.
33
+ locked: The organization and user cannot be changed.
34
+ action:
35
+ save: Save
@@ -0,0 +1,26 @@
1
+ en:
2
+ moduler:
3
+ administration:
4
+ organizations:
5
+ index:
6
+ title: Organizations
7
+ description: Organizations registered in the application
8
+ empty: No organizations found
9
+ action:
10
+ new: Create
11
+ organization:
12
+ created: Created %{time} ago
13
+ action:
14
+ memberships: Members
15
+ roles: Roles
16
+ edit: Edit
17
+ create:
18
+ notice: Organization has been created
19
+ update:
20
+ notice: Organization has been updated
21
+ form:
22
+ title: Organization
23
+ label:
24
+ name: Name
25
+ action:
26
+ save: Save
@@ -0,0 +1,44 @@
1
+ en:
2
+ moduler:
3
+ administration:
4
+ preferences:
5
+ kinds:
6
+ string: String
7
+ boolean: Boolean
8
+ integer: Integer
9
+ index:
10
+ title: Preferences
11
+ description: Settings and feature toggles read in code as Moduler::Preference::NAME, changeable without a deploy.
12
+ empty: No preferences found
13
+ placeholder:
14
+ query: Search by name or kind...
15
+ action:
16
+ new: Create
17
+ preference:
18
+ updated: Updated %{time} ago
19
+ action:
20
+ edit: Edit
21
+ destroy: Delete
22
+ confirmation:
23
+ destroy: Delete %{name}? Code reading Moduler::Preference::%{name} will get nil.
24
+ create:
25
+ notice: Preference has been created
26
+ update:
27
+ notice: Preference has been updated
28
+ destroy:
29
+ notice: Preference has been deleted
30
+ form:
31
+ title: Preference
32
+ label:
33
+ name: Name
34
+ kind: Kind
35
+ value: Value
36
+ placeholder:
37
+ name: WAITLIST
38
+ value: "true"
39
+ description:
40
+ name: Read in code as Moduler::Preference::NAME. Uppercase letters, digits and underscores, starting with a letter.
41
+ kind: How the value is cast. Boolean is true or false, integer is a whole number, string is used as is.
42
+ value: A boolean must be "true" or "false" (case and surrounding spaces are ignored). An integer must be a whole number.
43
+ action:
44
+ save: Save
@@ -0,0 +1,32 @@
1
+ en:
2
+ moduler:
3
+ administration:
4
+ roles:
5
+ index:
6
+ title: Roles
7
+ description: Roles members of organizations can have and the permissions they grant
8
+ empty: No roles found
9
+ action:
10
+ new: Create
11
+ role:
12
+ permissions:
13
+ zero: No permissions
14
+ one: 1 permission
15
+ other: "%{count} permissions"
16
+ created: Created %{time} ago
17
+ action:
18
+ edit: Edit
19
+ create:
20
+ notice: Role has been created
21
+ update:
22
+ notice: Role has been updated
23
+ form:
24
+ title: Role
25
+ label:
26
+ organization: Organization
27
+ name: Name
28
+ permissions: Permissions
29
+ description:
30
+ organization_locked: The organization cannot be changed.
31
+ action:
32
+ save: Save
@@ -5,9 +5,13 @@ 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
- description: Manage user accounts and their roles. Search users by email address.
14
+ description: Manage user accounts and their roles. Search users by email address or name.
11
15
  empty: No users found.
12
16
  action:
13
17
  new: Create
@@ -15,9 +19,12 @@ en:
15
19
  title: New user
16
20
  label:
17
21
  email_address: Email address
22
+ name: Name
18
23
  role: Role
24
+ status: Status
19
25
  password: Password
20
26
  description:
27
+ name: Optional. Shown instead of the email address.
21
28
  password: Use at least 8 characters.
22
29
  section:
23
30
  data: User data
@@ -30,7 +37,11 @@ en:
30
37
  title: Edit user
31
38
  label:
32
39
  email_address: Email address
40
+ name: Name
33
41
  role: Role
42
+ status: Status
43
+ description:
44
+ name: Optional. Shown instead of the email address.
34
45
  section:
35
46
  data: User data
36
47
  action:
@@ -7,14 +7,20 @@ en:
7
7
  users: Users
8
8
  sessions: Sessions
9
9
  articles: Articles
10
+ documents: Documents
11
+ emails: Emails
12
+ preferences: Preferences
13
+ organizations: Organizations
14
+ roles: Roles
15
+ memberships: Members
10
16
  profile:
11
17
  sidebar:
12
18
  action:
13
19
  profile: Profile
14
20
  sessions: Sessions
21
+ sent_emails: Emails
15
22
  header:
16
23
  nav:
17
- administration: Administration
18
24
  home: Home
19
25
  action:
20
26
  sign_out: Sign out
@@ -4,12 +4,17 @@ en:
4
4
  filter:
5
5
  placeholder:
6
6
  query: Search...
7
+ organization: All organizations
7
8
  action:
8
9
  filter: Filter
9
10
  clear: Clear
10
11
  list:
11
12
  empty: No results found.
12
13
  form:
14
+ attachments:
15
+ action:
16
+ add: Add attachment
17
+ remove: Remove
13
18
  wysiwyg:
14
19
  action:
15
20
  bold: B
@@ -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.
@@ -0,0 +1,8 @@
1
+ en:
2
+ activerecord:
3
+ errors:
4
+ models:
5
+ moduler/membership:
6
+ attributes:
7
+ user:
8
+ not_member: must have the member role
@@ -5,10 +5,12 @@ en:
5
5
  title: Profile
6
6
  label:
7
7
  email_address: Email address
8
+ name: Name
8
9
  password: New password
9
10
  password_confirmation: Confirm new password
10
11
  password_challenge: Current password
11
12
  description:
13
+ name: Optional. Shown instead of your email address.
12
14
  password_confirmation: Leave blank to keep your current password. Changing it signs out your other active sessions.
13
15
  password_challenge: Required to save changes to password.
14
16
  action:
@@ -0,0 +1,11 @@
1
+ en:
2
+ moduler:
3
+ profile:
4
+ sent_emails:
5
+ index:
6
+ title: Emails
7
+ description: Emails sent to your address.
8
+ empty: No emails have been sent to you yet.
9
+ action:
10
+ show: View
11
+ download: Download %{filename}
@@ -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
@@ -4,12 +4,15 @@ Moduler::Engine.routes.draw do
4
4
  resource :session, only: %i[new create destroy]
5
5
  resource :user, only: %i[new create]
6
6
 
7
+ resource :document_acceptance, only: %i[ new create ]
8
+
7
9
  resource :profile, only: %i[ edit update ], controller: :profile
8
10
  namespace :profile do
9
11
  namespace :sessions do
10
12
  resource :revocation, only: :destroy, controller: :revocation
11
13
  end
12
14
  resources :sessions, only: %i[ index destroy ]
15
+ resources :sent_emails, only: %i[ index show ]
13
16
  end
14
17
 
15
18
  namespace :administration do
@@ -17,6 +20,16 @@ Moduler::Engine.routes.draw do
17
20
  resources :sessions, only: %i[ index destroy ]
18
21
 
19
22
  resources :articles
23
+ resources :documents, only: %i[ index new create edit update ]
24
+ resources :preferences, only: %i[ index new create edit update destroy ]
25
+ resources :emails, only: %i[ index new create edit update destroy ] do
26
+ scope module: :emails do
27
+ resources :deliveries, only: %i[ new create ]
28
+ end
29
+ end
30
+ resources :organizations, only: %i[ index new create edit update ]
31
+ resources :roles, only: %i[ index new create edit update ]
32
+ resources :memberships, only: %i[ index new create edit update destroy ]
20
33
 
21
34
  root "home#index"
22
35
  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
@@ -0,0 +1,11 @@
1
+ class CreateModulerOrganizations < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_organizations, id: :uuid do |t|
4
+ t.string :name, null: false
5
+
6
+ t.timestamps null: false
7
+ end
8
+
9
+ add_index :moduler_organizations, :name, unique: true
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class CreateModulerRoles < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_roles, id: :uuid do |t|
4
+ t.references :moduler_organization, type: :uuid, null: false, foreign_key: true, index: false
5
+ t.string :name, null: false
6
+ t.string :permissions, array: true, null: false, default: []
7
+
8
+ t.timestamps null: false
9
+ end
10
+
11
+ add_index :moduler_roles, %i[ moduler_organization_id name ], unique: true
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class CreateModulerMemberships < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_memberships, id: :uuid do |t|
4
+ t.references :moduler_user, type: :uuid, null: false, foreign_key: true
5
+ t.references :moduler_organization, type: :uuid, null: false, foreign_key: true, index: false
6
+ t.references :moduler_role, type: :uuid, null: false, foreign_key: true
7
+
8
+ t.timestamps null: false
9
+ end
10
+
11
+ add_index :moduler_memberships, %i[ moduler_organization_id moduler_user_id ], unique: true
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class AddNameToModulerUsers < ActiveRecord::Migration[8.1]
2
+ def change
3
+ add_column :moduler_users, :name, :string
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class AddStatusToModulerArticles < ActiveRecord::Migration[8.1]
2
+ def change
3
+ # Existing articles stay published; new articles are unpublished by default.
4
+ add_column :moduler_articles, :status, :integer, default: 1, null: false
5
+ change_column_default :moduler_articles, :status, from: 1, to: 0
6
+ add_index :moduler_articles, :status
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ class CreateModulerPreferences < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_preferences, id: :uuid do |t|
4
+ t.string :kind, null: false
5
+ t.string :name, null: false
6
+ t.string :value, null: false
7
+
8
+ t.timestamps null: false
9
+ end
10
+
11
+ add_index :moduler_preferences, :name, unique: true
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ class CreateModulerEmails < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_emails do |t|
4
+ t.string :subject, null: false
5
+ t.string :sender
6
+ t.string :kind, null: false
7
+ t.string :event
8
+ t.text :body, null: false
9
+
10
+ t.timestamps null: false
11
+ end
12
+
13
+ add_index :moduler_emails, :event, unique: true, where: "event IS NOT NULL"
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ class CreateModulerUserEmails < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_user_emails do |t|
4
+ t.references :moduler_user, type: :uuid, null: false, foreign_key: true
5
+ t.references :moduler_email, null: false, foreign_key: true, index: false
6
+ t.datetime :sent_at
7
+
8
+ t.timestamps null: false
9
+ end
10
+
11
+ add_index :moduler_user_emails, %i[ moduler_email_id moduler_user_id ], unique: true
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ class CreateModulerSentEmails < ActiveRecord::Migration[8.1]
2
+ def change
3
+ create_table :moduler_sent_emails do |t|
4
+ t.references :moduler_user, type: :uuid, foreign_key: true
5
+ t.string :to_address, null: false
6
+ t.string :subject, null: false
7
+ t.text :body, null: false
8
+
9
+ t.timestamps null: false
10
+ end
11
+ end
12
+ end
@@ -8,5 +8,11 @@ module Moduler
8
8
  def initialize
9
9
  @configuration = Rails.application.config_for(:moduler)
10
10
  end
11
+
12
+ # Permissions that can be granted to organization roles, defined under
13
+ # `permissions` in config/moduler.yml.
14
+ def permissions
15
+ Array(dig(:permissions)).map(&:to_s)
16
+ end
11
17
  end
12
18
  end
@@ -1,3 +1,3 @@
1
1
  module Moduler
2
- VERSION = "0.4.0"
2
+ VERSION = "0.6.0"
3
3
  end