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,23 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"))) %>
3
+
4
+ <%= form_with model: @document, url: @document.persisted? ? moduler.administration_document_path(@document) : moduler.administration_documents_path, data: { turbo: false }, class: "w-full space-y-6" do |form| %>
5
+ <%= render(::Moduler::Form::BaseErrorComponent.new(form)) %>
6
+
7
+ <div class="max-w-lg space-y-6">
8
+ <%= render(::Moduler::Form::TextComponent.new(form, :name, label: t(".label.name"))) %>
9
+ <%= render(::Moduler::Form::SelectComponent.new(form, :kind, Moduler::Document::KINDS.map { |kind| [ t("moduler.administration.documents.kinds.#{kind}"), kind ] }, label: t(".label.kind"))) %>
10
+ <% if @document.persisted? %>
11
+ <div class="mt-2">
12
+ <p class="block text-sm text-slate-500"><%= t(".label.file") %></p>
13
+ <p id="document_file" class="mt-2 text-sm text-gray-900"><%= @document.file.attached? ? @document.file.filename : t(".description.no_file") %></p>
14
+ <p class="mt-1 text-xs text-gray-400"><%= t(".description.file_locked") %></p>
15
+ </div>
16
+ <% else %>
17
+ <%= render(::Moduler::Form::FileComponent.new(form, :file, label: t(".label.file"), accept: "application/pdf", description: t(".description.file"))) %>
18
+ <% end %>
19
+ </div>
20
+
21
+ <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.save"))) %>
22
+ <% end %>
23
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,13 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"), description: t(".description"))) do |header| %>
3
+ <% header.with_action do %>
4
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.new"), moduler.new_administration_document_path)) %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <%= render(Moduler::FilterComponent.new(@filter, moduler.administration_documents_path)) %>
9
+
10
+ <%= render(Moduler::ListComponent.new(@documents, id: "documents", empty: t(".empty"))) do %>
11
+ <%= render partial: "moduler/administration/documents/document", collection: @documents %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,33 @@
1
+ <%= render(Moduler::ListItemComponent.new(email.subject, id: dom_id(email))) do |item| %>
2
+ <% item.with_badge(t("moduler.administration.emails.kinds.#{email.kind}")) %>
3
+ <% if email.event %>
4
+ <% item.with_badge(email.event, variant: :muted) %>
5
+ <% end %>
6
+
7
+ <% item.with_meta do %>
8
+ <%= t(".sent", count: email.sent_count) %>
9
+ <span aria-hidden="true">&middot;</span>
10
+ <%= time_tag email.updated_at, t(".updated", time: time_ago_in_words(email.updated_at)), title: l(email.updated_at, format: :long) %>
11
+ <% end %>
12
+
13
+ <% policy = Moduler::Administration::EmailPolicy.new(current_user, email) %>
14
+
15
+ <% if policy.deliver? %>
16
+ <% item.with_action do %>
17
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.deliver"), moduler.new_administration_email_delivery_path(email), size: :sm)) %>
18
+ <% end %>
19
+ <% end %>
20
+
21
+ <% if policy.edit? %>
22
+ <% item.with_action do %>
23
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.edit"), moduler.edit_administration_email_path(email), size: :sm)) %>
24
+ <% end %>
25
+ <% end %>
26
+
27
+ <% if policy.destroy? %>
28
+ <% item.with_action do %>
29
+ <%= render(Moduler::ButtonComponent.new(t(".action.destroy"), moduler.administration_email_path(email), method: :delete, size: :sm,
30
+ confirm: t(".confirmation.destroy", subject: email.subject))) %>
31
+ <% end %>
32
+ <% end %>
33
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"))) %>
3
+
4
+ <%= form_with model: @email, url: @email.persisted? ? moduler.administration_email_path(@email) : moduler.administration_emails_path, multipart: true, data: { turbo: false }, class: "w-full space-y-6" do |form| %>
5
+ <%= render(::Moduler::Form::BaseErrorComponent.new(form)) %>
6
+
7
+ <div class="max-w-lg space-y-6">
8
+ <%= render(::Moduler::Form::TextComponent.new(form, :subject, label: t(".label.subject"))) %>
9
+ <%= render(::Moduler::Form::TextComponent.new(form, :sender, label: t(".label.sender"), placeholder: t(".placeholder.sender"), description: t(".description.sender"))) %>
10
+ <%= render(::Moduler::Form::SelectComponent.new(form, :kind, Moduler::Email::KINDS.map { |kind| [ t("moduler.administration.emails.kinds.#{kind}"), kind ] },
11
+ label: t(".label.kind"), include_blank: true)) %>
12
+ <%= render(::Moduler::Form::TextComponent.new(form, :event, label: t(".label.event"), placeholder: t(".placeholder.event"), description: t(".description.event"))) %>
13
+ </div>
14
+
15
+ <%= render(::Moduler::Form::WysiwygComponent.new(form, :body, label: t(".label.body"), description: t(".description.body"))) %>
16
+
17
+ <div class="max-w-lg space-y-6">
18
+ <%= render(::Moduler::Form::AttachmentsComponent.new(form, :attachments, label: t(".label.attachments"))) %>
19
+ </div>
20
+
21
+ <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.save"))) %>
22
+ <% end %>
23
+ <% end %>
@@ -0,0 +1,58 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title", subject: @email.subject), description: t(".description"))) %>
3
+
4
+ <%= render(Moduler::FilterComponent.new(@filter, moduler.new_administration_email_delivery_path(@email), selects: [
5
+ { name: :role, choices: Moduler::User.roles.keys.map { |role| [ t("moduler.administration.users.roles.#{role}"), role ] }, prompt: t(".placeholder.role") },
6
+ { name: :sent, choices: [ [ t(".sent.true"), "true" ], [ t(".sent.false"), "false" ] ], prompt: t(".placeholder.sent") },
7
+ { name: :per_page, choices: EmailDeliveryFilter::PER_PAGE.map { |per_page| [ t(".per_page", count: per_page), per_page ] }, prompt: false }
8
+ ])) %>
9
+
10
+ <%= form_with url: moduler.administration_email_deliveries_path(@email), data: { turbo: false, controller: "select-all" } do |form| %>
11
+ <% if @users.any? %>
12
+ <div class="mt-6">
13
+ <label class="flex items-center gap-3 px-4 text-sm text-slate-500 sm:px-5">
14
+ <input type="checkbox" data-select-all-target="parent" data-action="change->select-all#toggleChildren" class="h-4 w-4 cursor-pointer rounded border-gray-300 accent-custom">
15
+ <%= t(".action.select_all") %>
16
+ </label>
17
+ </div>
18
+ <% end %>
19
+
20
+ <%= render(Moduler::ListComponent.new(@users, id: "users", empty: t(".empty"))) do %>
21
+ <% @users.each do |user| %>
22
+ <li id="<%= dom_id(user) %>" class="flex items-center gap-3 px-4 py-4 sm:px-5">
23
+ <% if user.user_email_id %>
24
+ <input type="checkbox" checked disabled aria-label="<%= user.email_address %>" class="h-4 w-4 shrink-0 rounded border-gray-300 accent-custom">
25
+ <% else %>
26
+ <input type="checkbox" name="user_ids[]" value="<%= user.id %>" id="user_ids_<%= user.id %>"
27
+ data-select-all-target="child" data-action="change->select-all#toggleParent"
28
+ class="h-4 w-4 shrink-0 cursor-pointer rounded border-gray-300 accent-custom">
29
+ <% end %>
30
+
31
+ <div class="min-w-0 flex-1">
32
+ <label for="user_ids_<%= user.id %>" class="flex flex-wrap items-center gap-2">
33
+ <span class="truncate text-sm font-semibold text-gray-900"><%= user.display_name %></span>
34
+ <%= render(Moduler::BadgeComponent.new(t("moduler.administration.users.roles.#{user.role}"))) %>
35
+ </label>
36
+ <p class="mt-1 text-xs text-slate-400">
37
+ <% if user.name.present? %>
38
+ <%= user.email_address %>
39
+ <span aria-hidden="true">&middot;</span>
40
+ <% end %>
41
+ <% if user.user_email_sent_at %>
42
+ <%= t(".status.sent", time: l(user.user_email_sent_at, format: :long)) %>
43
+ <% elsif user.user_email_id %>
44
+ <%= t(".status.queued") %>
45
+ <% else %>
46
+ <%= t(".status.not_sent") %>
47
+ <% end %>
48
+ </p>
49
+ </div>
50
+ </li>
51
+ <% end %>
52
+ <% end %>
53
+
54
+ <% if @users.any? %>
55
+ <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.submit"))) %>
56
+ <% end %>
57
+ <% end %>
58
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,13 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"), description: t(".description"))) do |header| %>
3
+ <% header.with_action do %>
4
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.new"), moduler.new_administration_email_path)) %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <%= render(Moduler::FilterComponent.new(@filter, moduler.administration_emails_path)) %>
9
+
10
+ <%= render(Moduler::ListComponent.new(@emails, id: "emails", empty: t(".empty"))) do %>
11
+ <%= render partial: "moduler/administration/emails/email", collection: @emails %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,38 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"))) %>
3
+
4
+ <%= form_with model: @membership, url: @membership.persisted? ? moduler.administration_membership_path(@membership) : moduler.administration_memberships_path, data: { turbo: false }, class: "w-full space-y-6" do |form| %>
5
+ <%= render(::Moduler::Form::BaseErrorComponent.new(form)) %>
6
+
7
+ <div class="max-w-lg space-y-6">
8
+ <% if @membership.persisted? %>
9
+ <div class="mt-2">
10
+ <p class="block text-sm text-slate-500"><%= t(".label.organization") %></p>
11
+ <p id="membership_organization" class="mt-2 text-sm text-gray-900"><%= @membership.organization.name %></p>
12
+ </div>
13
+ <div class="mt-2">
14
+ <p class="block text-sm text-slate-500"><%= t(".label.user") %></p>
15
+ <p id="membership_user" class="mt-2 text-sm text-gray-900"><%= @membership.user.email_address %></p>
16
+ <p class="mt-1 text-xs text-gray-400"><%= t(".description.locked") %></p>
17
+ </div>
18
+ <%= render(::Moduler::Form::SelectComponent.new(form, :moduler_role_id, @membership.organization.roles.order(:name).pluck(:name, :id),
19
+ label: t(".label.role"))) %>
20
+ <% else %>
21
+ <% organizations = Moduler::Organization.includes(:roles).order(:name) %>
22
+ <% roles = organizations.to_h { |organization| [ organization.id, organization.roles.sort_by(&:name).map { |role| [ role.name, role.id ] } ] } %>
23
+ <div class="space-y-6" data-controller="dependent-select" data-dependent-select-options-value="<%= roles.to_json %>">
24
+ <%= render(::Moduler::Form::SelectComponent.new(form, :moduler_organization_id, organizations.map { |organization| [ organization.name, organization.id ] },
25
+ label: t(".label.organization"), include_blank: true,
26
+ data: { dependent_select_target: "source", action: "dependent-select#update" })) %>
27
+ <%= render(::Moduler::Form::SelectComponent.new(form, :moduler_role_id, roles.fetch(@membership.moduler_organization_id, []),
28
+ label: t(".label.role"), include_blank: true, description: t(".description.role"),
29
+ data: { dependent_select_target: "dependent" })) %>
30
+ </div>
31
+ <%= render(::Moduler::Form::SelectComponent.new(form, :moduler_user_id, Moduler::User.member.order(:email_address).pluck(:email_address, :id),
32
+ label: t(".label.user"), include_blank: true, description: t(".description.user"))) %>
33
+ <% end %>
34
+ </div>
35
+
36
+ <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.save"))) %>
37
+ <% end %>
38
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%= render(Moduler::ListItemComponent.new(membership.user.email_address, id: dom_id(membership))) do |item| %>
2
+ <% item.with_badge(membership.organization.name) %>
3
+ <% item.with_badge(membership.role.name, variant: :muted) %>
4
+
5
+ <% item.with_meta do %>
6
+ <%= time_tag membership.created_at, t(".created", time: time_ago_in_words(membership.created_at)), title: l(membership.created_at, format: :long) %>
7
+ <% end %>
8
+
9
+ <% policy = Moduler::Administration::MembershipPolicy.new(current_user, membership) %>
10
+
11
+ <% if policy.edit? %>
12
+ <% item.with_action do %>
13
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.edit"), moduler.edit_administration_membership_path(membership), size: :sm)) %>
14
+ <% end %>
15
+ <% end %>
16
+
17
+ <% if policy.destroy? %>
18
+ <% item.with_action do %>
19
+ <%= render(Moduler::ButtonComponent.new(t(".action.destroy"), moduler.administration_membership_path(membership), method: :delete, size: :sm,
20
+ confirm: t(".confirmation.destroy", email_address: membership.user.email_address, organization: membership.organization.name))) %>
21
+ <% end %>
22
+ <% end %>
23
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,14 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"), description: t(".description"))) do |header| %>
3
+ <% header.with_action do %>
4
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.new"), moduler.new_administration_membership_path(organization_id: @filter.organization_id.presence))) %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <%= render(Moduler::FilterComponent.new(@filter, moduler.administration_memberships_path,
9
+ selects: [ { name: :organization_id, choices: Moduler::Organization.order(:name).pluck(:name, :id), prompt: t("moduler.components.filter.placeholder.organization") } ])) %>
10
+
11
+ <%= render(Moduler::ListComponent.new(@memberships, id: "memberships", empty: t(".empty"))) do %>
12
+ <%= render partial: "moduler/administration/memberships/membership", collection: @memberships %>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,13 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"))) %>
3
+
4
+ <%= form_with model: @organization, url: @organization.persisted? ? moduler.administration_organization_path(@organization) : moduler.administration_organizations_path, data: { turbo: false }, class: "w-full space-y-6" do |form| %>
5
+ <%= render(::Moduler::Form::BaseErrorComponent.new(form)) %>
6
+
7
+ <div class="max-w-lg space-y-6">
8
+ <%= render(::Moduler::Form::TextComponent.new(form, :name, label: t(".label.name"))) %>
9
+ </div>
10
+
11
+ <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.save"))) %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%= render(Moduler::ListItemComponent.new(organization.name, id: dom_id(organization))) do |item| %>
2
+ <% item.with_meta do %>
3
+ <%= time_tag organization.created_at, t(".created", time: time_ago_in_words(organization.created_at)), title: l(organization.created_at, format: :long) %>
4
+ <% end %>
5
+
6
+ <% if Moduler::Administration::MembershipPolicy.new(current_user, Moduler::Membership).index? %>
7
+ <% item.with_action do %>
8
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.memberships"), moduler.administration_memberships_path(filter: { organization_id: organization.id }), size: :sm)) %>
9
+ <% end %>
10
+ <% end %>
11
+
12
+ <% if Moduler::Administration::RolePolicy.new(current_user, Moduler::Role).index? %>
13
+ <% item.with_action do %>
14
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.roles"), moduler.administration_roles_path(filter: { organization_id: organization.id }), size: :sm)) %>
15
+ <% end %>
16
+ <% end %>
17
+
18
+ <% if Moduler::Administration::OrganizationPolicy.new(current_user, organization).edit? %>
19
+ <% item.with_action do %>
20
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.edit"), moduler.edit_administration_organization_path(organization), size: :sm)) %>
21
+ <% end %>
22
+ <% end %>
23
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,13 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"), description: t(".description"))) do |header| %>
3
+ <% header.with_action do %>
4
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.new"), moduler.new_administration_organization_path)) %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <%= render(Moduler::FilterComponent.new(@filter, moduler.administration_organizations_path)) %>
9
+
10
+ <%= render(Moduler::ListComponent.new(@organizations, id: "organizations", empty: t(".empty"))) do %>
11
+ <%= render partial: "moduler/administration/organizations/organization", collection: @organizations %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,16 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"))) %>
3
+
4
+ <%= form_with model: @preference, url: @preference.persisted? ? moduler.administration_preference_path(@preference) : moduler.administration_preferences_path, data: { turbo: false }, class: "w-full space-y-6" do |form| %>
5
+ <%= render(::Moduler::Form::BaseErrorComponent.new(form)) %>
6
+
7
+ <div class="max-w-lg space-y-6">
8
+ <%= render(::Moduler::Form::TextComponent.new(form, :name, label: t(".label.name"), placeholder: t(".placeholder.name"), description: t(".description.name"))) %>
9
+ <%= render(::Moduler::Form::SelectComponent.new(form, :kind, Moduler::Preference::KINDS.map { |kind| [ t("moduler.administration.preferences.kinds.#{kind}"), kind ] },
10
+ label: t(".label.kind"), include_blank: true, description: t(".description.kind"))) %>
11
+ <%= render(::Moduler::Form::TextComponent.new(form, :value, label: t(".label.value"), placeholder: t(".placeholder.value"), description: t(".description.value"))) %>
12
+ </div>
13
+
14
+ <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.save"))) %>
15
+ <% end %>
16
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <%= render(Moduler::ListItemComponent.new(preference.name, id: dom_id(preference))) do |item| %>
2
+ <% item.with_badge(t("moduler.administration.preferences.kinds.#{preference.kind}")) %>
3
+
4
+ <% item.with_meta do %>
5
+ <span class="font-mono"><%= preference.value %></span>
6
+ <span aria-hidden="true">&middot;</span>
7
+ <%= time_tag preference.updated_at, t(".updated", time: time_ago_in_words(preference.updated_at)), title: l(preference.updated_at, format: :long) %>
8
+ <% end %>
9
+
10
+ <% policy = Moduler::Administration::PreferencePolicy.new(current_user, preference) %>
11
+
12
+ <% if policy.edit? %>
13
+ <% item.with_action do %>
14
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.edit"), moduler.edit_administration_preference_path(preference), size: :sm)) %>
15
+ <% end %>
16
+ <% end %>
17
+
18
+ <% if policy.destroy? %>
19
+ <% item.with_action do %>
20
+ <%= render(Moduler::ButtonComponent.new(t(".action.destroy"), moduler.administration_preference_path(preference), method: :delete, size: :sm,
21
+ confirm: t(".confirmation.destroy", name: preference.name))) %>
22
+ <% end %>
23
+ <% end %>
24
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,13 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"), description: t(".description"))) do |header| %>
3
+ <% header.with_action do %>
4
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.new"), moduler.new_administration_preference_path)) %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <%= render(Moduler::FilterComponent.new(@filter, moduler.administration_preferences_path, placeholder: t(".placeholder.query"))) %>
9
+
10
+ <%= render(Moduler::ListComponent.new(@preferences, id: "preferences", empty: t(".empty"))) do %>
11
+ <%= render partial: "moduler/administration/preferences/preference", collection: @preferences %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,24 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"))) %>
3
+
4
+ <%= form_with model: @role, url: @role.persisted? ? moduler.administration_role_path(@role) : moduler.administration_roles_path, data: { turbo: false }, class: "w-full space-y-6" do |form| %>
5
+ <%= render(::Moduler::Form::BaseErrorComponent.new(form)) %>
6
+
7
+ <div class="max-w-lg space-y-6">
8
+ <% if @role.persisted? %>
9
+ <div class="mt-2">
10
+ <p class="block text-sm text-slate-500"><%= t(".label.organization") %></p>
11
+ <p id="role_organization" class="mt-2 text-sm text-gray-900"><%= @role.organization.name %></p>
12
+ <p class="mt-1 text-xs text-gray-400"><%= t(".description.organization_locked") %></p>
13
+ </div>
14
+ <% else %>
15
+ <%= render(::Moduler::Form::SelectComponent.new(form, :moduler_organization_id, Moduler::Organization.order(:name).pluck(:name, :id),
16
+ label: t(".label.organization"), include_blank: true)) %>
17
+ <% end %>
18
+ <%= render(::Moduler::Form::TextComponent.new(form, :name, label: t(".label.name"))) %>
19
+ <%= render(::Moduler::Form::CheckboxesComponent.new(form, :permissions, Moduler.configuration.permissions.map { |permission| [ t("moduler.permissions.#{permission}", default: permission), permission ] }, label: t(".label.permissions"))) %>
20
+ </div>
21
+
22
+ <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.save"))) %>
23
+ <% end %>
24
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <%= render(Moduler::ListItemComponent.new(role.name, id: dom_id(role))) do |item| %>
2
+ <% item.with_badge(role.organization.name) %>
3
+
4
+ <% item.with_meta do %>
5
+ <%= t(".permissions", count: role.permissions.size) %>
6
+ <span aria-hidden="true">&middot;</span>
7
+ <%= time_tag role.created_at, t(".created", time: time_ago_in_words(role.created_at)), title: l(role.created_at, format: :long) %>
8
+ <% end %>
9
+
10
+ <% if Moduler::Administration::RolePolicy.new(current_user, role).edit? %>
11
+ <% item.with_action do %>
12
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.edit"), moduler.edit_administration_role_path(role), size: :sm)) %>
13
+ <% end %>
14
+ <% end %>
15
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -0,0 +1,14 @@
1
+ <%= render(Moduler::Administration::PageComponent.new) do %>
2
+ <%= render(Moduler::PageHeaderComponent.new(t(".title"), description: t(".description"))) do |header| %>
3
+ <% header.with_action do %>
4
+ <%= render(Moduler::ButtonLinkComponent.new(t(".action.new"), moduler.new_administration_role_path(organization_id: @filter.organization_id.presence))) %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <%= render(Moduler::FilterComponent.new(@filter, moduler.administration_roles_path,
9
+ selects: [ { name: :organization_id, choices: Moduler::Organization.order(:name).pluck(:name, :id), prompt: t("moduler.components.filter.placeholder.organization") } ])) %>
10
+
11
+ <%= render(Moduler::ListComponent.new(@roles, id: "roles", empty: t(".empty"))) do %>
12
+ <%= render partial: "moduler/administration/roles/role", collection: @roles %>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form" %>
@@ -2,6 +2,10 @@
2
2
  <% item.with_badge(t("moduler.administration.users.roles.#{user.role}"), variant: user.administrator? ? :success : :neutral) %>
3
3
 
4
4
  <% item.with_meta do %>
5
+ <% if user.name.present? %>
6
+ <%= user.name %>
7
+ <span aria-hidden="true">&middot;</span>
8
+ <% end %>
5
9
  <%= time_tag user.created_at, t(".created", time: time_ago_in_words(user.created_at)), title: l(user.created_at, format: :long) %>
6
10
  <% end %>
7
11
 
@@ -6,7 +6,9 @@
6
6
 
7
7
  <%= render(::Moduler::Form::SectionComponent.new(t(".section.data"))) do %>
8
8
  <%= render(::Moduler::Form::EmailComponent.new(form, :email_address, label: t(".label.email_address"))) %>
9
+ <%= render(::Moduler::Form::TextComponent.new(form, :name, label: t(".label.name"), description: t(".description.name"))) %>
9
10
  <%= render(::Moduler::Form::SelectComponent.new(form, :role, Moduler::User.roles.keys.map { |role| [ t("moduler.administration.users.roles.#{role}"), role ] }, label: t(".label.role"))) %>
11
+ <%= render(::Moduler::Form::SelectComponent.new(form, :status, Moduler::User.statuses.keys.map { |status| [ t("moduler.administration.users.statuses.#{status}"), status ] }, label: t(".label.status"))) %>
10
12
  <% end %>
11
13
 
12
14
  <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.save"))) %>
@@ -6,7 +6,9 @@
6
6
 
7
7
  <%= render(::Moduler::Form::SectionComponent.new(t(".section.data"))) do %>
8
8
  <%= render(::Moduler::Form::EmailComponent.new(form, :email_address, label: t(".label.email_address"))) %>
9
+ <%= render(::Moduler::Form::TextComponent.new(form, :name, label: t(".label.name"), description: t(".description.name"))) %>
9
10
  <%= render(::Moduler::Form::SelectComponent.new(form, :role, Moduler::User.roles.keys.map { |role| [ t("moduler.administration.users.roles.#{role}"), role ] }, label: t(".label.role"))) %>
11
+ <%= render(::Moduler::Form::SelectComponent.new(form, :status, Moduler::User.statuses.keys.map { |status| [ t("moduler.administration.users.statuses.#{status}"), status ] }, label: t(".label.status"))) %>
10
12
  <% end %>
11
13
 
12
14
  <%= render(::Moduler::Form::SectionComponent.new(t(".section.password"), divider: true)) do %>
@@ -1,16 +1,11 @@
1
1
  <nav class="border-b border-gray-200 bg-white">
2
2
  <div class="flex h-16 w-full items-center justify-between gap-4 px-4 sm:px-6 lg:px-6">
3
3
  <div class="flex shrink-0 items-center gap-4 sm:gap-8">
4
- <%= link_to t(".nav.home"), moduler.root_path, class: "text-sm/6 font-semibold text-gray-900 hover:text-custom" %>
5
-
6
- <% if policy([:moduler, :administration, :home]).index? %>
7
- |
8
- <%= link_to t(".nav.administration"), moduler.administration_root_path, class: "text-sm/6 font-semibold text-gray-900 hover:text-custom" %>
9
- <% end %>
4
+ <%= link_to t(".nav.home"), current_home_path, class: "text-sm/6 font-semibold text-gray-900 hover:text-custom" %>
10
5
  </div>
11
6
 
12
7
  <div class="flex min-w-0 items-center gap-3 text-sm text-gray-900 sm:gap-6">
13
- <%= link_to current_user.email_address, moduler.edit_profile_path, class: "truncate" %>
8
+ <%= link_to current_user.display_name, moduler.edit_profile_path, class: "truncate" %>
14
9
  |
15
10
  <%= button_to t(".action.sign_out"), moduler.session_path, method: :delete, class: "cursor-pointer whitespace-nowrap font-semibold" %>
16
11
  </div>
@@ -2,8 +2,18 @@
2
2
  <nav class="flex gap-1 overflow-x-auto md:flex-col text-sm p-2">
3
3
  <%= render(Moduler::SidebarActionComponent.new(t(".action.users"), moduler.administration_users_path, "moduler/administration/users")) %>
4
4
  <%= render(Moduler::SidebarActionComponent.new(t(".action.sessions"), moduler.administration_sessions_path, "moduler/administration/sessions")) %>
5
+ <%= render(Moduler::SidebarActionComponent.new(t(".action.organizations"), moduler.administration_organizations_path, "moduler/administration/organizations")) %>
6
+ <%= render(Moduler::SidebarActionComponent.new(t(".action.roles"), moduler.administration_roles_path, "moduler/administration/roles")) %>
7
+ <%= render(Moduler::SidebarActionComponent.new(t(".action.memberships"), moduler.administration_memberships_path, "moduler/administration/memberships")) %>
8
+
9
+ <div role="separator" class="mx-1 w-px shrink-0 self-stretch bg-gray-200 md:mx-0 md:my-2 md:h-px md:w-auto"></div>
5
10
 
6
11
  <%= render(Moduler::SidebarActionComponent.new(t(".action.articles"), moduler.administration_articles_path, "moduler/administration/articles")) %>
12
+ <%= render(Moduler::SidebarActionComponent.new(t(".action.documents"), moduler.administration_documents_path, "moduler/administration/documents")) %>
13
+ <%= render(Moduler::SidebarActionComponent.new(t(".action.emails"), moduler.administration_emails_path, "moduler/administration/emails")) %>
14
+ <%= render(Moduler::SidebarActionComponent.new(t(".action.preferences"), moduler.administration_preferences_path, "moduler/administration/preferences")) %>
15
+
16
+ <div role="separator" class="mx-1 w-px shrink-0 self-stretch bg-gray-200 md:mx-0 md:my-2 md:h-px md:w-auto"></div>
7
17
 
8
18
  <% Array(Moduler.configuration.dig(:administration, :resources)).each do |resource| %>
9
19
  <%= render(Moduler::SidebarActionComponent.new(t(".action.#{resource}"), moduler.url_for([:administration, resource.to_sym]), "moduler/administration/#{resource}")) %>
@@ -2,5 +2,6 @@
2
2
  <nav class="flex gap-1 overflow-x-auto md:flex-col text-sm p-2">
3
3
  <%= render(Moduler::SidebarActionComponent.new(t(".action.profile"), moduler.edit_profile_path, "moduler/profile")) %>
4
4
  <%= render(Moduler::SidebarActionComponent.new(t(".action.sessions"), moduler.profile_sessions_path, "moduler/profile/sessions")) %>
5
+ <%= render(Moduler::SidebarActionComponent.new(t(".action.sent_emails"), moduler.profile_sent_emails_path, "moduler/profile/sent_emails")) %>
5
6
  </nav>
6
7
  </aside>
@@ -0,0 +1,36 @@
1
+ <main class="mx-auto flex w-full max-w-2xl flex-1 flex-col px-4 py-8">
2
+ <div class="mb-6">
3
+ <h1 class="text-base font-semibold text-gray-900"><%= t(".title") %></h1>
4
+ <p class="mt-1 text-sm text-slate-500"><%= t(".description") %></p>
5
+ </div>
6
+
7
+ <%= form_with url: moduler.document_acceptance_path, scope: :document_acceptance, data: { turbo: false }, class: "space-y-6" do |form| %>
8
+ <ul id="documents" class="divide-y divide-gray-200 rounded-md border border-gray-200 bg-white">
9
+ <% @document_acceptance.pending_documents.each do |document| %>
10
+ <li id="<%= dom_id(document) %>" class="flex items-start gap-3 px-4 py-4 sm:px-5">
11
+ <%= check_box_tag "document_acceptance[document_ids][]", document.id, @document_acceptance.accepted?(document),
12
+ id: "document_acceptance_document_#{document.id}", class: "mt-0.5 h-4 w-4 shrink-0 cursor-pointer rounded border-gray-300 accent-custom" %>
13
+
14
+ <div class="min-w-0 flex-1">
15
+ <label for="document_acceptance_document_<%= document.id %>" class="cursor-pointer text-sm text-gray-900">
16
+ <%= t(".accept", name: document.name) %>
17
+ </label>
18
+ <p class="mt-1 text-xs text-slate-400">
19
+ <%= t("moduler.administration.documents.kinds.#{document.kind}") %>
20
+ <% if document.file.attached? %>
21
+ ·
22
+ <%= link_to t(".action.read"), main_app.rails_blob_path(document.file, disposition: "inline"), target: "_blank", rel: "noopener", class: "font-semibold text-custom hover:underline" %>
23
+ <% end %>
24
+ </p>
25
+ </div>
26
+ </li>
27
+ <% end %>
28
+ </ul>
29
+
30
+ <% @document_acceptance.errors.full_messages.each do |message| %>
31
+ <p class="text-sm text-red-500"><%= message %></p>
32
+ <% end %>
33
+
34
+ <%= render(::Moduler::Form::SubmitComponent.new(form, text: t(".action.submit"))) %>
35
+ <% end %>
36
+ </main>
@@ -0,0 +1,3 @@
1
+ <div class="markdown-content">
2
+ <%= @email.to_html %>
3
+ </div>
@@ -0,0 +1 @@
1
+ <%= @email.body %>
@@ -11,6 +11,7 @@
11
11
 
12
12
  <%= render(::Moduler::Form::SectionComponent.new(t(".section.data"))) do %>
13
13
  <%= render(::Moduler::Form::EmailComponent.new(form, :email_address, label: t(".label.email_address"), disabled: :disabled)) %>
14
+ <%= render(::Moduler::Form::TextComponent.new(form, :name, label: t(".label.name"), description: t(".description.name"))) %>
14
15
  <% end %>
15
16
 
16
17
  <%= render(::Moduler::Form::SectionComponent.new(t(".section.password"), divider: true)) do %>