gravity_mailbox 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/CHANGELOG.md +7 -2
- data/Gemfile.lock +49 -32
- data/README.md +4 -1
- data/gravity_mailbox.gemspec +3 -2
- data/lib/gravity_mailbox/mailbox_controller.rb +10 -0
- data/lib/gravity_mailbox/rails_cache_delivery_method.rb +11 -0
- data/lib/gravity_mailbox/railtie.rb +2 -0
- data/lib/gravity_mailbox/templates/gravity_mailbox/mailbox/_mail.html.erb +51 -5
- data/lib/gravity_mailbox/templates/gravity_mailbox/mailbox/index.html.erb +95 -10
- data/lib/gravity_mailbox/templates/layouts/application.html.erb +2 -0
- data/lib/gravity_mailbox/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff342147e916a7f207acf163e0dfb44e66fcc2619a5d5e585bcb4c4bbc3153b6
|
4
|
+
data.tar.gz: 2b522879f42bf910804e405a9097f9a277e442b7b8c9e0d6154f19597c8aae1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b903157b42b0a571d79d2a046f59a045543ab5722d70d00969829cbe7ffb17ed16644aed83619b5eb8ebed8b689e7aef70a12c12d027e0e1bb83632aea2aa2af
|
7
|
+
data.tar.gz: b5b4e508a4cfdf3500f034b06ea6896434c1968c04cae5560b2cda5d5b04369698e3d386c828730424cfac02ab530a226f3b866b333a9ae35233e88a68b8cc14
|
data/.github/workflows/main.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
2
|
|
3
3
|
## main (unreleased)
|
4
4
|
|
5
|
+
## v0.2.0 (2022-12-15)
|
6
|
+
|
7
|
+
* New look ([#7](https://github.com/petalmd/gravity_mailbox/pull/7))
|
8
|
+
* Download eml file ([#7](https://github.com/petalmd/gravity_mailbox/pull/7))
|
9
|
+
|
5
10
|
## v0.1.0 (2022-11-15)
|
6
11
|
|
7
|
-
|
12
|
+
* Initial release
|
data/Gemfile.lock
CHANGED
@@ -1,45 +1,47 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gravity_mailbox (0.
|
4
|
+
gravity_mailbox (0.2.0)
|
5
5
|
actionmailer (>= 5.2)
|
6
6
|
railties (>= 5.2)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionmailer (6.
|
12
|
-
actionpack (= 6.
|
13
|
-
actionview (= 6.
|
14
|
-
activejob (= 6.
|
11
|
+
actionmailer (6.1.7)
|
12
|
+
actionpack (= 6.1.7)
|
13
|
+
actionview (= 6.1.7)
|
14
|
+
activejob (= 6.1.7)
|
15
|
+
activesupport (= 6.1.7)
|
15
16
|
mail (~> 2.5, >= 2.5.4)
|
16
17
|
rails-dom-testing (~> 2.0)
|
17
|
-
actionpack (6.
|
18
|
-
actionview (= 6.
|
19
|
-
activesupport (= 6.
|
20
|
-
rack (~> 2.0, >= 2.0.
|
18
|
+
actionpack (6.1.7)
|
19
|
+
actionview (= 6.1.7)
|
20
|
+
activesupport (= 6.1.7)
|
21
|
+
rack (~> 2.0, >= 2.0.9)
|
21
22
|
rack-test (>= 0.6.3)
|
22
23
|
rails-dom-testing (~> 2.0)
|
23
24
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
24
|
-
actionview (6.
|
25
|
-
activesupport (= 6.
|
25
|
+
actionview (6.1.7)
|
26
|
+
activesupport (= 6.1.7)
|
26
27
|
builder (~> 3.1)
|
27
28
|
erubi (~> 1.4)
|
28
29
|
rails-dom-testing (~> 2.0)
|
29
30
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
30
|
-
activejob (6.
|
31
|
-
activesupport (= 6.
|
31
|
+
activejob (6.1.7)
|
32
|
+
activesupport (= 6.1.7)
|
32
33
|
globalid (>= 0.3.6)
|
33
|
-
activesupport (6.
|
34
|
+
activesupport (6.1.7)
|
34
35
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
35
|
-
i18n (>=
|
36
|
-
minitest (
|
37
|
-
tzinfo (~>
|
38
|
-
zeitwerk (~> 2.
|
36
|
+
i18n (>= 1.6, < 2)
|
37
|
+
minitest (>= 5.1)
|
38
|
+
tzinfo (~> 2.0)
|
39
|
+
zeitwerk (~> 2.3)
|
39
40
|
ast (2.4.2)
|
40
41
|
builder (3.2.4)
|
41
42
|
concurrent-ruby (1.1.10)
|
42
43
|
crass (1.0.6)
|
44
|
+
date (3.3.1)
|
43
45
|
diff-lcs (1.5.0)
|
44
46
|
erubi (1.11.0)
|
45
47
|
globalid (1.0.0)
|
@@ -47,36 +49,50 @@ GEM
|
|
47
49
|
i18n (1.12.0)
|
48
50
|
concurrent-ruby (~> 1.0)
|
49
51
|
json (2.6.2)
|
50
|
-
loofah (2.19.
|
52
|
+
loofah (2.19.1)
|
51
53
|
crass (~> 1.0.2)
|
52
54
|
nokogiri (>= 1.5.9)
|
53
|
-
mail (2.
|
55
|
+
mail (2.8.0)
|
54
56
|
mini_mime (>= 0.1.1)
|
57
|
+
net-imap
|
58
|
+
net-pop
|
59
|
+
net-smtp
|
55
60
|
method_source (1.0.0)
|
56
61
|
mini_mime (1.1.2)
|
57
62
|
mini_portile2 (2.8.0)
|
58
63
|
minitest (5.16.3)
|
59
|
-
|
64
|
+
net-imap (0.3.2)
|
65
|
+
date
|
66
|
+
net-protocol
|
67
|
+
net-pop (0.1.2)
|
68
|
+
net-protocol
|
69
|
+
net-protocol (0.2.1)
|
70
|
+
timeout
|
71
|
+
net-smtp (0.3.3)
|
72
|
+
net-protocol
|
73
|
+
nokogiri (1.13.10)
|
60
74
|
mini_portile2 (~> 2.8.0)
|
61
75
|
racc (~> 1.4)
|
76
|
+
nokogiri (1.13.10-x86_64-linux)
|
77
|
+
racc (~> 1.4)
|
62
78
|
parallel (1.22.1)
|
63
79
|
parser (3.1.2.1)
|
64
80
|
ast (~> 2.4.1)
|
65
|
-
racc (1.6.
|
81
|
+
racc (1.6.1)
|
66
82
|
rack (2.2.4)
|
67
83
|
rack-test (2.0.2)
|
68
84
|
rack (>= 1.3)
|
69
85
|
rails-dom-testing (2.0.3)
|
70
86
|
activesupport (>= 4.2.0)
|
71
87
|
nokogiri (>= 1.6)
|
72
|
-
rails-html-sanitizer (1.4.
|
73
|
-
loofah (~> 2.
|
74
|
-
railties (6.
|
75
|
-
actionpack (= 6.
|
76
|
-
activesupport (= 6.
|
88
|
+
rails-html-sanitizer (1.4.4)
|
89
|
+
loofah (~> 2.19, >= 2.19.1)
|
90
|
+
railties (6.1.7)
|
91
|
+
actionpack (= 6.1.7)
|
92
|
+
activesupport (= 6.1.7)
|
77
93
|
method_source
|
78
|
-
rake (>=
|
79
|
-
thor (
|
94
|
+
rake (>= 12.2)
|
95
|
+
thor (~> 1.0)
|
80
96
|
rainbow (3.1.1)
|
81
97
|
rake (13.0.6)
|
82
98
|
regexp_parser (2.6.0)
|
@@ -108,14 +124,15 @@ GEM
|
|
108
124
|
parser (>= 3.1.1.0)
|
109
125
|
ruby-progressbar (1.11.0)
|
110
126
|
thor (1.2.1)
|
111
|
-
|
112
|
-
tzinfo (
|
113
|
-
|
127
|
+
timeout (0.3.1)
|
128
|
+
tzinfo (2.0.5)
|
129
|
+
concurrent-ruby (~> 1.0)
|
114
130
|
unicode-display_width (2.3.0)
|
115
131
|
zeitwerk (2.6.6)
|
116
132
|
|
117
133
|
PLATFORMS
|
118
134
|
-darwin-21
|
135
|
+
x86_64-linux
|
119
136
|
|
120
137
|
DEPENDENCIES
|
121
138
|
gravity_mailbox!
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/gravity_mailbox.svg)](https://badge.fury.io/rb/gravity_mailbox)
|
2
|
+
[![Ruby](https://github.com/petalmd/gravity_mailbox/actions/workflows/main.yml/badge.svg)](https://github.com/petalmd/gravity_mailbox/actions/workflows/main.yml)
|
3
|
+
|
1
4
|
# GravityMailbox
|
2
5
|
|
3
6
|
Development tools that aim to make it simple to visualize mail sent by your Rails app directly through your Rails app.
|
@@ -31,7 +34,7 @@ config.action_mailer.perform_deliveries = true
|
|
31
34
|
* Send mails
|
32
35
|
* Go to http://localhost:3000/gravity_mailbox to see the mails.
|
33
36
|
|
34
|
-
<img width="520" alt="image" src="https://user-images.githubusercontent.com/7858787/
|
37
|
+
<img width="520" alt="image" src="https://user-images.githubusercontent.com/7858787/206336575-e1455a43-154d-4632-bc80-ecb849e2e224.png">
|
35
38
|
|
36
39
|
## Development
|
37
40
|
|
data/gravity_mailbox.gemspec
CHANGED
@@ -8,8 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Jean-Francis Bastien']
|
9
9
|
spec.email = ['jfbastien@petalmd.com']
|
10
10
|
|
11
|
-
spec.summary = '
|
12
|
-
spec.description = '
|
11
|
+
spec.summary = 'Visualize mail sent by your Rails app directly through your Rails app.'
|
12
|
+
spec.description = 'Development tools that aim to make it simple to visualize mail ' \
|
13
|
+
'sent by your Rails app directly through your Rails app.'
|
13
14
|
spec.homepage = 'https://github.com/petalmd/gravity_mailbox'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
@@ -16,6 +16,16 @@ module GravityMailbox
|
|
16
16
|
render plain: email_body
|
17
17
|
end
|
18
18
|
|
19
|
+
def download_eml
|
20
|
+
@mail = RailsCacheDeliveryMethod.mail(params[:id])
|
21
|
+
send_data @mail.to_s, filename: "#{@mail.subject}.eml"
|
22
|
+
end
|
23
|
+
|
24
|
+
def delete
|
25
|
+
RailsCacheDeliveryMethod.delete(params[:id])
|
26
|
+
redirect_to '/gravity_mailbox'
|
27
|
+
end
|
28
|
+
|
19
29
|
def delete_all
|
20
30
|
RailsCacheDeliveryMethod.delete_all
|
21
31
|
redirect_to '/gravity_mailbox'
|
@@ -24,6 +24,17 @@ module GravityMailbox
|
|
24
24
|
end.sort_by(&:date).reverse
|
25
25
|
end
|
26
26
|
|
27
|
+
def self.mail(id)
|
28
|
+
Mail.new(Rails.cache.read("#{KEY_PREFIX}#{id}"))
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.delete(id)
|
32
|
+
Rails.cache.delete("#{KEY_PREFIX}#{id}")
|
33
|
+
actual_list = mail_keys
|
34
|
+
actual_list.delete("#{KEY_PREFIX}#{id}")
|
35
|
+
Rails.cache.write(MAILS_LIST_KEY, actual_list)
|
36
|
+
end
|
37
|
+
|
27
38
|
def self.delete_all
|
28
39
|
Rails.cache.delete_matched("#{KEY_PREFIX}*")
|
29
40
|
end
|
@@ -17,6 +17,8 @@ module GravityMailbox
|
|
17
17
|
app.routes.prepend do
|
18
18
|
get '/gravity_mailbox' => 'gravity_mailbox/mailbox#index', internal: true
|
19
19
|
post '/gravity_mailbox/delete_all' => 'gravity_mailbox/mailbox#delete_all', internal: true
|
20
|
+
get '/gravity_mailbox/download_eml' => 'gravity_mailbox/mailbox#download_eml', internal: true
|
21
|
+
post '/gravity_mailbox/delete' => 'gravity_mailbox/mailbox#delete', internal: true
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -1,5 +1,51 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
1
|
+
|
2
|
+
<div class="p-4 mail-list-item <%= mail.message_id == params[:id] ? 'selected-mail' : '' %>" data-mail-id="<%= mail.message_id %>">
|
3
|
+
<div class="level" style="margin-bottom: 12px">
|
4
|
+
<div class="level-left" style="width: 80%">
|
5
|
+
<span class="has-text-weight-semibold mail-subject"><%= mail.subject %></span>
|
6
|
+
</div>
|
7
|
+
<div class="level-right">
|
8
|
+
<div class="dropdown is-right">
|
9
|
+
<div class="dropdown-trigger" style="width: 24px; height: 24px;">
|
10
|
+
<span class="icon">
|
11
|
+
<ion-icon name="ellipsis-vertical-outline"></ion-icon>
|
12
|
+
</span>
|
13
|
+
</div>
|
14
|
+
<div class="dropdown-menu" id="dropdown-menu" role="menu">
|
15
|
+
<div class="dropdown-content">
|
16
|
+
<div class="dropdown-item">
|
17
|
+
<%= link_to "/gravity_mailbox/download_eml?id=#{mail.message_id}", class: ['link-button'] do %>
|
18
|
+
<span class="icon-text">
|
19
|
+
<span class="icon has-text-centered">
|
20
|
+
<ion-icon name="download-outline"></ion-icon>
|
21
|
+
</span>
|
22
|
+
<span>Download .eml</span>
|
23
|
+
</span>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="dropdown-item">
|
28
|
+
<%= button_to "/gravity_mailbox/delete?id=#{mail.message_id}", class: ['link-button'], method: :post do %>
|
29
|
+
<span class="icon-text">
|
30
|
+
<span class="icon has-text-centered">
|
31
|
+
<ion-icon name="trash-outline"></ion-icon>
|
32
|
+
</span>
|
33
|
+
<span>Delete</span>
|
34
|
+
</span>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<% mail.to.each do |email_to| %>
|
44
|
+
<%= content_tag(:p, email_to, class: ['has-text-weight-light'], style: "font-size: 0.85rem") %>
|
45
|
+
<% end %>
|
46
|
+
<div class="has-text-right">
|
47
|
+
<span class="is-size-7" title="<%= I18n.l(mail.date, format: :long) %>">
|
48
|
+
<%= time_ago_in_words(mail.date) %>
|
49
|
+
</span>
|
50
|
+
</div>
|
51
|
+
</div>
|
@@ -7,20 +7,105 @@
|
|
7
7
|
border: 0;
|
8
8
|
width: 100%;
|
9
9
|
}
|
10
|
+
|
11
|
+
.mail-list-column {
|
12
|
+
height: 100vh;
|
13
|
+
overflow: scroll;
|
14
|
+
min-width: 20em;
|
15
|
+
}
|
16
|
+
|
17
|
+
.link-button {
|
18
|
+
background: none!important;
|
19
|
+
border: none;
|
20
|
+
padding: 0!important;
|
21
|
+
font-family: arial, sans-serif;
|
22
|
+
color: #000;
|
23
|
+
cursor: pointer;
|
24
|
+
}
|
25
|
+
|
26
|
+
.selected-mail {
|
27
|
+
background-color: #ffffff!important;
|
28
|
+
}
|
29
|
+
|
30
|
+
.mail-list-item {
|
31
|
+
background-color: hsl(206deg 27% 96%);
|
32
|
+
}
|
10
33
|
<% end %>
|
11
34
|
|
12
35
|
<div class="columns mb-0 mt-0">
|
13
|
-
<div class="column is-one-quarter
|
14
|
-
<div class="
|
15
|
-
|
36
|
+
<div class="column is-one-quarter pt-0 pr-0 mail-list-column">
|
37
|
+
<div class="navbar has-background-info">
|
38
|
+
<div class="navbar-brand">
|
39
|
+
<h1 class="navbar-item title is-6 has-text-white">GravityMailbox</h1>
|
40
|
+
</div>
|
41
|
+
<div class="navbar-menu">
|
42
|
+
<div class="navbar-end">
|
43
|
+
<div class="navbar-item">
|
44
|
+
<div class="dropdown is-right" id="toolbar-dropdown">
|
45
|
+
<div class="dropdown-trigger" style="width: 24px; height: 24px;">
|
46
|
+
<span class="icon has-text-white has-text-centered" aria-controls="dropdown-menu">
|
47
|
+
<ion-icon size="large" name="menu-outline"></ion-icon>
|
48
|
+
</span>
|
49
|
+
</div>
|
50
|
+
<div class="dropdown-menu" id="dropdown-menu" role="menu">
|
51
|
+
<div class="dropdown-content">
|
52
|
+
<div class="dropdown-item">
|
53
|
+
<%= button_to '/gravity_mailbox/delete_all', class: ['link-button'], method: :post do %>
|
54
|
+
<span class="icon-text">
|
55
|
+
<span class="icon has-text-centered">
|
56
|
+
<ion-icon name="trash-outline"></ion-icon>
|
57
|
+
</span>
|
58
|
+
<span>Delete all</span>
|
59
|
+
</span>
|
60
|
+
<% end %>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
</div>
|
16
68
|
</div>
|
17
|
-
|
18
|
-
|
19
|
-
|
69
|
+
|
70
|
+
<% @mails.each_with_index do |mail, index| %>
|
71
|
+
<%= render partial: 'mail', locals: { mail: mail, index: index } %>
|
72
|
+
<% end %>
|
20
73
|
</div>
|
21
|
-
<div class="column pb-0 pt-0">
|
22
|
-
|
23
|
-
<iframe seamless name="messageBody" src="?part=true&id=<%= params[:id] %>"></iframe>
|
24
|
-
<% end %>
|
74
|
+
<div class="column pb-0 pt-0 pl-0">
|
75
|
+
<iframe id="iframe-mail-container" seamless name="messageBody" src="<%= params[:id] ? "?part=true&id=#{params[:id]}" : '' %>"></iframe>
|
25
76
|
</div>
|
26
77
|
</div>
|
78
|
+
|
79
|
+
<script>
|
80
|
+
function closeAllOtherDropdown(e) {
|
81
|
+
document.querySelectorAll(".dropdown").forEach((dropdown) => {
|
82
|
+
dropdown.classList.remove('is-active');
|
83
|
+
})
|
84
|
+
}
|
85
|
+
|
86
|
+
// Click on mail and change iframe src
|
87
|
+
let mailItems = document.querySelectorAll(".mail-list-item")
|
88
|
+
mailItems.forEach(mailItem => {
|
89
|
+
mailItem.addEventListener("click", () => {
|
90
|
+
document.querySelector("#iframe-mail-container").src = "/gravity_mailbox?part=true&id=" + mailItem.dataset.mailId
|
91
|
+
mailItems.forEach(mailItem => mailItem.classList.remove("selected-mail"))
|
92
|
+
mailItem.classList.add("selected-mail")
|
93
|
+
})
|
94
|
+
})
|
95
|
+
|
96
|
+
// Close all dropdowns if the user clicks outside of them
|
97
|
+
document.addEventListener("click", (e) => {
|
98
|
+
document.querySelectorAll(".dropdown").forEach((dropdown) => {
|
99
|
+
dropdown.classList.remove("is-active")
|
100
|
+
})
|
101
|
+
});
|
102
|
+
|
103
|
+
// Each mail menu dropdown
|
104
|
+
document.querySelectorAll('.dropdown-trigger').forEach((dropdown) => {
|
105
|
+
dropdown.addEventListener('click', function (e) {
|
106
|
+
closeAllOtherDropdown(e)
|
107
|
+
e.target.closest(".dropdown").classList.toggle('is-active');
|
108
|
+
e.stopPropagation();
|
109
|
+
})
|
110
|
+
})
|
111
|
+
</script>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gravity_mailbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Francis Bastien
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -38,7 +38,8 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.2'
|
41
|
-
description:
|
41
|
+
description: Development tools that aim to make it simple to visualize mail sent by
|
42
|
+
your Rails app directly through your Rails app.
|
42
43
|
email:
|
43
44
|
- jfbastien@petalmd.com
|
44
45
|
executables: []
|
@@ -92,5 +93,5 @@ requirements: []
|
|
92
93
|
rubygems_version: 3.0.3
|
93
94
|
signing_key:
|
94
95
|
specification_version: 4
|
95
|
-
summary:
|
96
|
+
summary: Visualize mail sent by your Rails app directly through your Rails app.
|
96
97
|
test_files: []
|