munificent-admin 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/LICENCE +2 -0
  3. data/README.md +83 -0
  4. data/Rakefile +12 -0
  5. data/app/abilities/munificent/admin/ability.rb +51 -0
  6. data/app/abilities/munificent/admin/application_ability.rb +37 -0
  7. data/app/assets/config/munificent_admin_manifest.js +4 -0
  8. data/app/assets/javascripts/munificent_admin/application.js +6 -0
  9. data/app/assets/stylesheets/munificent/admin/application.scss +2 -0
  10. data/app/assets/stylesheets/munificent/admin/layout.scss +64 -0
  11. data/app/assets/stylesheets/munificent/admin/records.scss +7 -0
  12. data/app/controllers/munificent/admin/application_controller.rb +61 -0
  13. data/app/controllers/munificent/admin/bundle_tiers_controller.rb +12 -0
  14. data/app/controllers/munificent/admin/bundles_controller.rb +86 -0
  15. data/app/controllers/munificent/admin/charities_controller.rb +60 -0
  16. data/app/controllers/munificent/admin/dashboard_controller.rb +9 -0
  17. data/app/controllers/munificent/admin/donations_controller.rb +9 -0
  18. data/app/controllers/munificent/admin/donator_bundles_controller.rb +9 -0
  19. data/app/controllers/munificent/admin/donators_controller.rb +9 -0
  20. data/app/controllers/munificent/admin/fundraisers_controller.rb +68 -0
  21. data/app/controllers/munificent/admin/games_controller.rb +65 -0
  22. data/app/controllers/munificent/admin/otp_controller.rb +57 -0
  23. data/app/controllers/munificent/admin/user_sessions_controller.rb +44 -0
  24. data/app/controllers/munificent/admin/users_controller.rb +77 -0
  25. data/app/form_builders/munificent/admin/form_builder.rb +112 -0
  26. data/app/helpers/munificent/admin/application_helper.rb +6 -0
  27. data/app/helpers/munificent/admin/form_helper.rb +9 -0
  28. data/app/helpers/munificent/admin/layout_helper.rb +11 -0
  29. data/app/helpers/munificent/admin/state_machine_helper.rb +49 -0
  30. data/app/mailers/munificent/admin/application_mailer.rb +8 -0
  31. data/app/mailers/munificent/admin/panic_mailer.rb +19 -0
  32. data/app/models/concerns/authenticable.rb +9 -0
  33. data/app/models/munificent/admin/application_record.rb +7 -0
  34. data/app/models/munificent/admin/user.rb +54 -0
  35. data/app/models/munificent/admin/user_session.rb +19 -0
  36. data/app/presenters/munificent/admin/application_presenter.rb +29 -0
  37. data/app/presenters/munificent/admin/user_presenter.rb +24 -0
  38. data/app/presenters/munificent/bundle_presenter.rb +27 -0
  39. data/app/presenters/munificent/bundle_tier_presenter.rb +20 -0
  40. data/app/presenters/munificent/charity_presenter.rb +14 -0
  41. data/app/presenters/munificent/donation_presenter.rb +39 -0
  42. data/app/presenters/munificent/donator_bundle_presenter.rb +12 -0
  43. data/app/presenters/munificent/donator_presenter.rb +12 -0
  44. data/app/presenters/munificent/fundraiser_presenter.rb +41 -0
  45. data/app/presenters/munificent/game_presenter.rb +20 -0
  46. data/app/views/layouts/munificent/admin/application.html.erb +87 -0
  47. data/app/views/munificent/admin/bundles/_form.html.erb +15 -0
  48. data/app/views/munificent/admin/bundles/_tier_form.html.erb +13 -0
  49. data/app/views/munificent/admin/bundles/edit.html.erb +12 -0
  50. data/app/views/munificent/admin/bundles/index.html.erb +15 -0
  51. data/app/views/munificent/admin/bundles/new.html.erb +9 -0
  52. data/app/views/munificent/admin/bundles/show.html.erb +44 -0
  53. data/app/views/munificent/admin/charities/_form.html.erb +11 -0
  54. data/app/views/munificent/admin/charities/edit.html.erb +3 -0
  55. data/app/views/munificent/admin/charities/index.html.erb +11 -0
  56. data/app/views/munificent/admin/charities/new.html.erb +3 -0
  57. data/app/views/munificent/admin/charities/show.html.erb +23 -0
  58. data/app/views/munificent/admin/common/_record.html.erb +18 -0
  59. data/app/views/munificent/admin/common/_records.html.erb +38 -0
  60. data/app/views/munificent/admin/dashboard/index.html.erb +3 -0
  61. data/app/views/munificent/admin/donations/index.html.erb +15 -0
  62. data/app/views/munificent/admin/donator_bundles/index.html.erb +10 -0
  63. data/app/views/munificent/admin/donators/index.html.erb +11 -0
  64. data/app/views/munificent/admin/fundraisers/_form.html.erb +16 -0
  65. data/app/views/munificent/admin/fundraisers/edit.html.erb +3 -0
  66. data/app/views/munificent/admin/fundraisers/index.html.erb +17 -0
  67. data/app/views/munificent/admin/fundraisers/new.html.erb +3 -0
  68. data/app/views/munificent/admin/fundraisers/show.html.erb +41 -0
  69. data/app/views/munificent/admin/games/_form.html.erb +16 -0
  70. data/app/views/munificent/admin/games/csv_upload.html.erb +10 -0
  71. data/app/views/munificent/admin/games/edit.html.erb +3 -0
  72. data/app/views/munificent/admin/games/index.html.erb +15 -0
  73. data/app/views/munificent/admin/games/new.html.erb +3 -0
  74. data/app/views/munificent/admin/games/show.html.erb +25 -0
  75. data/app/views/munificent/admin/otp/_input_form.html.erb +6 -0
  76. data/app/views/munificent/admin/otp/input.html.erb +3 -0
  77. data/app/views/munificent/admin/otp/setup.html.erb +7 -0
  78. data/app/views/munificent/admin/panic_mailer/missing_key.html.erb +6 -0
  79. data/app/views/munificent/admin/panic_mailer/missing_key.text.erb +4 -0
  80. data/app/views/munificent/admin/user_sessions/new.html.erb +9 -0
  81. data/app/views/munificent/admin/users/_form.html.erb +29 -0
  82. data/app/views/munificent/admin/users/edit.html.erb +3 -0
  83. data/app/views/munificent/admin/users/index.html.erb +15 -0
  84. data/app/views/munificent/admin/users/new.html.erb +3 -0
  85. data/app/views/munificent/admin/users/show.html.erb +20 -0
  86. data/config/cucumber.yml +9 -0
  87. data/config/importmap.rb +4 -0
  88. data/config/initializers/inflections.rb +24 -0
  89. data/config/locales/en.yml +4 -0
  90. data/config/routes.rb +40 -0
  91. data/db/migrate/20220524130247_create_munificent_admin_user.rb +50 -0
  92. data/lib/munificent/admin/engine.rb +32 -0
  93. data/lib/munificent/admin/seeds.rb +19 -0
  94. data/lib/munificent/admin/version.rb +5 -0
  95. data/lib/munificent/admin.rb +7 -0
  96. data/lib/tasks/munificent/admin_tasks.rake +4 -0
  97. data/lib/tasks/munificent/cucumber.rake +75 -0
  98. data/lib/tasks/munificent/default.rake +32 -0
  99. metadata +354 -0
@@ -0,0 +1,41 @@
1
+ module Munificent
2
+ class FundraiserPresenter < Admin::ApplicationPresenter
3
+ delegate(
4
+ %i[
5
+ id
6
+ description
7
+ main_currency
8
+ starts_at
9
+ ends_at
10
+ overpayment_mode
11
+ short_url
12
+ state
13
+ ],
14
+ )
15
+
16
+ def state
17
+ tag.span(class: "badge text-bg-#{badge_type}") do
18
+ record.state.humanize
19
+ end
20
+ end
21
+
22
+ def overpayment_mode
23
+ record.overpayment_mode.humanize
24
+ end
25
+
26
+ private
27
+
28
+ def badge_type
29
+ case record.state
30
+ when "inactive"
31
+ "secondary"
32
+ when "active"
33
+ "success"
34
+ when "archived"
35
+ "info"
36
+ else
37
+ "light"
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,20 @@
1
+ module Munificent
2
+ class GamePresenter < Admin::ApplicationPresenter
3
+ delegate(
4
+ %i[
5
+ id
6
+ description
7
+ created_at
8
+ updated_at
9
+ ],
10
+ )
11
+
12
+ def unassigned_keys
13
+ record.keys.unassigned.count
14
+ end
15
+
16
+ def assigned_keys
17
+ record.keys.assigned.count
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,87 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Munificent admin</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
11
+ <%= stylesheet_link_tag "munificent-admin", media: "all" %>
12
+ <%= javascript_importmap_tags "munificent_admin/application" %>
13
+ <%= content_for :head %>
14
+ </head>
15
+
16
+ <body>
17
+ <% if logged_in? && verified_2sv? %>
18
+ <nav class="main-nav">
19
+ <% if can?(:read, :self) %>
20
+ <div class="dashboard">
21
+ <ul>
22
+ <li><%= nav_link "Dashboard", root_path %></li>
23
+ </ul>
24
+ </div>
25
+ <% end %>
26
+
27
+ <% if can?(:read, :public_info) %>
28
+ <div class="data-entry">
29
+ <h2>Data entry</h2>
30
+
31
+ <ul>
32
+ <li><%= nav_link "Fundraisers", fundraisers_path %></li>
33
+ <li><%= nav_link "Bundles", bundles_path %></li>
34
+ <li><%= nav_link "Charities", charities_path %></li>
35
+ <li><%= nav_link "Games", games_path %></li>
36
+ </ul>
37
+ </div>
38
+ <% end %>
39
+
40
+ <% if can?(:read, :donation_info) %>
41
+ <div class="support">
42
+ <h2>Support</h2>
43
+
44
+ <ul>
45
+ <li><%= nav_link "Donators", donators_path %></li>
46
+ <li><%= nav_link "Donations", donations_path %></li>
47
+ <li><%= nav_link "Assigned bundles", donator_bundles_path %></li>
48
+ </ul>
49
+ </div>
50
+ <% end %>
51
+
52
+ <% if can?(:read, :user_accounts) %>
53
+ <div class="restricted">
54
+ <h2>Restricted</h2>
55
+
56
+ <ul>
57
+ <li><%= nav_link "Admin users", users_path %></li>
58
+ </ul>
59
+ </div>
60
+ <% end %>
61
+
62
+ <% if can?(:read, :self) %>
63
+ <ul class="user">
64
+ <li><%= link_to current_user %></li>
65
+ <li><%= button_to "Log out", user_session_path, method: :delete %>
66
+ </ul>
67
+ <% end %>
68
+ </nav>
69
+ <% end %>
70
+
71
+ <main>
72
+ <% if (flash_entries = flash.to_hash.slice("alert", "notice")).any? %>
73
+ <ul class="notices list-unstyled">
74
+ <% flash_entries.each do |_, message| %>
75
+ <% if message.present? %>
76
+ <li><%= message %></li>
77
+ <% end %>
78
+ <% end %>
79
+ </ul>
80
+ <% end %>
81
+
82
+ <%= yield %>
83
+ </main>
84
+
85
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
86
+ </body>
87
+ </html>
@@ -0,0 +1,15 @@
1
+ <%= form_for record do |f| %>
2
+ <fieldset class="record">
3
+ <%= f.field(:text_field, :name) %>
4
+ <%= f.field(:select, :fundraiser_id,
5
+ label: "Fundraiser",
6
+ source: Munificent::Fundraiser.order(:name).pluck(:name, :id),
7
+ ) %>
8
+ </fieldset>
9
+
10
+ <%= yield f %>
11
+
12
+ <button class="btn btn-primary">Save</button>
13
+
14
+ <%= link_to "Cancel", record.persisted? ? bundle_path(record) : bundles_path %>
15
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <%= yield %>
2
+
3
+ <%= tier_form.table(css_class: ["tier-form", ("new-tier" if tier_form.object.new_record?)]) do %>
4
+ <%= tier_form.field(:text_field, :name, optional: true) %>
5
+ <%= tier_form.money(:price, default_currency: tier_form.object.bundle.fundraiser&.main_currency) %>
6
+ <%= tier_form.field(:text_field, :starts_at, optional: true) %>
7
+ <%= tier_form.field(:text_field, :ends_at, optional: true) %>
8
+ <%= tier_form.field(:select, :game_ids, source: Munificent::Game.order(:name).pluck(:name, :id), label: "Games", multiple: true) %>
9
+
10
+ <% if tier_form.object.persisted? %>
11
+ <%= tier_form.check_box :_destroy, label: "Delete?" %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <h1>Edit bundle</h1>
2
+
3
+ <%= render "form", record: @bundle do |f| %>
4
+ <h4>Tiers</h4>
5
+ <%= f.fields_for(:bundle_tiers, @bundle.bundle_tiers.sort_by { |t| [t.price, t.id || -1] }.reverse) do |tier_form| %>
6
+ <%= render("munificent/admin/bundles/tier_form", tier_form:) do %>
7
+ <% if tier_form.object.new_record? %>
8
+ <h5>New tier</h5>
9
+ <% end %>
10
+ <% end %>
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <h1>Bundles</h1>
2
+
3
+ <%= render "munificent/admin/common/records",
4
+ records: @bundles,
5
+ fields: %i[
6
+ id
7
+ name
8
+ price
9
+ starts_at
10
+ ends_at
11
+ state
12
+ fundraiser
13
+ ] %>
14
+
15
+ <%= link_to "New bundle", new_bundle_path %>
@@ -0,0 +1,9 @@
1
+ <h1>New bundle</h1>
2
+
3
+ <%= render "form", record: @bundle do |f| %>
4
+ <%= f.fields_for :bundle_tiers do |tier_form| %>
5
+ <%= render("munificent/admin/bundles/tier_form", tier_form:) do %>
6
+ <h5>Default tier</h5>
7
+ <% end %>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,44 @@
1
+ <h1>
2
+ <%= @bundle.name %>
3
+ <%= presenter.state %>
4
+ </h1>
5
+
6
+ <% if can?(:manage, @bundle) %>
7
+ <ul class="actions list-unstyled">
8
+ <% if @bundle.live? %>
9
+ You cannot edit a live bundle. If you need to make changes, please retract it first. Proceed with caution.
10
+ <% else %>
11
+ <li>
12
+ <%= link_to "Edit", edit_bundle_path(@bundle) %>
13
+ </li>
14
+ <li>
15
+ <%= button_to "Delete", bundle_path(@bundle), method: :delete, data: { confirm: "Are you sure? This cannot be undone." } %>
16
+ </li>
17
+ <% end %>
18
+
19
+ <%= aasm_buttons(@bundle) %>
20
+ </ul>
21
+ <% end %>
22
+
23
+ <%= render("munificent/admin/common/record",
24
+ record: @bundle,
25
+ attributes: %i[
26
+ name
27
+ price
28
+ fundraiser
29
+ ],
30
+ ) %>
31
+
32
+ <h2>Tiers</h2>
33
+
34
+ <%= render "munificent/admin/common/records",
35
+ type: "tiers",
36
+ records: @bundle.bundle_tiers.order(price_decimals: :desc),
37
+ fields: %i[
38
+ id
39
+ name
40
+ price
41
+ starts_at
42
+ ends_at
43
+ games
44
+ ] %>
@@ -0,0 +1,11 @@
1
+ <%= form_for record do |f| %>
2
+ <fieldset class="record">
3
+ <%= f.field(:text_field, :name) %>
4
+ <%= f.field(:text_area, :description) %>
5
+ <%= f.field(:select, :fundraiser_ids, source: Munificent::Fundraiser.order(:name).pluck(:name, :id), label: "Fundraisers", multiple: true) %>
6
+ </fieldset>
7
+
8
+ <button class="btn btn-primary">Save</button>
9
+
10
+ <%= link_to "Cancel", record.persisted? ? charity_path(record) : charities_path %>
11
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1>Edit charity</h1>
2
+
3
+ <%= render "form", record: @charity %>
@@ -0,0 +1,11 @@
1
+ <h1>Charities</h1>
2
+
3
+ <%= render "munificent/admin/common/records",
4
+ records: @charities,
5
+ fields: %i[
6
+ id
7
+ name
8
+ fundraisers
9
+ ] %>
10
+
11
+ <%= link_to "New charity", new_charity_path %>
@@ -0,0 +1,3 @@
1
+ <h1>New charity</h1>
2
+
3
+ <%= render "form", record: @charity %>
@@ -0,0 +1,23 @@
1
+ <h1>
2
+ <%= @charity.name %>
3
+ </h1>
4
+
5
+ <% if can?(:manage, @game) %>
6
+ <ul class="actions list-unstyled">
7
+ <li>
8
+ <%= link_to "Edit", edit_charity_path(@charity) %>
9
+ </li>
10
+ <li>
11
+ <%= button_to "Delete", charity_path(@charity), method: :delete, data: { confirm: "Are you sure? This cannot be undone." } %>
12
+ </li>
13
+ </ul>
14
+ <% end %>
15
+
16
+ <%= render("munificent/admin/common/record",
17
+ record: @charity,
18
+ attributes: %i[
19
+ name
20
+ description
21
+ fundraisers
22
+ ],
23
+ ) %>
@@ -0,0 +1,18 @@
1
+ <table class="record table table-striped <%= dom_id(record) %>">
2
+ <tbody>
3
+ <% presented_record = Munificent::Admin::ApplicationPresenter.present(record) %>
4
+
5
+ <% attributes.each do |attribute| %>
6
+ <tr class="row-<%= attribute %>">
7
+ <td class="attribute"><%= attribute.to_s.humanize %></td>
8
+ <td class="value">
9
+ <% if (value = presented_record.public_send(attribute)).respond_to?(:id) && value != record %>
10
+ <%= link_to value %>
11
+ <% else %>
12
+ <%= value %>
13
+ <% end %>
14
+ </td>
15
+ </tr>
16
+ <% end %>
17
+ </tbody>
18
+ </table>
@@ -0,0 +1,38 @@
1
+ <% if records.any? %>
2
+ <table class="table table-striped <%= type if defined?(type) %>">
3
+ <thead>
4
+ <tr>
5
+ <% fields.each do |field| %>
6
+ <th>
7
+ <% case field %>
8
+ <% when :id %>
9
+ ID
10
+ <% else %>
11
+ <%= field.to_s.humanize %>
12
+ <% end %>
13
+ </th>
14
+ <% end %>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% records.each do |record| %>
19
+ <% presented_record = Munificent::Admin::ApplicationPresenter.present(record) %>
20
+ <tr class="<%= dom_id(record) %>">
21
+ <% fields.each do |field| %>
22
+ <td class="col-<%= field %>">
23
+ <% if (value = presented_record.public_send(field)).respond_to?(:id) %>
24
+ <%= link_to value %>
25
+ <% elsif value.present? %>
26
+ <%= value %>
27
+ <% else %>
28
+ <span class="not-set">(not set)</span>
29
+ <% end %>
30
+ </td>
31
+ <% end %>
32
+ </tr>
33
+ <% end %>
34
+ </tbody>
35
+ </table>
36
+ <% else %>
37
+ <p>No records found.</p>
38
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1>Dashboard</h1>
2
+
3
+ This functionality coming soon.
@@ -0,0 +1,15 @@
1
+ <h1>Donations</h1>
2
+
3
+ <%= render "munificent/admin/common/records",
4
+ records: @donations,
5
+ fields: %i[
6
+ id
7
+ amount
8
+ donator_name
9
+ message
10
+ state
11
+ curated_streamer
12
+ donated_by
13
+ fundraiser
14
+ created_at
15
+ ] %>
@@ -0,0 +1,10 @@
1
+ <h1>Assigned bundles</h1>
2
+
3
+ <%= render "munificent/admin/common/records",
4
+ records: @donator_bundles,
5
+ fields: %i[
6
+ id
7
+ donator
8
+ bundle
9
+ created_at
10
+ ] %>
@@ -0,0 +1,11 @@
1
+ <h1>Donators</h1>
2
+
3
+ <%= render "munificent/admin/common/records",
4
+ records: @donators,
5
+ fields: %i[
6
+ id
7
+ name
8
+ chosen_name
9
+ email_address
10
+ created_at
11
+ ] %>
@@ -0,0 +1,16 @@
1
+ <%= form_for record do |f| %>
2
+ <fieldset class="record">
3
+ <%= f.field(:text_field, :name) %>
4
+ <%= f.field(:text_area, :description) %>
5
+ <%= f.field(:select, :main_currency, source: Munificent::Currency.present_all) %>
6
+ <%= f.field(:text_field, :starts_at) %>
7
+ <%= f.field(:text_field, :ends_at) %>
8
+ <%= f.field(:select, :overpayment_mode, source: Munificent::Fundraiser::OVERPAYMENT_MODES) %>
9
+ <%= f.field(:text_field, :short_url) %>
10
+ <%= f.field(:select, :state, source: Munificent::Fundraiser.aasm.states.map(&:name)) %>
11
+ </fieldset>
12
+
13
+ <button class="btn btn-primary">Save</button>
14
+
15
+ <%= link_to "Cancel", record.persisted? ? fundraiser_path(record) : fundraisers_path %>
16
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1>Edit fundraiser</h1>
2
+
3
+ <%= render "form", record: @fundraiser %>
@@ -0,0 +1,17 @@
1
+ <h1>Fundraisers</h1>
2
+
3
+ <%= render "munificent/admin/common/records",
4
+ records: @fundraisers,
5
+ fields: %i[
6
+ id
7
+ name
8
+ description
9
+ main_currency
10
+ starts_at
11
+ ends_at
12
+ overpayment_mode
13
+ short_url
14
+ state
15
+ ] %>
16
+
17
+ <%= link_to "New fundraiser", new_fundraiser_path %>
@@ -0,0 +1,3 @@
1
+ <h1>New fundraiser</h1>
2
+
3
+ <%= render "form", record: @fundraiser %>
@@ -0,0 +1,41 @@
1
+ <h1>
2
+ <%= @fundraiser.name %>
3
+ <%= presenter.state %>
4
+ </h1>
5
+
6
+ <% if can?(:manage, @fundraiser) %>
7
+ <ul class="actions list-unstyled">
8
+ <li>
9
+ <%= link_to "Edit", edit_fundraiser_path(@fundraiser) %>
10
+ </li>
11
+ <li>
12
+ <%= button_to "Delete", fundraiser_path(@fundraiser), method: :delete, data: { confirm: "Are you sure? This cannot be undone." } %>
13
+ </li>
14
+ <%= aasm_buttons(@fundraiser) %>
15
+ </ul>
16
+ <% end %>
17
+
18
+ <%= render("munificent/admin/common/record",
19
+ record: @fundraiser,
20
+ attributes: %i[
21
+ name
22
+ description
23
+ main_currency
24
+ starts_at
25
+ ends_at
26
+ overpayment_mode
27
+ short_url
28
+ state
29
+ ],
30
+ ) %>
31
+
32
+ <h2>Bundles</h2>
33
+
34
+ <%= render "munificent/admin/common/records",
35
+ type: "bundles",
36
+ records: @fundraiser.bundles,
37
+ fields: %i[
38
+ id
39
+ name
40
+ state
41
+ ] %>
@@ -0,0 +1,16 @@
1
+ <%= form_for record do |f| %>
2
+ <fieldset class="record">
3
+ <%= f.field(:text_field, :name) %>
4
+ <%= f.field(:text_area, :description) %>
5
+ </fieldset>
6
+
7
+ <fieldset class="keys">
8
+ <legend>Keys</legend>
9
+
10
+ <%= f.field(:text_area, :bulk_key_entry) %>
11
+ </fieldset>
12
+
13
+ <button class="btn btn-primary">Save</button>
14
+
15
+ <%= link_to "Cancel", record.persisted? ? game_path(record) : games_path %>
16
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <h1><%= resource.name %> CSV upload</h3>
2
+
3
+ <%= form_tag upload_csv_game_path(resource), multipart: true do %>
4
+ <label>
5
+ Attach file
6
+ <%= file_field_tag :csv, accept: "text/csv" %>
7
+ </label>
8
+
9
+ <button>Upload</button>
10
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1>Edit game</h1>
2
+
3
+ <%= render "form", record: @game %>
@@ -0,0 +1,15 @@
1
+ <h1>Games</h1>
2
+
3
+ <%= render "munificent/admin/common/records",
4
+ records: @games,
5
+ fields: %i[
6
+ id
7
+ name
8
+ description
9
+ unassigned_keys
10
+ assigned_keys
11
+ created_at
12
+ updated_at
13
+ ] %>
14
+
15
+ <%= link_to "New game", new_game_path %>
@@ -0,0 +1,3 @@
1
+ <h1>New game</h1>
2
+
3
+ <%= render "form", record: @game %>
@@ -0,0 +1,25 @@
1
+ <h1><%= @game.name %></h1>
2
+
3
+ <% if can?(:manage, @game) %>
4
+ <ul class="actions list-unstyled">
5
+ <li><%= link_to "Edit", edit_game_path(@game) %></li>
6
+ <% if can?(:manage, Munificent::Key) %>
7
+ <li><%= link_to "Upload keys via CSV", csv_upload_game_path(@game) %></li>
8
+ <% end %>
9
+ <li>
10
+ <%= button_to "Delete", game_path(@game), method: :delete, data: { confirm: "Are you sure? This cannot be undone." } %>
11
+ </li>
12
+ </ul>
13
+ <% end %>
14
+
15
+ <%= render("munificent/admin/common/record",
16
+ record: @game,
17
+ attributes: %i[
18
+ name
19
+ description
20
+ unassigned_keys
21
+ assigned_keys
22
+ created_at
23
+ updated_at
24
+ ],
25
+ ) %>
@@ -0,0 +1,6 @@
1
+ <h3>Enter a code from your authenticator</h3>
2
+
3
+ <%= form_tag otp_verify_path do %>
4
+ <%= text_field_tag :otp_code, {}, placeholder: "112233" %>
5
+ <button>Verify</button>
6
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h2>2SV verification</h2>
2
+
3
+ <%= render "input_form" %>
@@ -0,0 +1,7 @@
1
+ <h1>Set up 2SV</h1>
2
+
3
+ <svg width="400" height="400">
4
+ <%= @qr_code.html_safe %>
5
+ </svg>
6
+
7
+ <%= render "input_form" %>
@@ -0,0 +1,6 @@
1
+ <h1>Missing key</h1>
2
+
3
+ <p>
4
+ We tried to assign a <%= @game.name %> key to donator <%= @donator.display_name %> (ID: <%= @donator.id %>, email address: <%= @donator.email_address.presence || "none" %>),
5
+ but we couldn't find an available key for that game.
6
+ </p>
@@ -0,0 +1,4 @@
1
+ Missing key.
2
+
3
+ We tried to assign a <%= @game.name %> key to donator <%= @donator.display_name %> (ID: <%= @donator.id %>, email address: <%= @donator.email_address.presence || "none" %>),
4
+ but we couldn't find an available key for that game.
@@ -0,0 +1,9 @@
1
+ <h1>Log in</h1>
2
+
3
+ <%= form_for @user_session, url: user_session_path do |f| %>
4
+ <%= f.field(:email_field, :email_address) %>
5
+ <%= f.field(:password_field, :password) %>
6
+ <%= f.check_box(:remember_me, checked: true) %>
7
+
8
+ <button class="btn btn-primary">Log in</button>
9
+ <% end %>