gravity_mailbox 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -2
- data/lib/gravity_mailbox/engine.rb +19 -0
- data/lib/gravity_mailbox/rails_cache_delivery_method.rb +6 -2
- data/lib/gravity_mailbox/version.rb +1 -1
- data/lib/gravity_mailbox.rb +1 -2
- metadata +13 -39
- data/.github/workflows/main.yml +0 -18
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.rubocop.yml +0 -8
- data/CHANGELOG.md +0 -12
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -144
- data/Rakefile +0 -12
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/gravity_mailbox.gemspec +0 -37
- data/lib/gravity_mailbox/mailbox_controller.rb +0 -56
- data/lib/gravity_mailbox/railtie.rb +0 -25
- data/lib/gravity_mailbox/templates/gravity_mailbox/mailbox/_mail.html.erb +0 -51
- data/lib/gravity_mailbox/templates/gravity_mailbox/mailbox/index.html.erb +0 -111
- data/lib/gravity_mailbox/templates/layouts/application.html.erb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce37494fe075c4031d525e51672a2a1be1f8fb283aaae7d1de7d30a5baa2ff31
|
4
|
+
data.tar.gz: 360aeebf86d71e2887fdd239639be1710968d3f253b1f19e867584499bdf9c2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5363f0b77e08f72fbfe7153671a99f655ed7711c7d65055727ce2034a9657ae6cf5884023df7b47a2aea6ab2997e93bac746d8aa839720881180dabbbbc2b453
|
7
|
+
data.tar.gz: 729affd85417e0f371980d0a39067f6039c8ac495fe6f4d126be8cd243d1d2e36aca3a71b6384d86c737ec035f989a9837ef28383a75951451fe43fbe0e76339
|
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/gravity_mailbox.svg)](https://badge.fury.io/rb/gravity_mailbox)
|
2
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
3
|
|
4
|
-
|
4
|
+
<p align="center">
|
5
|
+
<img src="https://user-images.githubusercontent.com/7858787/213794938-f55aef73-ce49-45b5-a388-d16f2435de15.png" />
|
6
|
+
</p>
|
5
7
|
|
6
8
|
Development tools that aim to make it simple to visualize mail sent by your Rails app directly through your Rails app.
|
7
9
|
It works in development and also in a staging environment by using the `Rails.cache` to store the mails.
|
@@ -27,14 +29,31 @@ Or install it yourself as:
|
|
27
29
|
* Config ActionMailer to use the RailsCacheDeliveryMethod.
|
28
30
|
|
29
31
|
```ruby
|
32
|
+
# config/environments/(development|staging).rb
|
30
33
|
config.action_mailer.delivery_method = :gravity_mailbox_rails_cache
|
31
34
|
config.action_mailer.perform_deliveries = true
|
32
35
|
```
|
33
36
|
|
37
|
+
* Mount the Engine
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# config/routes.rb
|
41
|
+
mount GravityMailbox::Engine => "/gravity_mailbox"
|
42
|
+
```
|
43
|
+
|
34
44
|
* Send mails
|
35
45
|
* Go to http://localhost:3000/gravity_mailbox to see the mails.
|
36
46
|
|
37
|
-
|
47
|
+
**Note**
|
48
|
+
|
49
|
+
You can use routing constraints to restrict access to GravityMailbox. More details and example in the [Rails Guides](https://guides.rubyonrails.org/routing.html#advanced-constraints).
|
50
|
+
|
51
|
+
|
52
|
+
## Screenshots
|
53
|
+
|
54
|
+
<p align="center">
|
55
|
+
<img width="520" alt="image" src="https://user-images.githubusercontent.com/7858787/213796119-a22ac9da-3943-4cd0-95e6-2fb724de999a.png">
|
56
|
+
</p>
|
38
57
|
|
39
58
|
## Development
|
40
59
|
|
@@ -42,6 +61,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
42
61
|
|
43
62
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
44
63
|
|
64
|
+
### Standalone app
|
65
|
+
|
66
|
+
Use `bundle exec rackup` to test locally the gem. Go to [http://localhost:9292](http://localhost:9292)
|
67
|
+
Use the button to send a test mail and to see those mail into GravityMailbox.
|
68
|
+
|
45
69
|
## Contributing
|
46
70
|
|
47
71
|
Bug reports and pull requests are welcome on GitHub at https://github.com/petalmd/gravity_mailbox.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails'
|
4
|
+
require_relative 'rails_cache_delivery_method'
|
5
|
+
|
6
|
+
module GravityMailbox
|
7
|
+
class Engine < ::Rails::Engine # :nodoc:
|
8
|
+
isolate_namespace(GravityMailbox)
|
9
|
+
|
10
|
+
initializer 'gravity_mailbox.add_delivery_method' do
|
11
|
+
ActiveSupport.on_load :action_mailer do
|
12
|
+
ActionMailer::Base.add_delivery_method(
|
13
|
+
:gravity_mailbox_rails_cache,
|
14
|
+
RailsCacheDeliveryMethod
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,12 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'mail'
|
4
|
+
|
3
5
|
module GravityMailbox
|
4
6
|
class RailsCacheDeliveryMethod
|
5
7
|
KEY_PREFIX = 'gravity_mailbox/'
|
6
8
|
MAILS_LIST_KEY = "#{KEY_PREFIX}list"
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
+
attr_accessor :settings
|
11
|
+
|
12
|
+
def initialize(settings)
|
13
|
+
@settings = settings
|
10
14
|
end
|
11
15
|
|
12
16
|
def deliver!(mail)
|
data/lib/gravity_mailbox.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'gravity_mailbox/version'
|
4
|
-
require_relative 'gravity_mailbox/
|
5
|
-
require_relative 'gravity_mailbox/railtie' if defined?(Rails)
|
4
|
+
require_relative 'gravity_mailbox/engine'
|
6
5
|
|
7
6
|
module GravityMailbox
|
8
7
|
end
|
metadata
CHANGED
@@ -1,79 +1,53 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gravity_mailbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Francis Bastien
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: railties
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '5.2'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '5.2'
|
26
|
+
version: '6.0'
|
41
27
|
description: Development tools that aim to make it simple to visualize mail sent by
|
42
28
|
your Rails app directly through your Rails app.
|
43
29
|
email:
|
44
30
|
- jfbastien@petalmd.com
|
45
31
|
executables: []
|
46
32
|
extensions: []
|
47
|
-
extra_rdoc_files:
|
33
|
+
extra_rdoc_files:
|
34
|
+
- LICENSE.txt
|
35
|
+
- README.md
|
48
36
|
files:
|
49
|
-
- ".github/workflows/main.yml"
|
50
|
-
- ".gitignore"
|
51
|
-
- ".rspec"
|
52
|
-
- ".rubocop.yml"
|
53
|
-
- CHANGELOG.md
|
54
|
-
- Gemfile
|
55
|
-
- Gemfile.lock
|
56
37
|
- LICENSE.txt
|
57
38
|
- README.md
|
58
|
-
- Rakefile
|
59
|
-
- bin/console
|
60
|
-
- bin/setup
|
61
|
-
- gravity_mailbox.gemspec
|
62
39
|
- lib/gravity_mailbox.rb
|
63
|
-
- lib/gravity_mailbox/
|
40
|
+
- lib/gravity_mailbox/engine.rb
|
64
41
|
- lib/gravity_mailbox/rails_cache_delivery_method.rb
|
65
|
-
- lib/gravity_mailbox/railtie.rb
|
66
|
-
- lib/gravity_mailbox/templates/gravity_mailbox/mailbox/_mail.html.erb
|
67
|
-
- lib/gravity_mailbox/templates/gravity_mailbox/mailbox/index.html.erb
|
68
|
-
- lib/gravity_mailbox/templates/layouts/application.html.erb
|
69
42
|
- lib/gravity_mailbox/version.rb
|
70
43
|
homepage: https://github.com/petalmd/gravity_mailbox
|
71
44
|
licenses:
|
72
45
|
- MIT
|
73
46
|
metadata:
|
74
47
|
homepage_uri: https://github.com/petalmd/gravity_mailbox
|
75
|
-
source_code_uri: https://github.com/petalmd/gravity_mailbox
|
76
48
|
changelog_uri: https://github.com/petalmd/gravity_mailbox/blob/main/CHANGELOG.md
|
49
|
+
source_code_uri: https://github.com/petalmd/gravity_mailbox
|
50
|
+
bug_tracker_uri: https://github.com/petalmd/gravity_mailbox/issues
|
77
51
|
rubygems_mfa_required: 'true'
|
78
52
|
post_install_message:
|
79
53
|
rdoc_options: []
|
@@ -90,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
64
|
- !ruby/object:Gem::Version
|
91
65
|
version: '0'
|
92
66
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
67
|
+
rubygems_version: 3.2.3
|
94
68
|
signing_key:
|
95
69
|
specification_version: 4
|
96
70
|
summary: Visualize mail sent by your Rails app directly through your Rails app.
|
data/.github/workflows/main.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
name: Build
|
2
|
-
|
3
|
-
on: [push,pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- uses: actions/checkout@v2
|
10
|
-
- name: Set up Ruby
|
11
|
-
uses: ruby/setup-ruby@v1
|
12
|
-
with:
|
13
|
-
ruby-version: 2.6.6
|
14
|
-
- name: Run the default task
|
15
|
-
run: |
|
16
|
-
gem install bundler -v 2.2.3
|
17
|
-
bundle install
|
18
|
-
bundle exec rake
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/CHANGELOG.md
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# Changelog
|
2
|
-
|
3
|
-
## main (unreleased)
|
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
|
-
|
10
|
-
## v0.1.0 (2022-11-15)
|
11
|
-
|
12
|
-
* Initial release
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
gravity_mailbox (0.2.0)
|
5
|
-
actionmailer (>= 5.2)
|
6
|
-
railties (>= 5.2)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
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)
|
16
|
-
mail (~> 2.5, >= 2.5.4)
|
17
|
-
rails-dom-testing (~> 2.0)
|
18
|
-
actionpack (6.1.7)
|
19
|
-
actionview (= 6.1.7)
|
20
|
-
activesupport (= 6.1.7)
|
21
|
-
rack (~> 2.0, >= 2.0.9)
|
22
|
-
rack-test (>= 0.6.3)
|
23
|
-
rails-dom-testing (~> 2.0)
|
24
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
25
|
-
actionview (6.1.7)
|
26
|
-
activesupport (= 6.1.7)
|
27
|
-
builder (~> 3.1)
|
28
|
-
erubi (~> 1.4)
|
29
|
-
rails-dom-testing (~> 2.0)
|
30
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
31
|
-
activejob (6.1.7)
|
32
|
-
activesupport (= 6.1.7)
|
33
|
-
globalid (>= 0.3.6)
|
34
|
-
activesupport (6.1.7)
|
35
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
36
|
-
i18n (>= 1.6, < 2)
|
37
|
-
minitest (>= 5.1)
|
38
|
-
tzinfo (~> 2.0)
|
39
|
-
zeitwerk (~> 2.3)
|
40
|
-
ast (2.4.2)
|
41
|
-
builder (3.2.4)
|
42
|
-
concurrent-ruby (1.1.10)
|
43
|
-
crass (1.0.6)
|
44
|
-
date (3.3.1)
|
45
|
-
diff-lcs (1.5.0)
|
46
|
-
erubi (1.11.0)
|
47
|
-
globalid (1.0.0)
|
48
|
-
activesupport (>= 5.0)
|
49
|
-
i18n (1.12.0)
|
50
|
-
concurrent-ruby (~> 1.0)
|
51
|
-
json (2.6.2)
|
52
|
-
loofah (2.19.1)
|
53
|
-
crass (~> 1.0.2)
|
54
|
-
nokogiri (>= 1.5.9)
|
55
|
-
mail (2.8.0)
|
56
|
-
mini_mime (>= 0.1.1)
|
57
|
-
net-imap
|
58
|
-
net-pop
|
59
|
-
net-smtp
|
60
|
-
method_source (1.0.0)
|
61
|
-
mini_mime (1.1.2)
|
62
|
-
mini_portile2 (2.8.0)
|
63
|
-
minitest (5.16.3)
|
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)
|
74
|
-
mini_portile2 (~> 2.8.0)
|
75
|
-
racc (~> 1.4)
|
76
|
-
nokogiri (1.13.10-x86_64-linux)
|
77
|
-
racc (~> 1.4)
|
78
|
-
parallel (1.22.1)
|
79
|
-
parser (3.1.2.1)
|
80
|
-
ast (~> 2.4.1)
|
81
|
-
racc (1.6.1)
|
82
|
-
rack (2.2.4)
|
83
|
-
rack-test (2.0.2)
|
84
|
-
rack (>= 1.3)
|
85
|
-
rails-dom-testing (2.0.3)
|
86
|
-
activesupport (>= 4.2.0)
|
87
|
-
nokogiri (>= 1.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)
|
93
|
-
method_source
|
94
|
-
rake (>= 12.2)
|
95
|
-
thor (~> 1.0)
|
96
|
-
rainbow (3.1.1)
|
97
|
-
rake (13.0.6)
|
98
|
-
regexp_parser (2.6.0)
|
99
|
-
rexml (3.2.5)
|
100
|
-
rspec (3.12.0)
|
101
|
-
rspec-core (~> 3.12.0)
|
102
|
-
rspec-expectations (~> 3.12.0)
|
103
|
-
rspec-mocks (~> 3.12.0)
|
104
|
-
rspec-core (3.12.0)
|
105
|
-
rspec-support (~> 3.12.0)
|
106
|
-
rspec-expectations (3.12.0)
|
107
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
108
|
-
rspec-support (~> 3.12.0)
|
109
|
-
rspec-mocks (3.12.0)
|
110
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
111
|
-
rspec-support (~> 3.12.0)
|
112
|
-
rspec-support (3.12.0)
|
113
|
-
rubocop (1.38.0)
|
114
|
-
json (~> 2.3)
|
115
|
-
parallel (~> 1.10)
|
116
|
-
parser (>= 3.1.2.1)
|
117
|
-
rainbow (>= 2.2.2, < 4.0)
|
118
|
-
regexp_parser (>= 1.8, < 3.0)
|
119
|
-
rexml (>= 3.2.5, < 4.0)
|
120
|
-
rubocop-ast (>= 1.23.0, < 2.0)
|
121
|
-
ruby-progressbar (~> 1.7)
|
122
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
123
|
-
rubocop-ast (1.23.0)
|
124
|
-
parser (>= 3.1.1.0)
|
125
|
-
ruby-progressbar (1.11.0)
|
126
|
-
thor (1.2.1)
|
127
|
-
timeout (0.3.1)
|
128
|
-
tzinfo (2.0.5)
|
129
|
-
concurrent-ruby (~> 1.0)
|
130
|
-
unicode-display_width (2.3.0)
|
131
|
-
zeitwerk (2.6.6)
|
132
|
-
|
133
|
-
PLATFORMS
|
134
|
-
-darwin-21
|
135
|
-
x86_64-linux
|
136
|
-
|
137
|
-
DEPENDENCIES
|
138
|
-
gravity_mailbox!
|
139
|
-
rake (~> 13.0)
|
140
|
-
rspec
|
141
|
-
rubocop
|
142
|
-
|
143
|
-
BUNDLED WITH
|
144
|
-
2.2.3
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'gravity_mailbox'
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/gravity_mailbox.gemspec
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'lib/gravity_mailbox/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'gravity_mailbox'
|
7
|
-
spec.version = GravityMailbox::VERSION
|
8
|
-
spec.authors = ['Jean-Francis Bastien']
|
9
|
-
spec.email = ['jfbastien@petalmd.com']
|
10
|
-
|
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.'
|
14
|
-
spec.homepage = 'https://github.com/petalmd/gravity_mailbox'
|
15
|
-
spec.license = 'MIT'
|
16
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
17
|
-
|
18
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
-
spec.metadata['source_code_uri'] = 'https://github.com/petalmd/gravity_mailbox'
|
20
|
-
spec.metadata['changelog_uri'] = 'https://github.com/petalmd/gravity_mailbox/blob/main/CHANGELOG.md'
|
21
|
-
|
22
|
-
# Specify which files should be added to the gem when it is released.
|
23
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
26
|
-
end
|
27
|
-
spec.bindir = 'exe'
|
28
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
-
spec.require_paths = ['lib']
|
30
|
-
|
31
|
-
# Uncomment to register a new dependency of your gem
|
32
|
-
spec.add_dependency 'actionmailer', '>= 5.2'
|
33
|
-
spec.add_dependency 'railties', '>= 5.2'
|
34
|
-
# For more information and examples about making a new gem, checkout our
|
35
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
36
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
37
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module GravityMailbox
|
4
|
-
class MailboxController < ActionController::Base
|
5
|
-
self.view_paths = File.expand_path('templates', __dir__)
|
6
|
-
|
7
|
-
layout 'application'
|
8
|
-
|
9
|
-
before_action :set_mails, only: %i[index]
|
10
|
-
|
11
|
-
def index
|
12
|
-
@part = find_preferred_part(request.format, Mime[:html], Mime[:text]) if @mail
|
13
|
-
return unless params[:part]
|
14
|
-
|
15
|
-
response.content_type = 'text/html'
|
16
|
-
render plain: email_body
|
17
|
-
end
|
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
|
-
|
29
|
-
def delete_all
|
30
|
-
RailsCacheDeliveryMethod.delete_all
|
31
|
-
redirect_to '/gravity_mailbox'
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def find_preferred_part(*formats)
|
37
|
-
formats.each do |format|
|
38
|
-
part = @mail.find_first_mime_type(format)
|
39
|
-
return part if part
|
40
|
-
end
|
41
|
-
|
42
|
-
return unless formats.any? { |f| @mail.mime_type == f }
|
43
|
-
|
44
|
-
@mail
|
45
|
-
end
|
46
|
-
|
47
|
-
def email_body
|
48
|
-
@mail.part[1].body.decoded
|
49
|
-
end
|
50
|
-
|
51
|
-
def set_mails
|
52
|
-
@mails = RailsCacheDeliveryMethod.mails
|
53
|
-
@mail = @mails.detect { |m| m.message_id == params[:id] } if params[:id]
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'mailbox_controller'
|
4
|
-
|
5
|
-
module GravityMailbox
|
6
|
-
class Railtie < ::Rails::Railtie # :nodoc:
|
7
|
-
initializer 'gravity_mailbox.add_delivery_method' do
|
8
|
-
ActiveSupport.on_load :action_mailer do
|
9
|
-
ActionMailer::Base.add_delivery_method(
|
10
|
-
:gravity_mailbox_rails_cache,
|
11
|
-
RailsCacheDeliveryMethod
|
12
|
-
)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
config.after_initialize do |app|
|
17
|
-
app.routes.prepend do
|
18
|
-
get '/gravity_mailbox' => 'gravity_mailbox/mailbox#index', internal: true
|
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
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,51 +0,0 @@
|
|
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>
|
@@ -1,111 +0,0 @@
|
|
1
|
-
<% content_for :style do %>
|
2
|
-
body, iframe {
|
3
|
-
height: 100vh;
|
4
|
-
}
|
5
|
-
|
6
|
-
iframe {
|
7
|
-
border: 0;
|
8
|
-
width: 100%;
|
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
|
-
}
|
33
|
-
<% end %>
|
34
|
-
|
35
|
-
<div class="columns mb-0 mt-0">
|
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>
|
68
|
-
</div>
|
69
|
-
|
70
|
-
<% @mails.each_with_index do |mail, index| %>
|
71
|
-
<%= render partial: 'mail', locals: { mail: mail, index: index } %>
|
72
|
-
<% end %>
|
73
|
-
</div>
|
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>
|
76
|
-
</div>
|
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>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta name="viewport" content="width=device-width" />
|
5
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
6
|
-
|
7
|
-
<style>
|
8
|
-
<%= yield :style %>
|
9
|
-
</style>
|
10
|
-
</head>
|
11
|
-
<body>
|
12
|
-
<%= yield %>
|
13
|
-
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
|
14
|
-
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
|
15
|
-
</body>
|
16
|
-
</html>
|