maily 0.9.1 → 0.10.0

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
  SHA256:
3
- metadata.gz: b5b85962fe83f72a0c67470336abd811a3cf47bc4aba7453ab9912ff1d75778f
4
- data.tar.gz: 3bd461e092101c518dbd4d2f9f77b720a27fa6f4fd116a1c4d8131b15708658b
3
+ metadata.gz: d01f0d8930069a1374188b48d4e61c1a1086fbe3255daa27f17a6bc216a2acbd
4
+ data.tar.gz: 7807b4055b8db684bc5a20434e79d9a40fff8c89386002e8356ccc655b8da739
5
5
  SHA512:
6
- metadata.gz: f5dfbca1b005b198231e02be228051c29e38c9d2efe6a9db9e08a4643f8f17ee52d717b7f349df9ebb0929ec59db46b83276586686e25b16c2cff85b74964dc6
7
- data.tar.gz: 369b3362d5319228514baa10b78a6ca3e1f86c83c861f2f275830357d9c294b1001979fb3ab4d6de7525e4adf87bb573cdb128326212e078b8aba559490789ab
6
+ metadata.gz: f6742b9d9d8b09d469e719dc685219c12358dba1af053a98ef6daecaf70588134d921d1bac1d353342c8cffc9fc88e7623d2591d06dcef8cbafd8456f57b0f6d
7
+ data.tar.gz: 95f2d2e0cd3f1498fe913b5f2cab33558b52d0ef283edb82515f1ff58ff5d0b2114ea424b18429c98efb493fca47ef416a59a67c836ec6ded7f901b43bea27a7
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.10.0]
6
+
7
+ - Support `ActionMailer::Parameterized` (#39)
8
+ - UI tweaks
9
+
5
10
  ## [0.9.1]
6
11
 
7
12
  - Properly display text parts by respecting break lines
@@ -109,6 +114,7 @@ All notable changes to this project will be documented in this file.
109
114
 
110
115
  - First real usable release :tada:
111
116
 
117
+ [0.10.0]: https://github.com/markets/maily/compare/v0.9.1...v0.10.0
112
118
  [0.9.1]: https://github.com/markets/maily/compare/v0.9.0...v0.9.1
113
119
  [0.9.0]: https://github.com/markets/maily/compare/v0.8.2...v0.9.0
114
120
  [0.8.2]: https://github.com/markets/maily/compare/v0.8.1...v0.8.2
@@ -122,8 +128,8 @@ All notable changes to this project will be documented in this file.
122
128
  [0.6.1]: https://github.com/markets/maily/compare/v0.6.0...v0.6.1
123
129
  [0.6.0]: https://github.com/markets/maily/compare/v0.5.0...v0.6.0
124
130
  [0.5.0]: https://github.com/markets/maily/compare/v0.4.0...v0.5.0
125
- [0.4.0]: https://github.com/markets/maily/compare/v0.4.0...v0.5.0
126
- [0.3.5]: https://github.com/markets/maily/compare/v0.3.5...v0.4.0
131
+ [0.4.0]: https://github.com/markets/maily/compare/v0.3.5...v0.4.0
132
+ [0.3.5]: https://github.com/markets/maily/compare/v0.3.4...v0.3.5
127
133
  [0.3.4]: https://github.com/markets/maily/compare/v0.3.3...v0.3.4
128
134
  [0.3.3]: https://github.com/markets/maily/compare/v0.3.2...v0.3.3
129
135
  [0.3.2]: https://github.com/markets/maily/compare/v0.3.1...v0.3.2
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
- # Maily
2
-
3
- [![Gem](https://img.shields.io/gem/v/maily.svg?style=flat-square)](https://rubygems.org/gems/maily)
4
- [![Build Status](https://travis-ci.org/markets/maily.svg?branch=master)](https://travis-ci.org/markets/maily)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/fff01b2137fd73070b14/maintainability)](https://codeclimate.com/github/markets/maily/maintainability)
1
+ <div>
2
+ <p align="center">
3
+ <img src="https://raw.githubusercontent.com/markets/maily/master/support/images/logo.png">
4
+ </p>
5
+ <p align="center">
6
+ <a href="https://rubygems.org/gems/maily"><img src="https://img.shields.io/gem/v/maily.svg?style=flat-square"></a>
7
+ <a href="https://travis-ci.org/markets/maily"><img src="https://travis-ci.org/markets/maily.svg?branch=master"></a>
8
+ <a href="https://codeclimate.com/github/markets/maily/maintainability)"><img src="https://api.codeclimate.com/v1/badges/fff01b2137fd73070b14/maintainability"></a>
9
+ <a href="https://github.com/markets/maily/blob/master/MIT-LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/markets/maily.svg?style=flat-square"></a>
10
+ </p>
11
+ </div>
6
12
 
7
13
  Maily is a Rails Engine to manage, test and navigate through all your email templates of your app, being able to preview them directly in your browser.
8
14
 
@@ -20,11 +26,11 @@ Maily automatically picks up all your emails and make them accessible from a kin
20
26
  * Easy way (aka `hooks`) to define and customize data for emails
21
27
  * Generator to handle a comfortable installation
22
28
 
23
- ![](screenshot.png)
29
+ ![](support/images/screenshot.png)
24
30
 
25
31
  ## Installation
26
32
 
27
- Add this line to you Gemfile:
33
+ Add this line to your `Gemfile` and then run `bundle install`:
28
34
 
29
35
  ```ruby
30
36
  gem 'maily'
@@ -139,6 +145,18 @@ Maily.hooks_for('Notifier') do |mailer|
139
145
  end
140
146
  ```
141
147
 
148
+ ### Use `params`
149
+
150
+ Support for [`ActionMailer::Parameterized`](https://api.rubyonrails.org/classes/ActionMailer/Parameterized.html) is possible via `with_params` hash:
151
+
152
+ ```ruby
153
+ message = -> { 'Hello!' }
154
+
155
+ Maily.hooks_for('Notifier') do |mailer|
156
+ mailer.register_hook(:new_message, with_params: { message: message })
157
+ end
158
+ ```
159
+
142
160
  ### External emails
143
161
 
144
162
  If you want to register and display in the UI, emails from external sources, like for example a gem, you can do it by adding a hook. Example:
@@ -236,6 +236,8 @@ footer.footer {
236
236
  aside.sidebar {
237
237
  float: left;
238
238
  width: 20%;
239
+ max-height: 90vh;
240
+ overflow-y: scroll;
239
241
 
240
242
  section.nav_list {
241
243
  margin: 0 0 1.5em 1.5em;
@@ -300,12 +302,4 @@ img.icon {
300
302
  width: 20px;
301
303
  font-size: .9em;
302
304
  vertical-align: bottom;
303
- }
304
-
305
- /* Utils */
306
- .clearfix:before,
307
- .clearfix:after {
308
- display: table;
309
- content: " ";
310
- }
311
- .clearfix:after { clear: both; }
305
+ }
@@ -2,14 +2,13 @@
2
2
  <html>
3
3
  <head>
4
4
  <title><%= title %></title>
5
- <%= stylesheet_link_tag "maily/application", :media => "all" %>
6
- <%= javascript_include_tag "maily/application" %>
5
+ <%= stylesheet_link_tag "maily/application", media: "all" %>
7
6
  <%= csrf_meta_tags %>
8
7
  </head>
9
8
  <body>
10
9
  <%= render 'maily/shared/header' %>
11
10
 
12
- <div class="wrap_content clearfix">
11
+ <div class="wrap_content">
13
12
  <%= render 'maily/shared/sidebar' %>
14
13
 
15
14
  <div class="content">
@@ -68,3 +68,9 @@
68
68
  </ul>
69
69
  <% end %>
70
70
  </div>
71
+
72
+ <script>
73
+ function resizeIframe(obj) {
74
+ obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
75
+ }
76
+ </script>
@@ -1,11 +1,12 @@
1
1
  module Maily
2
2
  class Email
3
- attr_accessor :name, :mailer, :arguments, :template_path, :template_name, :description
3
+ attr_accessor :name, :mailer, :arguments, :template_path, :template_name, :description, :with_params
4
4
 
5
5
  def initialize(name, mailer)
6
6
  self.name = name
7
7
  self.mailer = mailer
8
8
  self.arguments = nil
9
+ self.with_params = nil
9
10
  self.template_path = mailer.name
10
11
  self.template_name = name
11
12
  self.description = nil
@@ -15,6 +16,15 @@ module Maily
15
16
  mailer.klass
16
17
  end
17
18
 
19
+ def parameterized_mailer_klass
20
+ if Rails.version >= '5.1'
21
+ params = with_params && with_params.transform_values { |param| param.respond_to?(:call) ? param.call : param }
22
+ mailer_klass.with(params)
23
+ else
24
+ mailer_klass
25
+ end
26
+ end
27
+
18
28
  def parameters
19
29
  mailer_klass.instance_method(name).parameters
20
30
  end
@@ -59,6 +69,8 @@ module Maily
59
69
  self.template_name = tpl_name
60
70
  end
61
71
 
72
+ self.with_params = args.last.delete(:with_params)
73
+
62
74
  args.pop
63
75
  end
64
76
 
@@ -69,9 +81,9 @@ module Maily
69
81
  *args = arguments && arguments.map { |arg| arg.respond_to?(:call) ? arg.call : arg }
70
82
 
71
83
  if args == [nil]
72
- mailer_klass.public_send(name)
84
+ parameterized_mailer_klass.public_send(name)
73
85
  else
74
- mailer_klass.public_send(name, *args)
86
+ parameterized_mailer_klass.public_send(name, *args)
75
87
  end
76
88
  end
77
89
 
@@ -5,7 +5,6 @@ module Maily
5
5
 
6
6
  config.assets.precompile << %w(
7
7
  maily/application.css
8
- maily/application.js
9
8
  maily/logo.png
10
9
  maily/icons/*.svg
11
10
  )
@@ -1,3 +1,3 @@
1
1
  module Maily
2
- VERSION = "0.9.1"
2
+ VERSION = "0.10.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - markets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-31 00:00:00.000000000 Z
11
+ date: 2019-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,7 +94,6 @@ files:
94
94
  - app/assets/images/maily/icons/globe.svg
95
95
  - app/assets/images/maily/icons/paperclip.svg
96
96
  - app/assets/images/maily/logo.png
97
- - app/assets/javascripts/maily/application.js
98
97
  - app/assets/stylesheets/maily/_variables.scss
99
98
  - app/assets/stylesheets/maily/application.scss
100
99
  - app/controllers/maily/application_controller.rb
@@ -137,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
136
  - !ruby/object:Gem::Version
138
137
  version: '0'
139
138
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.7.6
139
+ rubygems_version: 3.0.3
142
140
  signing_key:
143
141
  specification_version: 4
144
142
  summary: Rails Engine to preview emails in the browser.
@@ -1,3 +0,0 @@
1
- function resizeIframe(obj) {
2
- obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
3
- }