virtual_mails 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 95c78fd039a202cc8274cee3fd343d94acbddf41
4
- data.tar.gz: 4a72d707071b8d5a3d4499e7fc760febf22501a7
3
+ metadata.gz: cf0fc2a0b32a73be32e8a34e7d0d97439f88595e
4
+ data.tar.gz: aa594ea4eedc11af74541d99be7ca54e3fa1201e
5
5
  SHA512:
6
- metadata.gz: 723c2e8f54eaf208dcf1e6686ad1a502a8cbf6d6f7497b07ad7f0911f8ef36276348a9fa42dde88817a2ce153a1ada973a081956162423e8623c2dd0bf45d64f
7
- data.tar.gz: 50f94c8f22f4c1c3b4dbe0b77ee747792724196b59502e67bb5931ac325850777e9a104d6fdd08c03172ad810b5a731acf1261fd4a1c9c9ed9facf092c3e7c9a
6
+ metadata.gz: 30f3c2b542920db7c70a54c7549b25e371ccf16faaad4317696af1d9bb529d66c1e68913a7a47ea20546394df5e2603523ef4af52b040b22b834f4b9375638d7
7
+ data.tar.gz: 3cd93a12e797542e2faeb8c06587d0f5d1b3f15e2020aa1fd316b2c08864a9f14208a517239f3f94ece5145fb689ce90bc6274fc84e257a50b2b3618dc01042c
data/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
- # v0.1.2 / 2016-03-22
2
-
3
- * Fixed date display bug.
4
- * Changed ordering of mails from new to old.
5
-
6
- # v0.1.1 / 2015-09-16
7
-
8
- Fixed namespace bug.
9
-
10
- # v0.1.0 / 2015-09-15
11
-
12
- Create project
1
+ # Change Log
2
+
3
+ ## v0.1.3 / 2017-03-09
4
+ ### Fixed
5
+ - csrf issue.
6
+
7
+ ## v0.1.2 / 2016-03-22
8
+ ### Fixed
9
+ - date display bug.
10
+
11
+ ### Changed
12
+ - ordering of mails from new to old.
13
+
14
+ ## v0.1.1 / 2015-09-16
15
+ ### Fixed
16
+ - namespace bug.
17
+
18
+ ## v0.1.0 / 2015-09-15
19
+ ### Added
20
+ - create project.
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Chen Yi-Cyuan
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2017 Chen, Yi-Cyuan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,48 +1,48 @@
1
- # Virtual Mails
2
-
3
- [![Build Status](https://api.travis-ci.org/emn178/virtual_mails.png)](https://travis-ci.org/emn178/virtual_mails)
4
- [![Coverage Status](https://coveralls.io/repos/emn178/virtual_mails/badge.svg?branch=master)](https://coveralls.io/r/emn178/virtual_mails?branch=master)
5
-
6
- A rails plugin that provides a virtual mail box and action mailer delivery method. You can send mail to this virtual mail box instead of real email service in development environment, and you can preview the emails in this virtual mail box in web page.
7
-
8
- ![image](https://cloud.githubusercontent.com/assets/3477613/13945269/e3e73f18-f046-11e5-9294-efcdba74b33c.png)
9
- ![image](https://cloud.githubusercontent.com/assets/3477613/13945579/6addb7fc-f049-11e5-8af0-91b92cae542e.png)
10
-
11
- ## Installation
12
-
13
- Add this line to your application's Gemfile:
14
-
15
- ```ruby
16
- gem 'virtual_mails', group: :development
17
- ```
18
- Make sure you have:
19
- ```ruby
20
- gem 'jquery-rails'
21
- ```
22
-
23
- And then execute:
24
-
25
- bundle
26
-
27
- ### Route
28
- Add virtual mail box route in your `config/route.rb`
29
- ```Ruby
30
- mount VirtualMails::Engine => "/virtual_mails" if Rails.env.development?
31
- ```
32
-
33
- ### Delivery Method
34
- Set up delivery method of action mailer in your `config/environments/developmnet.rb`
35
- ```Ruby
36
- config.action_mailer.delivery_method = :virtual
37
- ```
38
-
39
- ## Usage
40
- Now, you can go to http://localhost:3000/virtual_mails and check the emails!
41
-
42
- ## License
43
-
44
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
45
-
46
- ## Contact
47
- The project's website is located at https://github.com/emn178/virtual_mails
48
- Author: emn178@gmail.com
1
+ # Virtual Mails
2
+
3
+ [![Build Status](https://api.travis-ci.org/emn178/virtual_mails.png)](https://travis-ci.org/emn178/virtual_mails)
4
+ [![Coverage Status](https://coveralls.io/repos/emn178/virtual_mails/badge.svg?branch=master)](https://coveralls.io/r/emn178/virtual_mails?branch=master)
5
+
6
+ A rails plugin that provides a virtual mail box and action mailer delivery method. You can send mail to this virtual mail box instead of real email service in development environment, and you can preview the emails in this virtual mail box in web page.
7
+
8
+ ![image](https://cloud.githubusercontent.com/assets/3477613/13945269/e3e73f18-f046-11e5-9294-efcdba74b33c.png)
9
+ ![image](https://cloud.githubusercontent.com/assets/3477613/13945579/6addb7fc-f049-11e5-8af0-91b92cae542e.png)
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'virtual_mails', group: :development
17
+ ```
18
+ Make sure you have:
19
+ ```ruby
20
+ gem 'jquery-rails'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ bundle
26
+
27
+ ### Route
28
+ Add virtual mail box route in your `config/route.rb`
29
+ ```Ruby
30
+ mount VirtualMails::Engine => "/virtual_mails" if Rails.env.development?
31
+ ```
32
+
33
+ ### Delivery Method
34
+ Set up delivery method of action mailer in your `config/environments/developmnet.rb`
35
+ ```Ruby
36
+ config.action_mailer.delivery_method = :virtual
37
+ ```
38
+
39
+ ## Usage
40
+ Now, you can go to http://localhost:3000/virtual_mails and check the emails!
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
45
+
46
+ ## Contact
47
+ The project's website is located at https://github.com/emn178/virtual_mails
48
+ Author: Chen, Yi-Cyuan (emn178@gmail.com)
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -1,19 +1,19 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .
16
-
17
- function resizeIframe(iframe) {
18
- iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
19
- }
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
16
+
17
+ function resizeIframe(iframe) {
18
+ iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
19
+ }
@@ -1,117 +1,117 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
16
-
17
- /* http://meyerweb.com/eric/tools/css/reset/
18
- v2.0 | 20110126
19
- License: none (public domain)
20
- */
21
-
22
- html, body, div, span, applet, object, iframe,
23
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
24
- a, abbr, acronym, address, big, cite, code,
25
- del, dfn, em, img, ins, kbd, q, s, samp,
26
- small, strike, strong, sub, sup, tt, var,
27
- b, u, i, center,
28
- dl, dt, dd, ol, ul, li,
29
- fieldset, form, label, legend,
30
- table, caption, tbody, tfoot, thead, tr, th, td,
31
- article, aside, canvas, details, embed,
32
- figure, figcaption, footer, header, hgroup,
33
- menu, nav, output, ruby, section, summary,
34
- time, mark, audio, video {
35
- margin: 0;
36
- padding: 0;
37
- border: 0;
38
- font-size: 100%;
39
- font: inherit;
40
- vertical-align: baseline;
41
- }
42
- /* HTML5 display-role reset for older browsers */
43
- article, aside, details, figcaption, figure,
44
- footer, header, hgroup, menu, nav, section {
45
- display: block;
46
- }
47
- body {
48
- line-height: 1;
49
- }
50
- ol, ul {
51
- list-style: none;
52
- }
53
- blockquote, q {
54
- quotes: none;
55
- }
56
- blockquote:before, blockquote:after,
57
- q:before, q:after {
58
- content: '';
59
- content: none;
60
- }
61
- table {
62
- border-collapse: collapse;
63
- border-spacing: 0;
64
- }
65
-
66
- body {
67
- font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
68
- font-size: 14px;
69
- line-height: 1.42857143;
70
- color: #333;
71
- margin: 0 20px;
72
- }
73
-
74
- h2 {
75
- font-size: 30px;
76
- margin-top: 20px;
77
- margin-bottom: 10px;
78
- font-family: inherit;
79
- font-weight: 500;
80
- line-height: 1.1;
81
- }
82
-
83
- table {
84
- border: 1px solid #ddd;
85
- width: 100%;
86
- max-width: 100%;
87
- border-spacing: 0;
88
- border-collapse: collapse;
89
- }
90
-
91
- tr:nth-of-type(odd) {
92
- background-color: #f9f9f9;
93
- }
94
-
95
- tr:first-child>th {
96
- border-top: 0;
97
- }
98
-
99
- th, td {
100
- border-bottom-width: 2px;
101
- border: 1px solid #ddd;
102
- vertical-align: bottom;
103
- border-bottom: 2px solid #ddd;
104
- padding: 8px;
105
- line-height: 1.42857143;
106
- vertical-align: top;
107
- border-top: 1px solid #ddd;
108
- }
109
-
110
- a {
111
- text-decoration: none;
112
- color: #007CFF;
113
- }
114
-
115
- iframe {
116
- width: 100%;
117
- }
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
16
+
17
+ /* http://meyerweb.com/eric/tools/css/reset/
18
+ v2.0 | 20110126
19
+ License: none (public domain)
20
+ */
21
+
22
+ html, body, div, span, applet, object, iframe,
23
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
24
+ a, abbr, acronym, address, big, cite, code,
25
+ del, dfn, em, img, ins, kbd, q, s, samp,
26
+ small, strike, strong, sub, sup, tt, var,
27
+ b, u, i, center,
28
+ dl, dt, dd, ol, ul, li,
29
+ fieldset, form, label, legend,
30
+ table, caption, tbody, tfoot, thead, tr, th, td,
31
+ article, aside, canvas, details, embed,
32
+ figure, figcaption, footer, header, hgroup,
33
+ menu, nav, output, ruby, section, summary,
34
+ time, mark, audio, video {
35
+ margin: 0;
36
+ padding: 0;
37
+ border: 0;
38
+ font-size: 100%;
39
+ font: inherit;
40
+ vertical-align: baseline;
41
+ }
42
+ /* HTML5 display-role reset for older browsers */
43
+ article, aside, details, figcaption, figure,
44
+ footer, header, hgroup, menu, nav, section {
45
+ display: block;
46
+ }
47
+ body {
48
+ line-height: 1;
49
+ }
50
+ ol, ul {
51
+ list-style: none;
52
+ }
53
+ blockquote, q {
54
+ quotes: none;
55
+ }
56
+ blockquote:before, blockquote:after,
57
+ q:before, q:after {
58
+ content: '';
59
+ content: none;
60
+ }
61
+ table {
62
+ border-collapse: collapse;
63
+ border-spacing: 0;
64
+ }
65
+
66
+ body {
67
+ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
68
+ font-size: 14px;
69
+ line-height: 1.42857143;
70
+ color: #333;
71
+ margin: 0 20px;
72
+ }
73
+
74
+ h2 {
75
+ font-size: 30px;
76
+ margin-top: 20px;
77
+ margin-bottom: 10px;
78
+ font-family: inherit;
79
+ font-weight: 500;
80
+ line-height: 1.1;
81
+ }
82
+
83
+ table {
84
+ border: 1px solid #ddd;
85
+ width: 100%;
86
+ max-width: 100%;
87
+ border-spacing: 0;
88
+ border-collapse: collapse;
89
+ }
90
+
91
+ tr:nth-of-type(odd) {
92
+ background-color: #f9f9f9;
93
+ }
94
+
95
+ tr:first-child>th {
96
+ border-top: 0;
97
+ }
98
+
99
+ th, td {
100
+ border-bottom-width: 2px;
101
+ border: 1px solid #ddd;
102
+ vertical-align: bottom;
103
+ border-bottom: 2px solid #ddd;
104
+ padding: 8px;
105
+ line-height: 1.42857143;
106
+ vertical-align: top;
107
+ border-top: 1px solid #ddd;
108
+ }
109
+
110
+ a {
111
+ text-decoration: none;
112
+ color: #007CFF;
113
+ }
114
+
115
+ iframe {
116
+ width: 100%;
117
+ }
@@ -1,2 +1,3 @@
1
- class VirtualMails::ApplicationController < ActionController::Base
2
- end
1
+ class VirtualMails::ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
@@ -1,27 +1,27 @@
1
- module VirtualMails
2
- class EmailsController < VirtualMails::ApplicationController
3
- before_action :find_mail, :only => [:show, :raw]
4
-
5
- def index
6
- @emails = Email.all
7
- end
8
-
9
- def show
10
- end
11
-
12
- def raw
13
- render :plain => @email.raw
14
- end
15
-
16
- def clear
17
- Email.clear
18
- redirect_to emails_path
19
- end
20
-
21
- private
22
-
23
- def find_mail
24
- @email = Email.find(params[:id])
25
- end
26
- end
27
- end
1
+ module VirtualMails
2
+ class EmailsController < VirtualMails::ApplicationController
3
+ before_action :find_mail, :only => [:show, :raw]
4
+
5
+ def index
6
+ @emails = Email.all
7
+ end
8
+
9
+ def show
10
+ end
11
+
12
+ def raw
13
+ render :plain => @email.raw
14
+ end
15
+
16
+ def clear
17
+ Email.clear
18
+ redirect_to emails_path
19
+ end
20
+
21
+ private
22
+
23
+ def find_mail
24
+ @email = Email.find(params[:id])
25
+ end
26
+ end
27
+ end
@@ -1,4 +1,4 @@
1
- module VirtualMails
2
- module ApplicationHelper
3
- end
4
- end
1
+ module VirtualMails
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -1,80 +1,80 @@
1
- module VirtualMails
2
- class Email
3
- include ActionView::Helpers::TagHelper
4
-
5
- attr_accessor :message
6
- delegate :subject, :date, to: :message
7
-
8
- def initialize(message)
9
- @message = message
10
- end
11
-
12
- def id
13
- @message.message_id.split('@')[0]
14
- end
15
-
16
- def from
17
- @message.header.fields.find{|f| f.name == "From"}.value
18
- end
19
-
20
- def to
21
- addresses = @message.header.fields.find{|f| f.name == "To"}.address_list.addresses
22
- address = addresses[0].to_s
23
- count = addresses.length
24
- count > 1 ? address + ", ...#{count - 1} more" : address
25
- end
26
-
27
- def list_to
28
- @message.header.fields.find{|f| f.name == "To"}.value
29
- end
30
-
31
- def body
32
- html || plain
33
- end
34
-
35
- def body_tag
36
- html_tag || plain_tag
37
- end
38
-
39
- def raw
40
- @message.to_s
41
- end
42
-
43
- def self.all
44
- emails = Rails.cache.fetch(CacheKey) do
45
- emails = []
46
- end
47
- emails
48
- end
49
-
50
- def self.find(id)
51
- mail = all.find { |mail| mail.id == id }
52
- raise ActiveRecord::RecordNotFound if mail.nil?
53
- mail
54
- end
55
-
56
- def self.clear
57
- Rails.cache.delete(CacheKey)
58
- end
59
-
60
- private
61
-
62
- def html
63
- @message.html_part ? @message.html_part.body.decoded : nil
64
- end
65
-
66
- def html_tag
67
- content = html
68
- content_tag :iframe, '', :srcdoc => content, :onload => 'resizeIframe(this)' unless content.nil?
69
- end
70
-
71
- def plain
72
- @message.multipart? ? (@message.text_part ? @message.text_part.body.decoded : nil) : @message.body.decoded
73
- end
74
-
75
- def plain_tag
76
- content = plain
77
- content_tag :pre, content unless content.nil?
78
- end
79
- end
80
- end
1
+ module VirtualMails
2
+ class Email
3
+ include ActionView::Helpers::TagHelper
4
+
5
+ attr_accessor :message
6
+ delegate :subject, :date, to: :message
7
+
8
+ def initialize(message)
9
+ @message = message
10
+ end
11
+
12
+ def id
13
+ @message.message_id.split('@')[0]
14
+ end
15
+
16
+ def from
17
+ @message.header.fields.find{|f| f.name == "From"}.value
18
+ end
19
+
20
+ def to
21
+ addresses = @message.header.fields.find{|f| f.name == "To"}.address_list.addresses
22
+ address = addresses[0].to_s
23
+ count = addresses.length
24
+ count > 1 ? address + ", ...#{count - 1} more" : address
25
+ end
26
+
27
+ def list_to
28
+ @message.header.fields.find{|f| f.name == "To"}.value
29
+ end
30
+
31
+ def body
32
+ html || plain
33
+ end
34
+
35
+ def body_tag
36
+ html_tag || plain_tag
37
+ end
38
+
39
+ def raw
40
+ @message.to_s
41
+ end
42
+
43
+ def self.all
44
+ emails = Rails.cache.fetch(CacheKey) do
45
+ emails = []
46
+ end
47
+ emails
48
+ end
49
+
50
+ def self.find(id)
51
+ mail = all.find { |mail| mail.id == id }
52
+ raise ActiveRecord::RecordNotFound if mail.nil?
53
+ mail
54
+ end
55
+
56
+ def self.clear
57
+ Rails.cache.delete(CacheKey)
58
+ end
59
+
60
+ private
61
+
62
+ def html
63
+ @message.html_part ? @message.html_part.body.decoded : nil
64
+ end
65
+
66
+ def html_tag
67
+ content = html
68
+ content_tag :iframe, '', :srcdoc => content, :onload => 'resizeIframe(this)' unless content.nil?
69
+ end
70
+
71
+ def plain
72
+ @message.multipart? ? (@message.text_part ? @message.text_part.body.decoded : nil) : @message.body.decoded
73
+ end
74
+
75
+ def plain_tag
76
+ content = plain
77
+ content_tag :pre, content unless content.nil?
78
+ end
79
+ end
80
+ end
@@ -1,17 +1,17 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html>
3
- <head>
4
- <title>
5
- Virtual Mail Box
6
- </title>
7
- <%= stylesheet_link_tag "virtual_mails/application", media: "all", "data-turbolinks-track" => true %>
8
- <%= javascript_include_tag "virtual_mails/application", "data-turbolinks-track" => true %>
9
- <%= csrf_meta_tags %>
10
- </head>
11
- <body>
12
- <h2>
13
- <%= link_to 'Virtual Mail Box', emails_path %>
14
- </h2>
15
- <%= yield %>
16
- </body>
17
- </html>
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <title>
5
+ Virtual Mail Box
6
+ </title>
7
+ <%= stylesheet_link_tag "virtual_mails/application", media: "all", "data-turbolinks-track" => true %>
8
+ <%= javascript_include_tag "virtual_mails/application", "data-turbolinks-track" => true %>
9
+ <%= csrf_meta_tags %>
10
+ </head>
11
+ <body>
12
+ <h2>
13
+ <%= link_to 'Virtual Mail Box', emails_path %>
14
+ </h2>
15
+ <%= yield %>
16
+ </body>
17
+ </html>
@@ -1,31 +1,31 @@
1
- <%= link_to 'Clear', clear_emails_path, :method => :delete, :data => {:confirm => "Are you sure?"} %>
2
- <table>
3
- <colgroup>
4
- <col width="250px"></col>
5
- <col width="300px"></col>
6
- <col></col>
7
- <col width="200px"></col>
8
- </colgroup>
9
- <tr>
10
- <th>From</th>
11
- <th>To</th>
12
- <th>Subject</th>
13
- <th>Date</th>
14
- </tr>
15
- <% @emails.each do |email| %>
16
- <tr>
17
- <td>
18
- <%= email.from %>
19
- </td>
20
- <td>
21
- <%= email.to %>
22
- </td>
23
- <td>
24
- <%= link_to email.subject, email_path(:id => email.id) %>
25
- </td>
26
- <td>
27
- <%= email.date %>
28
- </td>
29
- </tr>
30
- <% end %>
31
- </table>
1
+ <%= link_to 'Clear', clear_emails_path, :method => :delete, :data => {:confirm => "Are you sure?"} %>
2
+ <table>
3
+ <colgroup>
4
+ <col width="250px"></col>
5
+ <col width="300px"></col>
6
+ <col></col>
7
+ <col width="200px"></col>
8
+ </colgroup>
9
+ <tr>
10
+ <th>From</th>
11
+ <th>To</th>
12
+ <th>Subject</th>
13
+ <th>Date</th>
14
+ </tr>
15
+ <% @emails.each do |email| %>
16
+ <tr>
17
+ <td>
18
+ <%= email.from %>
19
+ </td>
20
+ <td>
21
+ <%= email.to %>
22
+ </td>
23
+ <td>
24
+ <%= link_to email.subject, email_path(:id => email.id) %>
25
+ </td>
26
+ <td>
27
+ <%= email.date %>
28
+ </td>
29
+ </tr>
30
+ <% end %>
31
+ </table>
@@ -1,37 +1,37 @@
1
- <table>
2
- <tr>
3
- <th>Subject</th>
4
- <td>
5
- <%= @email.subject %>
6
- <%= link_to '(Raw)', raw_email_path(:id => @email.id), :target => 'raw' %>
7
- </td>
8
- </tr>
9
- <tr>
10
- <th>From</th>
11
- <td>
12
- <%= @email.from %>
13
- </td>
14
- </tr>
15
- <tr>
16
- <th>Date</th>
17
- <td>
18
- <%= @email.date %>
19
- </td>
20
- </tr>
21
- <tr>
22
- <th>To</th>
23
- <td>
24
- <%= @email.list_to %>
25
- </td>
26
- </tr>
27
- <tr>
28
- <th colspan="2">
29
- Body
30
- </th>
31
- </tr>
32
- <tr>
33
- <td colspan="2">
34
- <%= @email.body_tag %>
35
- </td>
36
- </tr>
37
- </table>
1
+ <table>
2
+ <tr>
3
+ <th>Subject</th>
4
+ <td>
5
+ <%= @email.subject %>
6
+ <%= link_to '(Raw)', raw_email_path(:id => @email.id), :target => 'raw' %>
7
+ </td>
8
+ </tr>
9
+ <tr>
10
+ <th>From</th>
11
+ <td>
12
+ <%= @email.from %>
13
+ </td>
14
+ </tr>
15
+ <tr>
16
+ <th>Date</th>
17
+ <td>
18
+ <%= @email.date %>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <th>To</th>
23
+ <td>
24
+ <%= @email.list_to %>
25
+ </td>
26
+ </tr>
27
+ <tr>
28
+ <th colspan="2">
29
+ Body
30
+ </th>
31
+ </tr>
32
+ <tr>
33
+ <td colspan="2">
34
+ <%= @email.body_tag %>
35
+ </td>
36
+ </tr>
37
+ </table>
data/config/routes.rb CHANGED
@@ -1,10 +1,10 @@
1
- VirtualMails::Engine.routes.draw do
2
- resources :emails, :path => '/', :only => [:index, :show] do
3
- member do
4
- get 'raw'
5
- end
6
- collection do
7
- delete 'clear'
8
- end
9
- end
10
- end
1
+ VirtualMails::Engine.routes.draw do
2
+ resources :emails, :path => '/', :only => [:index, :show] do
3
+ member do
4
+ get 'raw'
5
+ end
6
+ collection do
7
+ delete 'clear'
8
+ end
9
+ end
10
+ end
data/config/spring.rb CHANGED
@@ -1 +1 @@
1
- Spring.application_root = './spec/dummy'
1
+ Spring.application_root = './spec/dummy'
@@ -1,4 +1,4 @@
1
- # desc "Explaining what the task does"
2
- # task :virtual_mails do
3
- # # Task goes here
4
- # end
1
+ # desc "Explaining what the task does"
2
+ # task :virtual_mails do
3
+ # # Task goes here
4
+ # end
data/lib/virtual_mails.rb CHANGED
@@ -1,8 +1,8 @@
1
- require "virtual_mails/engine"
2
- require "virtual_mails/mailer"
3
-
4
- module VirtualMails
5
- CacheKey = 'virtual_mails'
6
-
7
- ActionMailer::Base.add_delivery_method :virtual, Mailer
8
- end
1
+ require "virtual_mails/engine"
2
+ require "virtual_mails/mailer"
3
+
4
+ module VirtualMails
5
+ CacheKey = 'virtual_mails'
6
+
7
+ ActionMailer::Base.add_delivery_method :virtual, Mailer
8
+ end
@@ -1,5 +1,5 @@
1
- module VirtualMails
2
- class Engine < ::Rails::Engine
3
- isolate_namespace VirtualMails
4
- end
5
- end
1
+ module VirtualMails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace VirtualMails
4
+ end
5
+ end
@@ -1,15 +1,15 @@
1
- module VirtualMails
2
- class Mailer
3
- attr_accessor :settings
4
-
5
- def initialize(settings)
6
- self.settings = settings
7
- end
8
-
9
- def deliver!(mail)
10
- mails = Email.all
11
- mails.unshift(Email.new(mail))
12
- Rails.cache.write(CacheKey, mails)
13
- end
14
- end
15
- end
1
+ module VirtualMails
2
+ class Mailer
3
+ attr_accessor :settings
4
+
5
+ def initialize(settings)
6
+ self.settings = settings
7
+ end
8
+
9
+ def deliver!(mail)
10
+ mails = Email.all
11
+ mails.unshift(Email.new(mail))
12
+ Rails.cache.write(CacheKey, mails)
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
- module VirtualMails
2
- VERSION = "0.1.2"
3
- end
1
+ module VirtualMails
2
+ VERSION = "0.1.3"
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtual_mails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chen, Yi-Cyuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-22 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 2.4.8
187
+ rubygems_version: 2.5.1
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: A rails plugin that provides a virtual mail box and action mailer delivery