email_preview 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.0
@@ -5,7 +5,7 @@
5
5
  </head>
6
6
  <body>
7
7
  <frameset cols="20%,*">
8
- <frame src="<%= list_email_preview_index_path %>" name="listing" />
8
+ <frame src="<%= navigation_email_preview_index_path %>" name="listing" />
9
9
  <frame name="render" />
10
10
  </frameset>
11
11
  </body>
@@ -0,0 +1,5 @@
1
+ <ul>
2
+ <% EmailPreview.emails.each_index do |index| %>
3
+ <li><%= link_to EmailPreview.emails[index][:description], email_preview_path(index), :target => 'render' %>
4
+ <% end%>
5
+ </ul>
@@ -19,9 +19,7 @@
19
19
  <% end %>
20
20
  <h2>Message Headers</h2>
21
21
  <pre class='headers'>
22
- <% @mail.header_fields.each do |header| %>
23
- <%= header.name %>: <%= header.decoded %>
24
- <% end %>
22
+ <%= @mail.header_fields.collect { |header| "#{header.name}: #{header.decoded}\n"}%>
25
23
  </pre>
26
24
  <!--
27
25
  <h3>Debug output</h3>
data/config/routes.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  Rails.application.routes.draw do |map|
2
2
  resources :email_preview, :controller => 'email_preview', :only => [:index, :show] do
3
3
  collection do
4
- get :list
4
+ get :navigation
5
5
  end
6
6
  member do
7
7
  post :deliver
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{email_preview}
8
- s.version = "0.3.1"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Sonnek"]
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "app/controllers/email_preview_controller.rb",
27
27
  "app/views/email_preview/index.html.erb",
28
- "app/views/email_preview/list.html.erb",
28
+ "app/views/email_preview/navigation.html.erb",
29
29
  "app/views/email_preview/show.html.erb",
30
30
  "config/routes.rb",
31
31
  "email_preview.gemspec",
data/lib/email_preview.rb CHANGED
@@ -11,14 +11,12 @@ module EmailPreview
11
11
  @allowed_environments ||= ['development', 'test']
12
12
  @allowed_environments
13
13
  end
14
- def register(key, &block)
15
- self.emails ||= {}
16
- self.emails[key] = block
14
+ def register(description, &block)
15
+ self.emails ||= []
16
+ self.emails << {:description => description, :block => block }
17
17
  end
18
- def preview(key)
19
- puts self.emails[key]
20
- block = self.emails[key]
21
- block.call
18
+ def preview(index)
19
+ self.emails[index.to_i][:block].call
22
20
  end
23
21
  end
24
22
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_preview
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -66,7 +66,7 @@ files:
66
66
  - VERSION
67
67
  - app/controllers/email_preview_controller.rb
68
68
  - app/views/email_preview/index.html.erb
69
- - app/views/email_preview/list.html.erb
69
+ - app/views/email_preview/navigation.html.erb
70
70
  - app/views/email_preview/show.html.erb
71
71
  - config/routes.rb
72
72
  - email_preview.gemspec
@@ -1,5 +0,0 @@
1
- <ul>
2
- <% EmailPreview.emails.keys.sort.each do |key| %>
3
- <li><%= link_to key, email_preview_path(key), :target => 'render' %>
4
- <% end%>
5
- </ul>