mail_view 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mail_view/email.html.erb +88 -0
- data/lib/mail_view/index.html.erb +5 -0
- data/lib/mail_view/mapper.rb +20 -0
- metadata +4 -1
@@ -0,0 +1,88 @@
|
|
1
|
+
<head>
|
2
|
+
<meta http-equiv="Content-Type" content="text/html; charset=<%= body_part.charset %>" />
|
3
|
+
</head>
|
4
|
+
<style type="text/css">
|
5
|
+
#message_headers {
|
6
|
+
position: absolute;
|
7
|
+
top: 0px;
|
8
|
+
left: 0;
|
9
|
+
width: 100%;
|
10
|
+
height: 85px;
|
11
|
+
padding: 10px 0 0 0;
|
12
|
+
margin: 0;
|
13
|
+
background: #fff;
|
14
|
+
font-size: 12px;
|
15
|
+
font-family: "Lucida Grande";
|
16
|
+
border-bottom: 1px solid #dedede;
|
17
|
+
overflow: hidden;
|
18
|
+
}
|
19
|
+
|
20
|
+
#message_headers dl {
|
21
|
+
margin: 0;
|
22
|
+
padding: 0;
|
23
|
+
}
|
24
|
+
|
25
|
+
#message_headers dt {
|
26
|
+
width: 60px;
|
27
|
+
padding: 1px;
|
28
|
+
float: left;
|
29
|
+
text-align: right;
|
30
|
+
font-weight: bold;
|
31
|
+
color: #7f7f7f;
|
32
|
+
}
|
33
|
+
|
34
|
+
#message_headers dd {
|
35
|
+
margin-left: 70px;
|
36
|
+
padding: 1px;
|
37
|
+
}
|
38
|
+
|
39
|
+
#message_headers p.alternate {
|
40
|
+
position: absolute;
|
41
|
+
top: 0;
|
42
|
+
right: 15px;
|
43
|
+
}
|
44
|
+
|
45
|
+
#message_headers p.alternate a {
|
46
|
+
color: #09c;
|
47
|
+
}
|
48
|
+
|
49
|
+
pre#message_body {
|
50
|
+
padding: 10px;
|
51
|
+
white-space: pre-wrap;
|
52
|
+
}
|
53
|
+
|
54
|
+
body {
|
55
|
+
margin-top: 96px;
|
56
|
+
}
|
57
|
+
</style>
|
58
|
+
<div id="message_headers">
|
59
|
+
<dl>
|
60
|
+
<dt>From:</dt>
|
61
|
+
<dd><%= mail.from %></dd>
|
62
|
+
|
63
|
+
<dt>Subject:</dt>
|
64
|
+
<dd><strong><%= mail.subject %></strong></dd>
|
65
|
+
|
66
|
+
<dt>Date:</dt>
|
67
|
+
<dd><%= Time.now.strftime("%b %e, %Y %I:%M:%S %p %Z") %></dd>
|
68
|
+
|
69
|
+
<dt>To:</dt>
|
70
|
+
<dd><%= mail.to %></dd>
|
71
|
+
</dl>
|
72
|
+
|
73
|
+
<% if mail.multipart? %>
|
74
|
+
<p class="alternate">
|
75
|
+
<% if body_part.content_type && body_part.content_type.match(/text\/html/) %>
|
76
|
+
<a href="<%= name %>.txt">View plain text version</a>
|
77
|
+
<% else %>
|
78
|
+
<a href="<%= name %>.html">View HTML version</a>
|
79
|
+
<% end %>
|
80
|
+
</p>
|
81
|
+
<% end %>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<% if body_part.content_type && body_part.content_type.match(/text\/html/) %>
|
85
|
+
<%= body_part.body %>
|
86
|
+
<% else %>
|
87
|
+
<pre id="message_body"><%= body_part.body %></pre>
|
88
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class MailView
|
2
|
+
class Mapper
|
3
|
+
def initialize(app, controller, prefix = "/mail_view")
|
4
|
+
@app = app
|
5
|
+
@controller = controller.respond_to?(:name) ? controller.name : controller.to_s
|
6
|
+
@prefix = Regexp.compile("^#{prefix}")
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
if env["PATH_INFO"].to_s =~ @prefix
|
11
|
+
env["SCRIPT_NAME"] = $&
|
12
|
+
env["PATH_INFO"] = $'
|
13
|
+
|
14
|
+
@controller.constantize.call(env)
|
15
|
+
else
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -18,6 +18,9 @@ extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
20
|
- ./lib/mail_view.rb
|
21
|
+
- ./lib/mail_view/email.html.erb
|
22
|
+
- ./lib/mail_view/index.html.erb
|
23
|
+
- ./lib/mail_view/mapper.rb
|
21
24
|
- ./test/test_mail_view.rb
|
22
25
|
homepage: https://github.com/37signals/mail_view
|
23
26
|
licenses: []
|