mailbin 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97c16b480b7973ca30ed864cceaa479e79457a4d8a6e35bec60a139e00233bf7
4
- data.tar.gz: 704b7096ef4eaee23689ea7e5e4a1e9b46f61d3feacfed545ff9a3fa7da3b641
3
+ metadata.gz: 67be1f2f606c258a26f029a1607a5a8a98563081cfffbaca218e08fcadba5697
4
+ data.tar.gz: 99e4de39547a8af3d4b5f06cd82c5b2593c898f2f7e7406459bd79f02a53170c
5
5
  SHA512:
6
- metadata.gz: c77e8c567e0244ac54027311adef7e0ccc9dda560405e6a188a85ff7c3d2876e5fcec9d59c317f6b924bf6a8109cb96a30e3dc0e97f19ebcd868c80ddd9048fd
7
- data.tar.gz: 6813cd20e6dd13a3781f4fd48e3326f3d7cdd125bb7ef540bca6bf672e76196d51b85711bc58b85ff31ec6c752983a199546a505716042f1e7f85f84e5d5a8ab
6
+ metadata.gz: 64cc63a073438227c3f1f5b4cf2950e15cf8bcb88b61a7a49b5779c2c1d2e25575b7286578504438331b4e1e426e7d646893252bccf13bfbead6a878a11f22ee
7
+ data.tar.gz: 01b6592c2774f379f39bb0bbfa5f65ad47d1daf21c163d7fa261e2e2c8390a811df8d8f425c9ea7f22e9f909d8539a744b09221f182466c20e0f89424bdbe5a5
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,9 @@ html, body, iframe {
3
3
  }
4
4
 
5
5
  body {
6
+ font: 12px "Lucida Grande", sans-serif;
6
7
  margin: 0;
8
+ padding: 1rem;
7
9
  }
8
10
 
9
11
  header {
@@ -39,11 +41,13 @@ dd:empty:before {
39
41
  content: "\00a0"; //  
40
42
  }
41
43
 
42
- th {
43
- font-weight: inherit;
44
- color: #7f7f7f;
45
- text-align: right;
46
- white-space: nowrap;
44
+ .headers {
45
+ th {
46
+ font-weight: inherit;
47
+ color: #7f7f7f;
48
+ text-align: right;
49
+ white-space: nowrap;
50
+ }
47
51
  }
48
52
 
49
53
  iframe {
@@ -52,6 +56,42 @@ iframe {
52
56
  }
53
57
 
54
58
  nav {
55
- padding: 8px;
59
+ padding-bottom: 0.5rem;
60
+ display: flex;
61
+ justify-content: space-between;
62
+ align-items: center;
63
+ }
64
+
65
+ .email-list {
66
+ border-collapse: collapse;
67
+ width: 100%;
68
+
69
+ th, td {
70
+ padding: 0.5rem;
71
+ text-align: left;
72
+ }
73
+
74
+ th {
75
+ background-color: #f8f9fa;
76
+ font-weight: bold;
77
+ color: #495057;
78
+ }
56
79
  }
57
80
 
81
+ .btn {
82
+ border-radius: 0.25rem;
83
+ border-width: 1px;
84
+ border-style: solid;
85
+ display: inline-block;
86
+ padding-bottom: 0.125rem;
87
+ padding-left: 0.35rem;
88
+ padding-right: 0.35rem;
89
+ padding-top: 0.125rem;
90
+ background-color: white;
91
+ color: rgb(31 41 55);
92
+ border-color: rgb(156 163 175);
93
+
94
+ &:hover {
95
+ background-color: rgb(243 244 246);
96
+ }
97
+ }
@@ -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 = "0.1.1"
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: 0.1.1
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-10-24 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.18
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Mailbin collects emails from Rails ActionMailer in development for testing.