maily 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +5 -11
  4. data/Appraisals +4 -0
  5. data/CHANGELOG.md +90 -0
  6. data/MIT-LICENSE +1 -1
  7. data/README.md +21 -2
  8. data/app/assets/images/maily/icons/globe.svg +13 -0
  9. data/app/assets/images/maily/icons/paperclip.svg +8 -0
  10. data/app/assets/images/maily/logo.png +0 -0
  11. data/app/assets/stylesheets/maily/_variables.scss +6 -0
  12. data/app/assets/stylesheets/maily/application.scss +88 -96
  13. data/app/assets/stylesheets/maily/normalize.css +23 -129
  14. data/app/controllers/maily/emails_controller.rb +10 -5
  15. data/app/helpers/maily/application_helper.rb +15 -1
  16. data/app/helpers/maily/emails_helper.rb +10 -1
  17. data/app/views/layouts/maily/application.html.erb +5 -5
  18. data/app/views/maily/emails/edit.html.erb +16 -18
  19. data/app/views/maily/emails/index.html.erb +2 -4
  20. data/app/views/maily/emails/show.html.erb +61 -64
  21. data/app/views/maily/shared/_flash_messages.html.erb +7 -0
  22. data/app/views/maily/shared/_header.html.erb +4 -1
  23. data/app/views/maily/shared/_sidebar.html.erb +2 -2
  24. data/gemfiles/rails_4.2.gemfile +2 -2
  25. data/gemfiles/rails_5.0.gemfile +1 -1
  26. data/gemfiles/rails_5.1.gemfile +1 -1
  27. data/gemfiles/rails_5.2.gemfile +7 -0
  28. data/lib/maily.rb +1 -3
  29. data/lib/maily/email.rb +18 -13
  30. data/lib/maily/mailer.rb +32 -14
  31. data/lib/maily/version.rb +1 -1
  32. data/maily.gemspec +1 -2
  33. data/screenshot.png +0 -0
  34. data/spec/controllers_spec.rb +40 -1
  35. data/spec/dummy/app/mailers/notifier.rb +8 -0
  36. data/spec/dummy/lib/maily_hooks.rb +3 -0
  37. data/spec/email_spec.rb +5 -0
  38. data/spec/mailer_spec.rb +6 -1
  39. data/spec/maily_spec.rb +1 -1
  40. data/spec/spec_helper.rb +1 -0
  41. metadata +10 -26
  42. data/app/assets/images/maily/icons/maily.eot +0 -0
  43. data/app/assets/images/maily/icons/maily.svg +0 -90
  44. data/app/assets/images/maily/icons/maily.ttf +0 -0
  45. data/app/assets/images/maily/icons/maily.woff +0 -0
  46. data/app/assets/stylesheets/maily/icons.css +0 -199
  47. data/spec/dummy/app/mailers/.keep +0 -0
  48. data/spec/dummy/lib/assets/.keep +0 -0
@@ -1,17 +1,15 @@
1
- /*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
1
+ /*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */
2
2
 
3
3
  /* Document
4
4
  ========================================================================== */
5
5
 
6
6
  /**
7
7
  * 1. Correct the line height in all browsers.
8
- * 2. Prevent adjustments of font size after orientation changes in
9
- * IE on Windows Phone and in iOS.
8
+ * 2. Prevent adjustments of font size after orientation changes in iOS.
10
9
  */
11
10
 
12
11
  html {
13
12
  line-height: 1.15; /* 1 */
14
- -ms-text-size-adjust: 100%; /* 2 */
15
13
  -webkit-text-size-adjust: 100%; /* 2 */
16
14
  }
17
15
 
@@ -19,26 +17,13 @@ html {
19
17
  ========================================================================== */
20
18
 
21
19
  /**
22
- * Remove the margin in all browsers (opinionated).
20
+ * Remove the margin in all browsers.
23
21
  */
24
22
 
25
23
  body {
26
24
  margin: 0;
27
25
  }
28
26
 
29
- /**
30
- * Add the correct display in IE 9-.
31
- */
32
-
33
- article,
34
- aside,
35
- footer,
36
- header,
37
- nav,
38
- section {
39
- display: block;
40
- }
41
-
42
27
  /**
43
28
  * Correct the font size and margin on `h1` elements within `section` and
44
29
  * `article` contexts in Chrome, Firefox, and Safari.
@@ -52,25 +37,6 @@ h1 {
52
37
  /* Grouping content
53
38
  ========================================================================== */
54
39
 
55
- /**
56
- * Add the correct display in IE 9-.
57
- * 1. Add the correct display in IE.
58
- */
59
-
60
- figcaption,
61
- figure,
62
- main { /* 1 */
63
- display: block;
64
- }
65
-
66
- /**
67
- * Add the correct margin in IE 8.
68
- */
69
-
70
- figure {
71
- margin: 1em 40px;
72
- }
73
-
74
40
  /**
75
41
  * 1. Add the correct box sizing in Firefox.
76
42
  * 2. Show the overflow in Edge and IE.
@@ -96,17 +62,15 @@ pre {
96
62
  ========================================================================== */
97
63
 
98
64
  /**
99
- * 1. Remove the gray background on active links in IE 10.
100
- * 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
65
+ * Remove the gray background on active links in IE 10.
101
66
  */
102
67
 
103
68
  a {
104
- background-color: transparent; /* 1 */
105
- -webkit-text-decoration-skip: objects; /* 2 */
69
+ background-color: transparent;
106
70
  }
107
71
 
108
72
  /**
109
- * 1. Remove the bottom border in Chrome 57- and Firefox 39-.
73
+ * 1. Remove the bottom border in Chrome 57-
110
74
  * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
111
75
  */
112
76
 
@@ -116,15 +80,6 @@ abbr[title] {
116
80
  text-decoration: underline dotted; /* 2 */
117
81
  }
118
82
 
119
- /**
120
- * Prevent the duplicate application of `bolder` by the next rule in Safari 6.
121
- */
122
-
123
- b,
124
- strong {
125
- font-weight: inherit;
126
- }
127
-
128
83
  /**
129
84
  * Add the correct font weight in Chrome, Edge, and Safari.
130
85
  */
@@ -146,23 +101,6 @@ samp {
146
101
  font-size: 1em; /* 2 */
147
102
  }
148
103
 
149
- /**
150
- * Add the correct font style in Android 4.3-.
151
- */
152
-
153
- dfn {
154
- font-style: italic;
155
- }
156
-
157
- /**
158
- * Add the correct background and color in IE 9-.
159
- */
160
-
161
- mark {
162
- background-color: #ff0;
163
- color: #000;
164
- }
165
-
166
104
  /**
167
105
  * Add the correct font size in all browsers.
168
106
  */
@@ -196,44 +134,18 @@ sup {
196
134
  ========================================================================== */
197
135
 
198
136
  /**
199
- * Add the correct display in IE 9-.
200
- */
201
-
202
- audio,
203
- video {
204
- display: inline-block;
205
- }
206
-
207
- /**
208
- * Add the correct display in iOS 4-7.
209
- */
210
-
211
- audio:not([controls]) {
212
- display: none;
213
- height: 0;
214
- }
215
-
216
- /**
217
- * Remove the border on images inside links in IE 10-.
137
+ * Remove the border on images inside links in IE 10.
218
138
  */
219
139
 
220
140
  img {
221
141
  border-style: none;
222
142
  }
223
143
 
224
- /**
225
- * Hide the overflow in IE.
226
- */
227
-
228
- svg:not(:root) {
229
- overflow: hidden;
230
- }
231
-
232
144
  /* Forms
233
145
  ========================================================================== */
234
146
 
235
147
  /**
236
- * 1. Change the font styles in all browsers (opinionated).
148
+ * 1. Change the font styles in all browsers.
237
149
  * 2. Remove the margin in Firefox and Safari.
238
150
  */
239
151
 
@@ -242,7 +154,7 @@ input,
242
154
  optgroup,
243
155
  select,
244
156
  textarea {
245
- font-family: sans-serif; /* 1 */
157
+ font-family: inherit; /* 1 */
246
158
  font-size: 100%; /* 1 */
247
159
  line-height: 1.15; /* 1 */
248
160
  margin: 0; /* 2 */
@@ -269,16 +181,14 @@ select { /* 1 */
269
181
  }
270
182
 
271
183
  /**
272
- * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
273
- * controls in Android 4.
274
- * 2. Correct the inability to style clickable types in iOS and Safari.
184
+ * Correct the inability to style clickable types in iOS and Safari.
275
185
  */
276
186
 
277
187
  button,
278
- html [type="button"], /* 1 */
188
+ [type="button"],
279
189
  [type="reset"],
280
190
  [type="submit"] {
281
- -webkit-appearance: button; /* 2 */
191
+ -webkit-appearance: button;
282
192
  }
283
193
 
284
194
  /**
@@ -329,17 +239,15 @@ legend {
329
239
  }
330
240
 
331
241
  /**
332
- * 1. Add the correct display in IE 9-.
333
- * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
242
+ * Add the correct vertical alignment in Chrome, Firefox, and Opera.
334
243
  */
335
244
 
336
245
  progress {
337
- display: inline-block; /* 1 */
338
- vertical-align: baseline; /* 2 */
246
+ vertical-align: baseline;
339
247
  }
340
248
 
341
249
  /**
342
- * Remove the default vertical scrollbar in IE.
250
+ * Remove the default vertical scrollbar in IE 10+.
343
251
  */
344
252
 
345
253
  textarea {
@@ -347,8 +255,8 @@ textarea {
347
255
  }
348
256
 
349
257
  /**
350
- * 1. Add the correct box sizing in IE 10-.
351
- * 2. Remove the padding in IE 10-.
258
+ * 1. Add the correct box sizing in IE 10.
259
+ * 2. Remove the padding in IE 10.
352
260
  */
353
261
 
354
262
  [type="checkbox"],
@@ -377,10 +285,9 @@ textarea {
377
285
  }
378
286
 
379
287
  /**
380
- * Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
288
+ * Remove the inner padding in Chrome and Safari on macOS.
381
289
  */
382
290
 
383
- [type="search"]::-webkit-search-cancel-button,
384
291
  [type="search"]::-webkit-search-decoration {
385
292
  -webkit-appearance: none;
386
293
  }
@@ -399,12 +306,10 @@ textarea {
399
306
  ========================================================================== */
400
307
 
401
308
  /*
402
- * Add the correct display in IE 9-.
403
- * 1. Add the correct display in Edge, IE, and Firefox.
309
+ * Add the correct display in Edge, IE 10+, and Firefox.
404
310
  */
405
311
 
406
- details, /* 1 */
407
- menu {
312
+ details {
408
313
  display: block;
409
314
  }
410
315
 
@@ -416,30 +321,19 @@ summary {
416
321
  display: list-item;
417
322
  }
418
323
 
419
- /* Scripting
324
+ /* Misc
420
325
  ========================================================================== */
421
326
 
422
327
  /**
423
- * Add the correct display in IE 9-.
424
- */
425
-
426
- canvas {
427
- display: inline-block;
428
- }
429
-
430
- /**
431
- * Add the correct display in IE.
328
+ * Add the correct display in IE 10+.
432
329
  */
433
330
 
434
331
  template {
435
332
  display: none;
436
333
  }
437
334
 
438
- /* Hidden
439
- ========================================================================== */
440
-
441
335
  /**
442
- * Add the correct display in IE 10-.
336
+ * Add the correct display in IE 10.
443
337
  */
444
338
 
445
339
  [hidden] {
@@ -39,7 +39,7 @@ module Maily
39
39
  def update
40
40
  @maily_email.update_template(params[:body], params[:part])
41
41
 
42
- redirect_to maily_email_path(mailer: params[:mailer], email: params[:email], part: params[:part])
42
+ redirect_to maily_email_path(mailer: params[:mailer], email: params[:email], part: params[:part]), notice: 'Template updated!'
43
43
  end
44
44
 
45
45
  def deliver
@@ -47,23 +47,28 @@ module Maily
47
47
 
48
48
  @email.deliver
49
49
 
50
- redirect_to maily_email_path(mailer: params[:mailer], email: params[:email])
50
+ redirect_to maily_email_path(mailer: params[:mailer], email: params[:email]), notice: "Email sent to <b>#{params[:to]}</b>!"
51
51
  end
52
52
 
53
53
  private
54
54
 
55
55
  def allowed_action?
56
- Maily.allowed_action?(action_name) || redirect_to(root_path, alert: "Maily: action #{action_name} not allowed!")
56
+ Maily.allowed_action?(action_name) || redirect_to(root_path, alert: "Action <b>#{action_name}</b> not allowed!")
57
57
  end
58
58
 
59
59
  def load_mailers
60
- @mailers = Maily::Mailer.all
60
+ @mailers = Maily::Mailer.all.values
61
61
  end
62
62
 
63
63
  def load_mailer_and_email
64
64
  mailer = Maily::Mailer.find(params[:mailer])
65
65
  @maily_email = mailer.find_email(params[:email])
66
- @email = @maily_email.call
66
+
67
+ if @maily_email
68
+ @email = @maily_email.call
69
+ else
70
+ redirect_to(root_path, alert: "Email not found!")
71
+ end
67
72
  end
68
73
 
69
74
  def perform_with_locale
@@ -1,7 +1,21 @@
1
1
  module Maily
2
2
  module ApplicationHelper
3
+ def title
4
+ _title = 'Maily'
5
+
6
+ if params[:mailer] && params[:email]
7
+ _title << " - #{params[:mailer].humanize} | #{params[:email].humanize}"
8
+ end
9
+
10
+ _title
11
+ end
12
+
3
13
  def sidebar_class(mailer, email)
4
- 'maily_selected_mail' if mailer.name == params[:mailer] && email.name == params[:email]
14
+ 'selected_mail' if mailer.name == params[:mailer] && email.name == params[:email]
15
+ end
16
+
17
+ def icon(name)
18
+ image_tag "maily/icons/#{name}.svg", class: 'icon'
5
19
  end
6
20
  end
7
21
  end
@@ -1,7 +1,16 @@
1
1
  module Maily
2
2
  module EmailsHelper
3
3
  def total_emails(mailers)
4
- mailers.map { |mailer| mailer.emails.size }.sum
4
+ mailers.map { |mailer| mailer.total_emails }.sum
5
+ end
6
+
7
+ def email_description(email)
8
+ return unless email.description
9
+
10
+ content_tag(:div, class: 'mail_description') do
11
+ concat content_tag(:strong, 'Description ')
12
+ concat email.description
13
+ end
5
14
  end
6
15
 
7
16
  def part_class(part)
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Maily</title>
4
+ <title><%= title %></title>
5
5
  <%= stylesheet_link_tag "maily/application", :media => "all" %>
6
6
  <%= javascript_include_tag "maily/application" %>
7
7
  <%= csrf_meta_tags %>
@@ -12,11 +12,11 @@
12
12
  <div class="wrap_content clearfix">
13
13
  <%= render 'maily/shared/sidebar' %>
14
14
 
15
- <% if flash[:alert].present? %>
16
- <p class="alert"><%= flash[:alert] %></p>
17
- <% end %>
15
+ <div class="content">
16
+ <%= render 'maily/shared/flash_messages' %>
18
17
 
19
- <%= yield %>
18
+ <%= yield %>
19
+ </div>
20
20
  </div>
21
21
 
22
22
  <%= render 'maily/shared/footer' %>
@@ -1,21 +1,19 @@
1
- <div class="content">
2
- <%= form_tag(update_maily_email_path(mailer: params[:mailer], email: params[:email], part: params[:part]), method: :put) do %>
3
- <ul class="maily_action_bar">
4
- <li>
5
- <em class="icon-maily-eye"></em>
6
- <%= link_to 'Show', maily_email_path(mailer: params[:mailer], email: params[:email]) %>
7
- </li>
1
+ <%= email_description(@maily_email) %>
8
2
 
9
- <li class="maily_splitter">|</li>
3
+ <%= form_tag(update_maily_email_path(mailer: params[:mailer], email: params[:email], part: params[:part]), method: :put) do %>
4
+ <ul class="action_bar">
5
+ <li>
6
+ <%= link_to 'Show', maily_email_path(mailer: params[:mailer], email: params[:email]) %>
7
+ </li>
10
8
 
11
- <li>
12
- <em class="icon-maily-checkmark"></em>
13
- <%= submit_tag 'Update', class: 'maily_button' %>
14
- </li>
15
- </ul>
9
+ <li class="splitter">|</li>
16
10
 
17
- <div class="maily_mail_preview">
18
- <%= text_area_tag :body, @template, class:'maily_mail_updatearea' %>
19
- </div>
20
- <% end %>
21
- </div>
11
+ <li>
12
+ <%= submit_tag 'Update', class: 'button' %>
13
+ </li>
14
+ </ul>
15
+
16
+ <div class="mail_preview">
17
+ <%= text_area_tag :body, @template, class: 'mail_updatearea' %>
18
+ </div>
19
+ <% end %>
@@ -1,4 +1,2 @@
1
- <div class="content">
2
- <h2><%= total_emails(@mailers) %> emails found</h2>
3
- <p><%= Maily.welcome_message %></p>
4
- </div>
1
+ <h2><%= total_emails(@mailers) %> emails found</h2>
2
+ <p><%= Maily.welcome_message %></p>