mailbin 0.1.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97c16b480b7973ca30ed864cceaa479e79457a4d8a6e35bec60a139e00233bf7
4
- data.tar.gz: 704b7096ef4eaee23689ea7e5e4a1e9b46f61d3feacfed545ff9a3fa7da3b641
3
+ metadata.gz: 84c679d5445e1e16ced5d1a33bf0a1306a648bafb0a67ecb8634999fb0832896
4
+ data.tar.gz: d753e8e47c101a921b89ed3256ca0b5b863ca15e790616f3540c399deb3ef32c
5
5
  SHA512:
6
- metadata.gz: c77e8c567e0244ac54027311adef7e0ccc9dda560405e6a188a85ff7c3d2876e5fcec9d59c317f6b924bf6a8109cb96a30e3dc0e97f19ebcd868c80ddd9048fd
7
- data.tar.gz: 6813cd20e6dd13a3781f4fd48e3326f3d7cdd125bb7ef540bca6bf672e76196d51b85711bc58b85ff31ec6c752983a199546a505716042f1e7f85f84e5d5a8ab
6
+ metadata.gz: 001e8a9d5d8e2eb5d51ffac61276e7368e276a0d7ce8982da1e7e7ec8e557fa3a5ae53e9bda654a5deb4a77fe76a8ba7611bad083bcf96fab7c0bf625c5d6fcb
7
+ data.tar.gz: be42f88094e42567dfef8126cef214f1b5d5a48c6e877c45a98c1d3bb2880486c1aa5df6319c6ac6546ab2a543773572d02ecfc138d20b303dcd16f65d56f191
data/README.md CHANGED
@@ -11,7 +11,7 @@ Add Mailbin to your Gemfile:
11
11
  bundle add "mailbin"
12
12
  ```
13
13
 
14
- Configure Rails to send emails to MailDrop:
14
+ Configure Rails to send emails to Mailbin:
15
15
 
16
16
  ```ruby
17
17
  # config/environments/development.rb
@@ -3,7 +3,11 @@ html, body, iframe {
3
3
  }
4
4
 
5
5
  body {
6
+ font: 12px sans-serif;
6
7
  margin: 0;
8
+ padding: 1rem;
9
+ -webkit-font-smoothing: antialiased;
10
+ -moz-osx-font-smoothing: grayscale;
7
11
  }
8
12
 
9
13
  header {
@@ -39,11 +43,13 @@ dd:empty:before {
39
43
  content: "\00a0"; //  
40
44
  }
41
45
 
42
- th {
43
- font-weight: inherit;
44
- color: #7f7f7f;
45
- text-align: right;
46
- white-space: nowrap;
46
+ .headers {
47
+ th {
48
+ font-weight: inherit;
49
+ color: #7f7f7f;
50
+ text-align: right;
51
+ white-space: nowrap;
52
+ }
47
53
  }
48
54
 
49
55
  iframe {
@@ -52,6 +58,42 @@ iframe {
52
58
  }
53
59
 
54
60
  nav {
55
- padding: 8px;
61
+ padding-bottom: 0.5rem;
62
+ display: flex;
63
+ justify-content: space-between;
64
+ align-items: center;
56
65
  }
57
66
 
67
+ .email-list {
68
+ border-collapse: collapse;
69
+ width: 100%;
70
+
71
+ th, td {
72
+ padding: 0.5rem;
73
+ text-align: left;
74
+ }
75
+
76
+ th {
77
+ background-color: #f8f9fa;
78
+ font-weight: bold;
79
+ color: #495057;
80
+ }
81
+ }
82
+
83
+ .btn {
84
+ border-radius: 0.25rem;
85
+ border-width: 1px;
86
+ border-style: solid;
87
+ display: inline-block;
88
+ padding-bottom: 0.125rem;
89
+ padding-left: 0.35rem;
90
+ padding-right: 0.35rem;
91
+ padding-top: 0.125rem;
92
+ background-color: white;
93
+ color: rgb(31 41 55);
94
+ border-color: rgb(156 163 175);
95
+
96
+ &:hover {
97
+ background-color: rgb(243 244 246);
98
+ }
99
+ }
@@ -7,7 +7,7 @@
7
7
 
8
8
  <meta name="viewport" content="width=device-width,initial-scale=1">
9
9
  <%= stylesheet_link_tag "mailbin/application", "data-turbo-track": "reload" %>
10
- <%= javascript_importmap_tags "application-mailbin" %>
10
+ <%= javascript_importmap_tags "application", importmap: Mailbin.importmap %>
11
11
  </head>
12
12
  <body>
13
13
  <%= yield %>
@@ -1,14 +1,30 @@
1
- <%= link_to "Back to app", main_app.root_path if main_app.respond_to?(:root_path) %>
2
-
3
- <h1>Sent Emails</h1>
4
- <%= button_to "Clear all", clear_path, method: :delete, data: {turbo_confirm: "Are you sure?"} %>
1
+ <nav>
2
+ <%= link_to "Back to app", main_app.root_path if main_app.respond_to?(:root_path) %>
3
+ <h1>Sent Emails</h1>
4
+ <%= link_to "Mailbin on GitHub", "https://github.com/excid3/mailbin", target: :_blank %>
5
+ </nav>
5
6
 
6
7
  <% if @emails.any? %>
7
- <ul>
8
- <% @emails.each do |email| %>
9
- <li><%= link_to email.subject, message_path(email.message_id) %> - <%= l email.date, format: :long %></li>
10
- <% end %>
11
- </ul>
8
+ <table class="email-list">
9
+ <thead>
10
+ <tr>
11
+ <th>Subject</th>
12
+ <th>Sent At</th>
13
+ <th>
14
+ <%= button_to "Clear all", clear_path, method: :delete, class: "btn", data: {turbo_confirm: "Are you sure?"} %>
15
+ </th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <% @emails.each do |email| %>
20
+ <tr>
21
+ <td><%= link_to email.subject, message_path(email.message_id) %></td>
22
+ <td><%= l email.date, format: :long %></td>
23
+ <td><%= button_to "Delete", message_path(email.message_id), method: :delete, data: {turbo_confirm: "Are you sure?"}, class: "btn" %></td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
12
28
  <% else %>
13
29
  <p>You have not sent any emails.</p>
14
30
  <% end %>
@@ -1,12 +1,11 @@
1
1
  <nav>
2
2
  <%= link_to "Back to emails", messages_path %>
3
+ <h1><%= @email.subject %></h1>
4
+ <%= button_to "Delete", message_path(@email.message_id), method: :delete, class: "btn", data: {turbo_confirm: "Are you sure?"} %>
3
5
  </nav>
4
6
 
5
7
  <header>
6
8
  <dl>
7
- <dt>Actions</dt>
8
- <dd><%= button_to "Delete", message_path(@email.message_id), method: :delete, data: {turbo_confirm: "Are you sure?"} %> </dd>
9
-
10
9
  <% if Array(@email.from) != Array(@email.smtp_envelope_from) %>
11
10
  <dt>SMTP-From:</dt>
12
11
  <dd id="smtp_from"><%= @email.smtp_envelope_from %></dd>
@@ -88,7 +87,7 @@
88
87
  <dd>
89
88
  <details>
90
89
  <summary>Show all headers</summary>
91
- <table>
90
+ <table class="headers">
92
91
  <% @email.header_fields.each do |field| %>
93
92
  <tr>
94
93
  <th><%= field.name %>:</th>
data/config/importmap.rb CHANGED
@@ -1,2 +1,2 @@
1
- pin "application-mailbin", to: "mailbin/application.js", preload: true
1
+ pin "application", to: "mailbin/application.js", preload: true
2
2
  pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
@@ -16,13 +16,20 @@ module Mailbin
16
16
  end
17
17
 
18
18
  initializer "mailbin.assets" do |app|
19
- app.config.assets.paths << root.join("app/javascript")
20
- app.config.assets.precompile += %w[ mailbin_manifest ]
19
+ if app.config.respond_to?(:assets)
20
+ app.config.assets.paths << root.join("app/assets/stylesheets")
21
+ app.config.assets.paths << root.join("app/javascript")
22
+ app.config.assets.precompile += %w[ mailbin_manifest ]
23
+ end
21
24
  end
22
25
 
23
26
  initializer "mailbin.importmap", before: "importmap" do |app|
24
- app.config.importmap.paths << Engine.root.join("config/importmap.rb")
25
- app.config.importmap.cache_sweepers << Engine.root.join("app/javascript")
27
+ Mailbin.importmap.draw root.join("config/importmap.rb")
28
+ Mailbin.importmap.cache_sweeper watches: root.join("app/javascript")
29
+
30
+ ActiveSupport.on_load(:action_controller_base) do
31
+ before_action { Mailbin.importmap.cache_sweeper.execute_if_updated }
32
+ end
26
33
  end
27
34
  end
28
35
  end
@@ -1,3 +1,3 @@
1
1
  module Mailbin
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/mailbin.rb CHANGED
@@ -5,6 +5,8 @@ module Mailbin
5
5
  autoload :DeliveryMethod, "mailbin/delivery_method"
6
6
  autoload :InlinePreviewInterceptor, "mailbin/inline_preview_interceptor"
7
7
 
8
+ mattr_accessor :importmap, default: Importmap::Map.new
9
+
8
10
  class << self
9
11
  def all
10
12
  Dir.glob("*.eml", base: settings[:location]).map do |message_id|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailbin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-29 00:00:00.000000000 Z
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -78,13 +78,13 @@ files:
78
78
  - lib/mailbin/engine.rb
79
79
  - lib/mailbin/inline_preview_interceptor.rb
80
80
  - lib/mailbin/version.rb
81
- homepage: https://github.com
81
+ homepage: https://github.com/excid3/mailbin
82
82
  licenses:
83
83
  - MIT
84
84
  metadata:
85
- homepage_uri: https://github.com
86
- source_code_uri: https://github.com
87
- changelog_uri: https://github.com
85
+ homepage_uri: https://github.com/excid3/mailbin
86
+ source_code_uri: https://github.com/excid3/mailbin
87
+ changelog_uri: https://github.com/excid3/mailbin
88
88
  post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.5.16
103
+ rubygems_version: 3.5.23
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Mailbin collects emails from Rails ActionMailer in development for testing.