easy_mail_preview 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +22 -0
- data/Gemfile.lock +75 -0
- data/MIT-LICENSE +20 -0
- data/README.md +60 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/app/assets/images/easy_mail_preview/.gitkeep +0 -0
- data/app/assets/javascripts/easy_mail_preview/application.js +15 -0
- data/app/assets/javascripts/easy_mail_preview/emails.js +53 -0
- data/app/assets/stylesheets/easy_mail_preview/application.css +26 -0
- data/app/assets/stylesheets/easy_mail_preview/emails.scss +48 -0
- data/app/controllers/easy_mail_preview/application_controller.rb +4 -0
- data/app/controllers/easy_mail_preview/emails_controller.rb +23 -0
- data/app/helpers/easy_mail_preview/application_helper.rb +4 -0
- data/app/helpers/easy_mail_preview/emails_helper.rb +4 -0
- data/app/views/easy_mail_preview/emails/index.html.erb +59 -0
- data/app/views/layouts/easy_mail_preview/application.html.erb +14 -0
- data/config/routes.rb +4 -0
- data/easy_mail_preview.gemspec +109 -0
- data/lib/easy_mail_preview/engine.rb +5 -0
- data/lib/easy_mail_preview/version.rb +3 -0
- data/lib/easy_mail_preview.rb +59 -0
- data/lib/tasks/easy_mail_preview_tasks.rake +4 -0
- data/screenshot.jpg +0 -0
- data/script/rails +8 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +56 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/easy_mail_preview_test.rb +7 -0
- data/test/functional/easy_mail_preview/emails_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/easy_mail_preview/emails_helper_test.rb +6 -0
- metadata +175 -0
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in easy_mail_preview.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# jquery-rails is used by the dummy application
|
9
|
+
gem "jquery-rails"
|
10
|
+
|
11
|
+
# Declare any dependencies that are still in development here instead of in
|
12
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
+
# your gem to rubygems.org.
|
15
|
+
|
16
|
+
# To use debugger
|
17
|
+
# gem 'ruby-debug19', :require => 'ruby-debug'
|
18
|
+
|
19
|
+
group :development do
|
20
|
+
gem "jeweler", "~> 1.8.3"
|
21
|
+
end
|
22
|
+
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
easy_mail_preview (0.1.0)
|
5
|
+
easy_mail_preview
|
6
|
+
jquery-rails
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (3.2.5)
|
12
|
+
activemodel (= 3.2.5)
|
13
|
+
activesupport (= 3.2.5)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
erubis (~> 2.7.0)
|
16
|
+
journey (~> 1.0.1)
|
17
|
+
rack (~> 1.4.0)
|
18
|
+
rack-cache (~> 1.2)
|
19
|
+
rack-test (~> 0.6.1)
|
20
|
+
sprockets (~> 2.1.3)
|
21
|
+
activemodel (3.2.5)
|
22
|
+
activesupport (= 3.2.5)
|
23
|
+
builder (~> 3.0.0)
|
24
|
+
activesupport (3.2.5)
|
25
|
+
i18n (~> 0.6)
|
26
|
+
multi_json (~> 1.0)
|
27
|
+
builder (3.0.0)
|
28
|
+
erubis (2.7.0)
|
29
|
+
git (1.2.5)
|
30
|
+
hike (1.2.1)
|
31
|
+
i18n (0.6.0)
|
32
|
+
jeweler (1.8.3)
|
33
|
+
bundler (~> 1.0)
|
34
|
+
git (>= 1.2.5)
|
35
|
+
rake
|
36
|
+
rdoc
|
37
|
+
journey (1.0.3)
|
38
|
+
jquery-rails (2.0.2)
|
39
|
+
railties (>= 3.2.0, < 5.0)
|
40
|
+
thor (~> 0.14)
|
41
|
+
json (1.7.3)
|
42
|
+
multi_json (1.3.6)
|
43
|
+
rack (1.4.1)
|
44
|
+
rack-cache (1.2)
|
45
|
+
rack (>= 0.4)
|
46
|
+
rack-ssl (1.3.2)
|
47
|
+
rack
|
48
|
+
rack-test (0.6.1)
|
49
|
+
rack (>= 1.0)
|
50
|
+
railties (3.2.5)
|
51
|
+
actionpack (= 3.2.5)
|
52
|
+
activesupport (= 3.2.5)
|
53
|
+
rack-ssl (~> 1.3.2)
|
54
|
+
rake (>= 0.8.7)
|
55
|
+
rdoc (~> 3.4)
|
56
|
+
thor (>= 0.14.6, < 2.0)
|
57
|
+
rake (0.9.2.2)
|
58
|
+
rdoc (3.12)
|
59
|
+
json (~> 1.4)
|
60
|
+
sprockets (2.1.3)
|
61
|
+
hike (~> 1.2)
|
62
|
+
rack (~> 1.0)
|
63
|
+
tilt (~> 1.1, != 1.3.0)
|
64
|
+
sqlite3 (1.3.6)
|
65
|
+
thor (0.15.2)
|
66
|
+
tilt (1.3.3)
|
67
|
+
|
68
|
+
PLATFORMS
|
69
|
+
ruby
|
70
|
+
|
71
|
+
DEPENDENCIES
|
72
|
+
easy_mail_preview!
|
73
|
+
jeweler (~> 1.8.3)
|
74
|
+
jquery-rails
|
75
|
+
sqlite3
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 This Life, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
EasyMailPreview
|
2
|
+
===============
|
3
|
+
|
4
|
+
EasyMailPreview is a Rails tool that makes it easy to get previews of
|
5
|
+
your HTML emails in development. It is designed to offer as much power
|
6
|
+
as possible with a minimum of configuration.
|
7
|
+
|
8
|
+
Inspired in part by RailsEmailPreview:
|
9
|
+
https://github.com/glebm/rails_email_preview
|
10
|
+
|
11
|
+
Security Note
|
12
|
+
-------------
|
13
|
+
|
14
|
+
EasyMailPreview is only intended to be used in development mode. The
|
15
|
+
instructions below tell you how to do that. You really shouldn't run it
|
16
|
+
in any other mode.
|
17
|
+
|
18
|
+
If you care about the details: To save you the trouble of having to
|
19
|
+
create factory methods for emails you'd like to preview, EasyMailPreview
|
20
|
+
takes Ruby strings as arguments in HTTP GET requests and eval's them
|
21
|
+
inside of the Rails server. If you were to expose this in a publically
|
22
|
+
available site it would be trivially easy for somebody else to use it to
|
23
|
+
destroy your data. Please don't do that.
|
24
|
+
|
25
|
+
Usage
|
26
|
+
-----
|
27
|
+
|
28
|
+
Include the Gem in your Gemfile:
|
29
|
+
|
30
|
+
gem 'easy_mail_preview'
|
31
|
+
|
32
|
+
Specify which mailer classes you'd like to use for previewing in
|
33
|
+
`config/initializers/easy_mail_preview`:
|
34
|
+
|
35
|
+
require 'easy_mail_preview'
|
36
|
+
|
37
|
+
EasyMailPreview.setup do |config|
|
38
|
+
config.mailers = [
|
39
|
+
MessageMailer, LifecycleMailer, ExpirationMailer
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
Mount the app in `config/routes`. *Important*: you should only do this in
|
44
|
+
development mode.
|
45
|
+
|
46
|
+
if Rails.env.development?
|
47
|
+
mount EasyMailPreview::Engine, :at => 'email_previews'
|
48
|
+
end
|
49
|
+
|
50
|
+
Start up your Rails server and go to your URL:
|
51
|
+
|
52
|
+
![Screenshot](https://raw.github.com/howaboutwe/easy_mail_preview/master/screenshot.jpg)
|
53
|
+
|
54
|
+
That's it! You will be able to select mailer classes, mail methods, and
|
55
|
+
then fill in arguments to pass to the mail method.
|
56
|
+
|
57
|
+
Copyright
|
58
|
+
---------
|
59
|
+
|
60
|
+
Copyright (c) 2012 HowAboutWe. See MIT-LICENSE for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'EasyMailPreview'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
require 'jeweler'
|
40
|
+
Jeweler::Tasks.new do |gem|
|
41
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
42
|
+
gem.name = "easy_mail_preview"
|
43
|
+
gem.homepage = "http://github.com/howaboutwe/easy_mail_preview"
|
44
|
+
gem.license = "MIT"
|
45
|
+
gem.summary = %Q{Easy previews of HTML emails for your Rails app.}
|
46
|
+
gem.description = %Q{Easy previews of HTML emails for your Rails app.}
|
47
|
+
gem.email = "dev@howaboutwe.com"
|
48
|
+
gem.authors = ["HowAboutWe"]
|
49
|
+
# dependencies defined in Gemfile
|
50
|
+
end
|
51
|
+
Jeweler::RubygemsDotOrgTasks.new
|
52
|
+
|
53
|
+
task :default => :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
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 vendor/assets/javascripts of plugins, if any, 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
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,53 @@
|
|
1
|
+
EasyMailPreview = {
|
2
|
+
mailerAndMethod: function() {
|
3
|
+
return EasyMailPreview.selectedMailer() + '_' + EasyMailPreview.selectedMethod();
|
4
|
+
},
|
5
|
+
|
6
|
+
preview: function(evt) {
|
7
|
+
url = EasyMailPreview.rootPath + "emails/show/";
|
8
|
+
url += EasyMailPreview.mailerAndMethod();
|
9
|
+
var argCount =
|
10
|
+
$(EasyMailPreview.selectedMethodArgumentsSelector() + ' input').length;
|
11
|
+
if (argCount > 0) {
|
12
|
+
url += "?";
|
13
|
+
for (var i = 0; i < argCount; i++) {
|
14
|
+
evalString =
|
15
|
+
$('input[name=mail_methods_' + EasyMailPreview.mailerAndMethod() + '_' + i + ']').val();
|
16
|
+
if (i > 0) url += '&';
|
17
|
+
url += "arg_" + i + "=" + escape(evalString);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
$('#preview_frame').attr('src', url);
|
21
|
+
return false;
|
22
|
+
},
|
23
|
+
|
24
|
+
refreshSelections: function() {
|
25
|
+
$('.mail_methods').hide();
|
26
|
+
$('.mail_methods#mail_methods_' + EasyMailPreview.selectedMailer()).show();
|
27
|
+
$('.arguments').hide();
|
28
|
+
$(EasyMailPreview.selectedMethodArgumentsSelector()).show();
|
29
|
+
},
|
30
|
+
|
31
|
+
selectedMailer: function() {
|
32
|
+
return $('form#email_preview select[name=mailer]').val();
|
33
|
+
},
|
34
|
+
|
35
|
+
selectedMethod: function() {
|
36
|
+
return $('form#email_preview select[name=mail_method_' + EasyMailPreview.selectedMailer() + ']').val();
|
37
|
+
},
|
38
|
+
|
39
|
+
selectedMethodArgumentsSelector: function() {
|
40
|
+
return '.arguments#mail_methods_' + EasyMailPreview.mailerAndMethod();
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
$(document).ready(function() {
|
45
|
+
EasyMailPreview.refreshSelections();
|
46
|
+
|
47
|
+
$('form#email_preview select[name=mailer]')
|
48
|
+
.live('change', EasyMailPreview.refreshSelections);
|
49
|
+
$('form#email_preview .mail_methods select')
|
50
|
+
.live('change', EasyMailPreview.refreshSelections);
|
51
|
+
$('form#email_preview').submit(EasyMailPreview.preview);
|
52
|
+
});
|
53
|
+
|
@@ -0,0 +1,26 @@
|
|
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
14
|
+
|
15
|
+
body {
|
16
|
+
width: 1000px;
|
17
|
+
margin: 0px auto;
|
18
|
+
}
|
19
|
+
|
20
|
+
label {
|
21
|
+
font-size: x-large;
|
22
|
+
}
|
23
|
+
|
24
|
+
select {
|
25
|
+
font-size: x-large;
|
26
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#easy_mail_preview {
|
2
|
+
#mailer_container {
|
3
|
+
float: left;
|
4
|
+
width: 50%;
|
5
|
+
}
|
6
|
+
|
7
|
+
#mail_methods_container {
|
8
|
+
margin-top: 10px;
|
9
|
+
}
|
10
|
+
|
11
|
+
.mail_methods {
|
12
|
+
display: none;
|
13
|
+
}
|
14
|
+
|
15
|
+
#arguments_container {
|
16
|
+
margin-top: 10px;
|
17
|
+
}
|
18
|
+
|
19
|
+
.arguments {
|
20
|
+
display: none;
|
21
|
+
}
|
22
|
+
|
23
|
+
.arguments table th {
|
24
|
+
text-align: left;
|
25
|
+
padding-right: 5px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.arguments table th.optional {
|
29
|
+
color: #CCC;
|
30
|
+
}
|
31
|
+
|
32
|
+
.arguments table input.argument {
|
33
|
+
width: 800px;
|
34
|
+
font-size: x-large;
|
35
|
+
}
|
36
|
+
|
37
|
+
#email_preview input[type=submit] {
|
38
|
+
margin-top: 15px;
|
39
|
+
background: lightBlue;
|
40
|
+
font-size: x-large;
|
41
|
+
}
|
42
|
+
|
43
|
+
#preview_frame {
|
44
|
+
margin-top: 25px;
|
45
|
+
width: 1000px;
|
46
|
+
height: 800px;
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class EasyMailPreview::EmailsController <
|
2
|
+
EasyMailPreview::ApplicationController
|
3
|
+
def index
|
4
|
+
@mailers = EasyMailPreview.config.mailers.map { |action_mailer|
|
5
|
+
EasyMailPreview::Mailer.new(action_mailer)
|
6
|
+
}
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
params[:id] =~ /(.*?)_(.*)/
|
11
|
+
mailer = Module.const_get($1)
|
12
|
+
method_name = $2
|
13
|
+
args = []
|
14
|
+
i = 0
|
15
|
+
until params["arg_" + i.to_s].blank?
|
16
|
+
eval_str = params["arg_" + i.to_s]
|
17
|
+
args << eval(eval_str)
|
18
|
+
i += 1
|
19
|
+
end
|
20
|
+
mail = mailer.send(method_name, *args)
|
21
|
+
render text: mail.body.to_s, layout: false
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<div id="easy_mail_preview">
|
2
|
+
<form id="email_preview">
|
3
|
+
<div id="mailer_container">
|
4
|
+
<label>Mailer</label>
|
5
|
+
<div>
|
6
|
+
<%= select_tag('mailer', options_for_select(@mailers.map(&:name))) %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<div id="mail_methods_container">
|
10
|
+
<label>Mail methods</label>
|
11
|
+
<% @mailers.each do |mailer| %>
|
12
|
+
<% mailer_id = "mail_methods_#{mailer.name}" %>
|
13
|
+
<div id="<%= mailer_id %>" class="mail_methods">
|
14
|
+
<%= select_tag(
|
15
|
+
"mail_method_#{mailer.name}",
|
16
|
+
options_for_select(mailer.mail_methods.map(&:name))
|
17
|
+
) %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div id="arguments_container">
|
23
|
+
<label>Arguments (enter Ruby to be eval'd)</label>
|
24
|
+
<% @mailers.each do |mailer| %>
|
25
|
+
<% mailer_id = "mail_methods_#{mailer.name}" %>
|
26
|
+
<% mailer.mail_methods.each do |mail_method| %>
|
27
|
+
<% mail_method_id = mailer_id + "_#{mail_method.name}" %>
|
28
|
+
<div id="<%= mail_method_id %>" class="arguments">
|
29
|
+
<% if mail_method.arguments.empty? %>
|
30
|
+
(No arguments)
|
31
|
+
<% else %>
|
32
|
+
<table>
|
33
|
+
<% mail_method.arguments.each_with_index do |argument, i| %>
|
34
|
+
<% argument_id = mail_method_id + "_" + i.to_s %>
|
35
|
+
<tr>
|
36
|
+
<th class="<%= argument.required? ? 'required' : 'optional' %>">
|
37
|
+
<%= argument.name %>
|
38
|
+
</th>
|
39
|
+
<td><input name="<%= argument_id %>" class="argument"></td>
|
40
|
+
</tr>
|
41
|
+
<% end %>
|
42
|
+
</table>
|
43
|
+
<% end %>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<input type="submit" value="Preview" />
|
50
|
+
</form>
|
51
|
+
|
52
|
+
<iframe id="preview_frame"></iframe>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<script type="text/javascript">
|
56
|
+
$(document).ready(function() {
|
57
|
+
EasyMailPreview.rootPath = "<%= easy_mail_preview.root_path %>";
|
58
|
+
});
|
59
|
+
</script>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>EasyMailPreview</title>
|
5
|
+
<%= stylesheet_link_tag "easy_mail_preview/application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "easy_mail_preview/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "easy_mail_preview"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["HowAboutWe"]
|
12
|
+
s.date = "2012-06-08"
|
13
|
+
s.description = "Easy previews of HTML emails for your Rails app."
|
14
|
+
s.email = "dev@howaboutwe.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"Gemfile",
|
20
|
+
"Gemfile.lock",
|
21
|
+
"MIT-LICENSE",
|
22
|
+
"README.md",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"app/assets/images/easy_mail_preview/.gitkeep",
|
26
|
+
"app/assets/javascripts/easy_mail_preview/application.js",
|
27
|
+
"app/assets/javascripts/easy_mail_preview/emails.js",
|
28
|
+
"app/assets/stylesheets/easy_mail_preview/application.css",
|
29
|
+
"app/assets/stylesheets/easy_mail_preview/emails.scss",
|
30
|
+
"app/controllers/easy_mail_preview/application_controller.rb",
|
31
|
+
"app/controllers/easy_mail_preview/emails_controller.rb",
|
32
|
+
"app/helpers/easy_mail_preview/application_helper.rb",
|
33
|
+
"app/helpers/easy_mail_preview/emails_helper.rb",
|
34
|
+
"app/views/easy_mail_preview/emails/index.html.erb",
|
35
|
+
"app/views/layouts/easy_mail_preview/application.html.erb",
|
36
|
+
"config/routes.rb",
|
37
|
+
"easy_mail_preview.gemspec",
|
38
|
+
"lib/easy_mail_preview.rb",
|
39
|
+
"lib/easy_mail_preview/engine.rb",
|
40
|
+
"lib/easy_mail_preview/version.rb",
|
41
|
+
"lib/tasks/easy_mail_preview_tasks.rake",
|
42
|
+
"screenshot.jpg",
|
43
|
+
"script/rails",
|
44
|
+
"test/dummy/README.rdoc",
|
45
|
+
"test/dummy/Rakefile",
|
46
|
+
"test/dummy/app/assets/javascripts/application.js",
|
47
|
+
"test/dummy/app/assets/stylesheets/application.css",
|
48
|
+
"test/dummy/app/controllers/application_controller.rb",
|
49
|
+
"test/dummy/app/helpers/application_helper.rb",
|
50
|
+
"test/dummy/app/mailers/.gitkeep",
|
51
|
+
"test/dummy/app/models/.gitkeep",
|
52
|
+
"test/dummy/app/views/layouts/application.html.erb",
|
53
|
+
"test/dummy/config.ru",
|
54
|
+
"test/dummy/config/application.rb",
|
55
|
+
"test/dummy/config/boot.rb",
|
56
|
+
"test/dummy/config/database.yml",
|
57
|
+
"test/dummy/config/environment.rb",
|
58
|
+
"test/dummy/config/environments/development.rb",
|
59
|
+
"test/dummy/config/environments/production.rb",
|
60
|
+
"test/dummy/config/environments/test.rb",
|
61
|
+
"test/dummy/config/initializers/backtrace_silencers.rb",
|
62
|
+
"test/dummy/config/initializers/inflections.rb",
|
63
|
+
"test/dummy/config/initializers/mime_types.rb",
|
64
|
+
"test/dummy/config/initializers/secret_token.rb",
|
65
|
+
"test/dummy/config/initializers/session_store.rb",
|
66
|
+
"test/dummy/config/initializers/wrap_parameters.rb",
|
67
|
+
"test/dummy/config/locales/en.yml",
|
68
|
+
"test/dummy/config/routes.rb",
|
69
|
+
"test/dummy/lib/assets/.gitkeep",
|
70
|
+
"test/dummy/log/.gitkeep",
|
71
|
+
"test/dummy/public/404.html",
|
72
|
+
"test/dummy/public/422.html",
|
73
|
+
"test/dummy/public/500.html",
|
74
|
+
"test/dummy/public/favicon.ico",
|
75
|
+
"test/dummy/script/rails",
|
76
|
+
"test/easy_mail_preview_test.rb",
|
77
|
+
"test/functional/easy_mail_preview/emails_controller_test.rb",
|
78
|
+
"test/integration/navigation_test.rb",
|
79
|
+
"test/test_helper.rb",
|
80
|
+
"test/unit/helpers/easy_mail_preview/emails_helper_test.rb"
|
81
|
+
]
|
82
|
+
s.homepage = "http://github.com/howaboutwe/easy_mail_preview"
|
83
|
+
s.licenses = ["MIT"]
|
84
|
+
s.require_paths = ["lib"]
|
85
|
+
s.rubygems_version = "1.8.24"
|
86
|
+
s.summary = "Easy previews of HTML emails for your Rails app."
|
87
|
+
|
88
|
+
if s.respond_to? :specification_version then
|
89
|
+
s.specification_version = 3
|
90
|
+
|
91
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
92
|
+
s.add_runtime_dependency(%q<easy_mail_preview>, [">= 0"])
|
93
|
+
s.add_runtime_dependency(%q<jquery-rails>, [">= 0"])
|
94
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
95
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
96
|
+
else
|
97
|
+
s.add_dependency(%q<easy_mail_preview>, [">= 0"])
|
98
|
+
s.add_dependency(%q<jquery-rails>, [">= 0"])
|
99
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
100
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
101
|
+
end
|
102
|
+
else
|
103
|
+
s.add_dependency(%q<easy_mail_preview>, [">= 0"])
|
104
|
+
s.add_dependency(%q<jquery-rails>, [">= 0"])
|
105
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
106
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|