maily_herald-webui 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +5 -0
  4. data/Gemfile +15 -0
  5. data/Gemfile.lock +250 -0
  6. data/Guardfile +23 -0
  7. data/LICENSE +11 -0
  8. data/README.md +62 -0
  9. data/Rakefile +30 -0
  10. data/app/assets/images/maily_herald/.gitkeep +0 -0
  11. data/app/assets/images/maily_herald/webui/arrow-bottom.png +0 -0
  12. data/app/assets/images/maily_herald/webui/arrow-left.png +0 -0
  13. data/app/assets/images/maily_herald/webui/arrow-right.png +0 -0
  14. data/app/assets/images/maily_herald/webui/arrow-top.png +0 -0
  15. data/app/assets/images/maily_herald/webui/logo.svg +38 -0
  16. data/app/assets/images/maily_herald/webui/sprite-dropdown.png +0 -0
  17. data/app/assets/images/maily_herald/webui/sprite-form.png +0 -0
  18. data/app/assets/images/maily_herald/webui/sprite.png +0 -0
  19. data/app/assets/images/maily_herald/webui/user.png +0 -0
  20. data/app/assets/javascripts/maily_herald/webui/application.js +20 -0
  21. data/app/assets/javascripts/maily_herald/webui/dispatches.coffee +58 -0
  22. data/app/assets/javascripts/maily_herald/webui/webui.coffee +209 -0
  23. data/app/assets/stylesheets/maily_herald/webui/application.css +18 -0
  24. data/app/assets/stylesheets/maily_herald/webui/webui-bootstrap.scss +0 -0
  25. data/app/assets/stylesheets/maily_herald/webui/webui.sass +846 -0
  26. data/app/controllers/maily_herald/webui/application_controller.rb +19 -0
  27. data/app/controllers/maily_herald/webui/dashboard_controller.rb +65 -0
  28. data/app/controllers/maily_herald/webui/dispatches_controller.rb +42 -0
  29. data/app/controllers/maily_herald/webui/lists_controller.rb +69 -0
  30. data/app/controllers/maily_herald/webui/logs_controller.rb +20 -0
  31. data/app/controllers/maily_herald/webui/mailings_controller.rb +68 -0
  32. data/app/controllers/maily_herald/webui/one_time_mailings_controller.rb +32 -0
  33. data/app/controllers/maily_herald/webui/periodical_mailings_controller.rb +25 -0
  34. data/app/controllers/maily_herald/webui/resources_controller.rb +144 -0
  35. data/app/controllers/maily_herald/webui/sequence_mailings_controller.rb +43 -0
  36. data/app/controllers/maily_herald/webui/sequences_controller.rb +56 -0
  37. data/app/controllers/maily_herald/webui/sessions_controller.rb +11 -0
  38. data/app/controllers/maily_herald/webui/subscriptions_controller.rb +33 -0
  39. data/app/helpers/maily_herald/webui/application_helper.rb +157 -0
  40. data/app/helpers/maily_herald/webui/dispatches_helper.rb +18 -0
  41. data/app/helpers/maily_herald/webui/logs_helper.rb +37 -0
  42. data/app/helpers/maily_herald/webui/mailings_helper.rb +64 -0
  43. data/app/helpers/maily_herald/webui/sequence_mailings_helper.rb +13 -0
  44. data/app/helpers/maily_herald/webui/sequences_helper.rb +6 -0
  45. data/app/helpers/maily_herald/webui/subscribers_helper.rb +25 -0
  46. data/app/helpers/maily_herald/webui/subscriptions_helper.rb +11 -0
  47. data/app/helpers/maily_herald_helper.rb +151 -0
  48. data/app/views/layouts/maily_herald/webui/application.html.haml +58 -0
  49. data/app/views/layouts/maily_herald/webui/modal.html.haml +6 -0
  50. data/app/views/maily_herald/webui/dashboard/_log.html.haml +20 -0
  51. data/app/views/maily_herald/webui/dashboard/_log_list.html.haml +19 -0
  52. data/app/views/maily_herald/webui/dashboard/_logs.html.haml +15 -0
  53. data/app/views/maily_herald/webui/dashboard/index.html.haml +43 -0
  54. data/app/views/maily_herald/webui/dashboard/index.js.erb +15 -0
  55. data/app/views/maily_herald/webui/dispatches/_entities.html.haml +7 -0
  56. data/app/views/maily_herald/webui/dispatches/_logs.html.haml +4 -0
  57. data/app/views/maily_herald/webui/dispatches/_schedules.html.haml +4 -0
  58. data/app/views/maily_herald/webui/dispatches/_toggle.js.erb +1 -0
  59. data/app/views/maily_herald/webui/lists/_details.html.haml +14 -0
  60. data/app/views/maily_herald/webui/lists/_details_form.html.haml +14 -0
  61. data/app/views/maily_herald/webui/lists/_form.html.haml +1 -0
  62. data/app/views/maily_herald/webui/lists/_header.html.haml +13 -0
  63. data/app/views/maily_herald/webui/lists/_items.html.haml +24 -0
  64. data/app/views/maily_herald/webui/lists/_opt_outs.html.haml +7 -0
  65. data/app/views/maily_herald/webui/lists/_potential_subscribers.html.haml +7 -0
  66. data/app/views/maily_herald/webui/lists/_subscribers.html.haml +7 -0
  67. data/app/views/maily_herald/webui/lists/context_variables.html.haml +15 -0
  68. data/app/views/maily_herald/webui/lists/subscribe.js.erb +10 -0
  69. data/app/views/maily_herald/webui/lists/unsubscribe.js.erb +7 -0
  70. data/app/views/maily_herald/webui/logs/_items.html.haml +34 -0
  71. data/app/views/maily_herald/webui/logs/preview.html.haml +22 -0
  72. data/app/views/maily_herald/webui/mailings-old/_entity.html.haml +17 -0
  73. data/app/views/maily_herald/webui/mailings-old/_entity_list.html.haml +26 -0
  74. data/app/views/maily_herald/webui/mailings-old/_form.html.haml +32 -0
  75. data/app/views/maily_herald/webui/mailings-old/_print.html.haml +123 -0
  76. data/app/views/maily_herald/webui/mailings-old/create.js.erb +1 -0
  77. data/app/views/maily_herald/webui/mailings-old/destroy.js.erb +1 -0
  78. data/app/views/maily_herald/webui/mailings-old/edit.html.haml +16 -0
  79. data/app/views/maily_herald/webui/mailings-old/edit.js.erb +2 -0
  80. data/app/views/maily_herald/webui/mailings-old/index.html.haml +9 -0
  81. data/app/views/maily_herald/webui/mailings-old/index.js.erb +1 -0
  82. data/app/views/maily_herald/webui/mailings-old/new.html.haml +16 -0
  83. data/app/views/maily_herald/webui/mailings-old/new.js.erb +1 -0
  84. data/app/views/maily_herald/webui/mailings-old/preview.js.erb +2 -0
  85. data/app/views/maily_herald/webui/mailings-old/refresh_list.js.erb +1 -0
  86. data/app/views/maily_herald/webui/mailings-old/show.html.haml +135 -0
  87. data/app/views/maily_herald/webui/mailings-old/show.js.erb +1 -0
  88. data/app/views/maily_herald/webui/mailings-old/update.js.erb +1 -0
  89. data/app/views/maily_herald/webui/mailings/_deliver.js.erb +1 -0
  90. data/app/views/maily_herald/webui/mailings/_details.html.haml +65 -0
  91. data/app/views/maily_herald/webui/mailings/_details_form.html.haml +39 -0
  92. data/app/views/maily_herald/webui/mailings/_form.html.haml +1 -0
  93. data/app/views/maily_herald/webui/mailings/_form_periodical.html.haml +2 -0
  94. data/app/views/maily_herald/webui/mailings/_form_sequence.html.haml +1 -0
  95. data/app/views/maily_herald/webui/mailings/_form_template_generic.html.haml +7 -0
  96. data/app/views/maily_herald/webui/mailings/_form_template_mailer.html.haml +4 -0
  97. data/app/views/maily_herald/webui/mailings/_header.html.haml +24 -0
  98. data/app/views/maily_herald/webui/mailings/_list.html.haml +27 -0
  99. data/app/views/maily_herald/webui/mailings/_template.html.haml +16 -0
  100. data/app/views/maily_herald/webui/mailings/_template_form.html.haml +7 -0
  101. data/app/views/maily_herald/webui/mailings/nav_secondary/_index.html.haml +3 -0
  102. data/app/views/maily_herald/webui/mailings/preview.html.haml +13 -0
  103. data/app/views/maily_herald/webui/mailings/update_form.js.erb +33 -0
  104. data/app/views/maily_herald/webui/resources/edit.js.erb +2 -0
  105. data/app/views/maily_herald/webui/resources/index.html.haml +11 -0
  106. data/app/views/maily_herald/webui/resources/index.js.erb +1 -0
  107. data/app/views/maily_herald/webui/resources/new.html.haml +5 -0
  108. data/app/views/maily_herald/webui/resources/show.html.haml +4 -0
  109. data/app/views/maily_herald/webui/resources/show.js.erb +3 -0
  110. data/app/views/maily_herald/webui/resources/update.js.erb +18 -0
  111. data/app/views/maily_herald/webui/sequences-old/_entity.html.haml +11 -0
  112. data/app/views/maily_herald/webui/sequences-old/_entity_list.html.haml +23 -0
  113. data/app/views/maily_herald/webui/sequences-old/_form.html.haml +17 -0
  114. data/app/views/maily_herald/webui/sequences-old/_log.html.haml +7 -0
  115. data/app/views/maily_herald/webui/sequences-old/_logs.html.haml +16 -0
  116. data/app/views/maily_herald/webui/sequences-old/_mailing.html.haml +4 -0
  117. data/app/views/maily_herald/webui/sequences-old/_mailing_list.html.haml +19 -0
  118. data/app/views/maily_herald/webui/sequences-old/edit.html.haml +14 -0
  119. data/app/views/maily_herald/webui/sequences-old/new.html.haml +13 -0
  120. data/app/views/maily_herald/webui/sequences-old/show.html.haml +122 -0
  121. data/app/views/maily_herald/webui/sequences-old/show.js.erb +2 -0
  122. data/app/views/maily_herald/webui/sequences-old/subscription.html.haml +79 -0
  123. data/app/views/maily_herald/webui/sequences/_details.html.haml +39 -0
  124. data/app/views/maily_herald/webui/sequences/_details_form.html.haml +27 -0
  125. data/app/views/maily_herald/webui/sequences/_form.html.haml +1 -0
  126. data/app/views/maily_herald/webui/sequences/_header.html.haml +11 -0
  127. data/app/views/maily_herald/webui/sequences/_list.html.haml +21 -0
  128. data/app/views/maily_herald/webui/sequences/_mailing_list.html.haml +21 -0
  129. data/app/views/maily_herald/webui/sequences/_mailings.html.haml +7 -0
  130. data/app/views/maily_herald/webui/sequences/update_form.js.erb +14 -0
  131. data/app/views/maily_herald/webui/shared/_context_attributes.html.haml +11 -0
  132. data/app/views/maily_herald/webui/subscribers/_item.html.haml +8 -0
  133. data/app/views/maily_herald/webui/subscribers/_list.html.haml +18 -0
  134. data/app/views/maily_herald/webui/subscription_groups/_form.html.haml +5 -0
  135. data/app/views/maily_herald/webui/subscription_groups/_subscription.html.haml +8 -0
  136. data/app/views/maily_herald/webui/subscription_groups/_subscription_list.html.haml +19 -0
  137. data/app/views/maily_herald/webui/subscription_groups/edit.html.haml +16 -0
  138. data/app/views/maily_herald/webui/subscription_groups/index.html.haml +35 -0
  139. data/app/views/maily_herald/webui/subscription_groups/new.html.haml +11 -0
  140. data/app/views/maily_herald/webui/subscription_groups/show.html.haml +42 -0
  141. data/app/views/maily_herald/webui/subscription_groups/show.js.erb +1 -0
  142. data/app/views/maily_herald/webui/subscriptions/show.html.haml +21 -0
  143. data/app/views/maily_herald/webui/subscriptions/toggle.js.erb +1 -0
  144. data/app/views/maily_herald/webui/webui/index.html.haml +136 -0
  145. data/app/views/maily_herald/webui/webui/show.html.haml +0 -0
  146. data/config/database.yml +5 -0
  147. data/config/initializers/smart_listing.rb +77 -0
  148. data/config/locales/en.yml +237 -0
  149. data/config/routes.rb +103 -0
  150. data/config/spring.rb +1 -0
  151. data/lib/maily_herald/webui.rb +15 -0
  152. data/lib/maily_herald/webui/breadcrumbs.rb +50 -0
  153. data/lib/maily_herald/webui/engine.rb +18 -0
  154. data/lib/maily_herald/webui/form_builder.rb +285 -0
  155. data/lib/maily_herald/webui/menu_manager.rb +66 -0
  156. data/lib/maily_herald/webui/version.rb +5 -0
  157. data/maily_herald-webui.gemspec +40 -0
  158. data/script/rails +8 -0
  159. data/spec/dummy/Guardfile +35 -0
  160. data/spec/dummy/README.rdoc +261 -0
  161. data/spec/dummy/Rakefile +7 -0
  162. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  163. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  164. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  165. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  166. data/spec/dummy/app/mailers/.gitkeep +0 -0
  167. data/spec/dummy/app/mailers/test_mailer.rb +11 -0
  168. data/spec/dummy/app/models/.gitkeep +0 -0
  169. data/spec/dummy/app/models/user.rb +7 -0
  170. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  171. data/spec/dummy/app/views/test_mailer/sample_mail.text.erb +1 -0
  172. data/spec/dummy/bin/rails +10 -0
  173. data/spec/dummy/bin/rake +7 -0
  174. data/spec/dummy/bin/rspec +7 -0
  175. data/spec/dummy/bin/spring +18 -0
  176. data/spec/dummy/config.ru +4 -0
  177. data/spec/dummy/config/application.rb +65 -0
  178. data/spec/dummy/config/boot.rb +10 -0
  179. data/spec/dummy/config/database.yml +25 -0
  180. data/spec/dummy/config/environment.rb +5 -0
  181. data/spec/dummy/config/environments/development.rb +38 -0
  182. data/spec/dummy/config/environments/production.rb +67 -0
  183. data/spec/dummy/config/environments/test.rb +37 -0
  184. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  185. data/spec/dummy/config/initializers/inflections.rb +15 -0
  186. data/spec/dummy/config/initializers/maily_herald.rb +101 -0
  187. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  188. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  189. data/spec/dummy/config/initializers/session_store.rb +8 -0
  190. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  191. data/spec/dummy/config/locales/en.yml +5 -0
  192. data/spec/dummy/config/locales/maily_herald.en.yml +28 -0
  193. data/spec/dummy/config/routes.rb +4 -0
  194. data/spec/dummy/db/migrate/20130723074347_create_users.rb +11 -0
  195. data/spec/dummy/db/migrate/20140804152249_create_maily_herald_tables.maily_herald.rb +68 -0
  196. data/spec/dummy/db/migrate/20140804152250_create_lists.maily_herald.rb +33 -0
  197. data/spec/dummy/db/schema.rb +79 -0
  198. data/spec/dummy/lib/assets/.gitkeep +0 -0
  199. data/spec/dummy/lib/tasks/dummy.rb +8 -0
  200. data/spec/dummy/log/.gitkeep +0 -0
  201. data/spec/dummy/public/404.html +26 -0
  202. data/spec/dummy/public/422.html +26 -0
  203. data/spec/dummy/public/500.html +25 -0
  204. data/spec/dummy/public/favicon.ico +0 -0
  205. data/spec/dummy/script/rails +6 -0
  206. data/spec/spec_helper.rb +46 -0
  207. data/vendor/assets/fonts/maily_herald/webui/FontAwesome.otf +0 -0
  208. data/vendor/assets/fonts/maily_herald/webui/Nexa_Free_Bold-webfont.eot +0 -0
  209. data/vendor/assets/fonts/maily_herald/webui/Nexa_Free_Bold-webfont.svg +1816 -0
  210. data/vendor/assets/fonts/maily_herald/webui/Nexa_Free_Bold-webfont.ttf +0 -0
  211. data/vendor/assets/fonts/maily_herald/webui/Nexa_Free_Bold-webfont.woff +0 -0
  212. data/vendor/assets/fonts/maily_herald/webui/fontawesome-webfont.eot +0 -0
  213. data/vendor/assets/fonts/maily_herald/webui/fontawesome-webfont.svg +520 -0
  214. data/vendor/assets/fonts/maily_herald/webui/fontawesome-webfont.ttf +0 -0
  215. data/vendor/assets/fonts/maily_herald/webui/fontawesome-webfont.woff +0 -0
  216. data/vendor/assets/fonts/maily_herald/webui/opensans-bold-webfont.eot +0 -0
  217. data/vendor/assets/fonts/maily_herald/webui/opensans-bold-webfont.svg +1825 -0
  218. data/vendor/assets/fonts/maily_herald/webui/opensans-bold-webfont.ttf +0 -0
  219. data/vendor/assets/fonts/maily_herald/webui/opensans-bold-webfont.woff +0 -0
  220. data/vendor/assets/fonts/maily_herald/webui/opensans-italic-webfont.eot +0 -0
  221. data/vendor/assets/fonts/maily_herald/webui/opensans-italic-webfont.svg +1825 -0
  222. data/vendor/assets/fonts/maily_herald/webui/opensans-italic-webfont.ttf +0 -0
  223. data/vendor/assets/fonts/maily_herald/webui/opensans-italic-webfont.woff +0 -0
  224. data/vendor/assets/fonts/maily_herald/webui/opensans-regular-webfont.eot +0 -0
  225. data/vendor/assets/fonts/maily_herald/webui/opensans-regular-webfont.svg +1825 -0
  226. data/vendor/assets/fonts/maily_herald/webui/opensans-regular-webfont.ttf +0 -0
  227. data/vendor/assets/fonts/maily_herald/webui/opensans-regular-webfont.woff +0 -0
  228. data/vendor/assets/javascripts/maily_herald/webui/bootstrap-datepicker.js +1681 -0
  229. data/vendor/assets/javascripts/maily_herald/webui/bootstrap.min.js +6 -0
  230. data/vendor/assets/javascripts/maily_herald/webui/d3.v3.js +5 -0
  231. data/vendor/assets/javascripts/maily_herald/webui/rickshaw.js +4067 -0
  232. data/vendor/assets/stylesheets/maily_herald/webui/bootstrap-datepicker.css +786 -0
  233. data/vendor/assets/stylesheets/maily_herald/webui/bootstrap.min.css +5 -0
  234. data/vendor/assets/stylesheets/maily_herald/webui/font-awesome.min.css +4 -0
  235. data/vendor/assets/stylesheets/maily_herald/webui/rickshaw.css +355 -0
  236. metadata +564 -0
@@ -0,0 +1,25 @@
1
+ module MailyHerald
2
+ module Webui
3
+ module SubscribersHelper
4
+ def subscriber_actions list, entity
5
+ actions = []
6
+ subscription = list.subscription_for(entity)
7
+ actions << {
8
+ name: :custom,
9
+ url: subscription_path(subscription),
10
+ icon: "fa fa-book",
11
+ title: tw("label_subscription")
12
+ } if subscription
13
+ actions << {
14
+ name: :custom,
15
+ url: !list.subscribed?(entity) ? subscribe_to_list_path(list, entity) : unsubscribe_from_list_path(list, entity),
16
+ method: :post,
17
+ icon: !list.subscribed?(entity) ? "fa fa-square-o" : "fa fa-check-square-o",
18
+ remote: true,
19
+ title: !list.subscribed?(entity) ? tw("subscribers.item.subscribe") : tw("subscribers.item.unsubscribe"),
20
+ confirm: tw("subscriptions.show.toggle_confirm")
21
+ }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ module MailyHerald
2
+ module Webui
3
+ module SubscriptionsHelper
4
+ def display_subscription_state s
5
+ content_tag(:span) do
6
+ boolean_icon s.active?
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,151 @@
1
+ module MailyHeraldHelper
2
+ def sequence_mailing_list_actions mailing
3
+ actions = [
4
+ {
5
+ :name => :custom,
6
+ :url => webui_mailing_path(mailing),
7
+ :icon => "glyphicon glyphicon-hand-right",
8
+ :title => "Show"
9
+ },
10
+ {
11
+ :name => :custom,
12
+ :url => edit_webui_mailing_path(mailing),
13
+ :icon => "glyphicon glyphicon-pencil",
14
+ :title => "Edit"
15
+ },
16
+ {
17
+ :name => :custom,
18
+ :url => webui_mailing_path(mailing),
19
+ :method => :delete,
20
+ :confirm => "Are you sure you want to remove this mailing?",
21
+ :icon => "glyphicon glyphicon-trash",
22
+ :title => "Remove"
23
+ }
24
+ ]
25
+ actions.insert(0, {
26
+ :name => :custom,
27
+ :url => "#mailing-#{mailing.id}",
28
+ :class => "show-preview",
29
+ :icon => "glyphicon glyphicon-search",
30
+ :title => "Preview"
31
+ }) if @sequence && @subscription
32
+ actions
33
+ end
34
+
35
+ def sequence_entity_list_actions entity
36
+ [
37
+ {
38
+ :name => :custom,
39
+ :url => subscription_webui_sequence_path(:entity_id => entity),
40
+ :icon => "glyphicon glyphicon-hand-right",
41
+ :title => "Show"
42
+ }
43
+ ]
44
+ end
45
+ def mailing_entity_list_actions mailing, entity
46
+ actions = []
47
+ actions.push({
48
+ :name => :custom,
49
+ :url => preview_webui_mailing_path(:subscription_id => mailing.subscription_for(entity)),
50
+ :icon => "glyphicon glyphicon-search",
51
+ :title => "Preview template below",
52
+ :remote => true
53
+ })
54
+ actions.push({
55
+ :name => :custom,
56
+ :url => mailing.sequence? ? subscription_webui_sequence_path(:id => mailing.sequence, :entity_id => entity) : subscription_webui_mailing_path(:entity_id => entity),
57
+ :icon => "glyphicon glyphicon-hand-right",
58
+ :title => "Show"
59
+ })
60
+ actions
61
+ end
62
+
63
+ def time_tag(time)
64
+ return unless time
65
+ text = distance_of_time_in_words(Time.now, time)
66
+ content_tag('abbr', text, :title => format_time(time))
67
+ end
68
+
69
+ def time_tag_ago(time)
70
+ return unless time
71
+ text = distance_of_time_in_words(Time.now, time)
72
+ content_tag('abbr', t('time_distance.ago', :text => text), :title => time)
73
+ end
74
+
75
+ def time_tag_to(time)
76
+ return unless time
77
+ text = distance_of_time_in_words(Time.now, time)
78
+ content_tag('abbr', t('time_distance.in', :text => text), :title => time)
79
+ end
80
+
81
+ def delivery_log_list_actions delivery_log
82
+ mailing = delivery_log.mailing
83
+ entity = delivery_log.entity
84
+
85
+ actions = []
86
+ actions.push({
87
+ :name => :custom,
88
+ :url => webui_dashboard_path(delivery_log),
89
+ :icon => "icon-search",
90
+ :title => "Show log details"
91
+ })
92
+ actions.push({
93
+ :name => :custom,
94
+ :url => mailing.sequence? ? subscription_webui_sequence_path(:id => mailing.sequence, :entity_id => entity) : subscription_webui_mailing_path(:id => mailing, :entity_id => entity),
95
+ :icon => "icon-hand-right",
96
+ :title => "Subscription"
97
+ }) unless @subscription
98
+ actions
99
+ end
100
+
101
+ def subscription_group_subscription_actions subscription
102
+ [{
103
+ :name => :custom,
104
+ :url => toggle_subscription_webui_subscription_group_path(:subscription_id => subscription),
105
+ :method => :get,
106
+ :confirm => "Are you sure you want to change this subscription?",
107
+ :icon => "icon-refresh",
108
+ :title => "Toggle subscription"
109
+ }]
110
+ end
111
+
112
+ def time_tag_relative(time)
113
+ if time > Time.now
114
+ time_tag_to time
115
+ else
116
+ time_tag_ago time
117
+ end
118
+ end
119
+
120
+ def context_attributes_link options = {}
121
+ link_to context_attributes_webui_mailings_path(:context_name => options[:context]), :role => "button", :data => {:toggle => "modal", :target => "#context-attributes"}, :class => "show-context-attributes" do
122
+ concat(content_tag(:i, "", :class => "glyphicon glyphicon-th-list"))
123
+ concat(" show") unless options[:notext]
124
+ end
125
+ end
126
+
127
+ def maily_herald_context_options_for_select selected = nil, options = {}
128
+ MailyHerald.contexts.keys.collect {|c| [c, c] }
129
+ end
130
+
131
+ def maily_herald_mailer_options_for_select selected = nil, options = {}
132
+ [
133
+ ['generic', 'generic']
134
+ ]
135
+ end
136
+
137
+ def maily_herald_context_attributes_list name
138
+ MailyHerald.context(name).each
139
+ end
140
+
141
+ def maily_herald_token_action_options_for_select selected = nil, options = {}
142
+ [
143
+ ['Unsubscribe', 'unsubscribe'],
144
+ ['Custom', 'custom'],
145
+ ]
146
+ end
147
+
148
+ def maily_herald_subscription_group_options_for_select selected = nil, options = {}
149
+ [["none", ""]] + MailyHerald::SubscriptionGroup.all.collect {|sg| [sg.title, sg.name] }
150
+ end
151
+ end
@@ -0,0 +1,58 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %title MailyHerald
5
+ = stylesheet_link_tag "maily_herald/webui/application", :media => "all"
6
+ = javascript_include_tag "maily_herald/webui/application"
7
+ = csrf_meta_tags
8
+ %body{data: {smart_listing_config: SmartListing.config(:maily_herald).to_json}}
9
+ .container
10
+ .hero
11
+ .row
12
+ .col-sm-3.text-center
13
+ %h1= link_to image_tag("maily_herald/webui/logo.svg", :class => "img-responsive logo"), root_path
14
+ .col-sm-6= render_breadcrumbs
15
+ .col-sm-3
16
+ .dropdown.pull-right
17
+ %a{:href => '#', :data => { toggle: 'dropdown'}, :class => 'account'}
18
+ %span= work_mode_t(work_mode)
19
+ %ul.dropdown-menu{'role' => 'menu'}
20
+ - if work_mode == :expert
21
+ %li= link_to work_mode_t(:regular), switch_mode_path(:regular), :method => :post
22
+ - else
23
+ %li= link_to work_mode_t(:expert), switch_mode_path(:expert), :method => :post
24
+
25
+ .section-wrapper
26
+ = render_main_menu
27
+
28
+ .content-container
29
+ = yield
30
+
31
+ .footer
32
+ .pull-right
33
+ = t(".created_by")
34
+ = link_to "Sology", "http://www.sology.eu"
35
+ %div
36
+ %span
37
+ %strong= link_to "MailyHerald", "https://github.com/Sology/maily_herald"
38
+ = "v#{::MailyHerald::VERSION}"
39
+ %span
40
+ %strong= link_to "WebUI", "https://github.com/Sology/maily_herald-webui"
41
+ = "v#{::MailyHerald::Webui::VERSION}"
42
+ %span
43
+ %strong Redis:
44
+ = MailyHerald.redis.client.id
45
+ - if MailyHerald.redis.respond_to?(:namespace)
46
+ %span
47
+ %strong Namespace:
48
+ = MailyHerald.redis.respond_to?(:namespace) ? MailyHerald.redis.namespace : nil
49
+ .hidden
50
+ #popover-confirmation.fade{data: {title: t(".confirm")}}
51
+ %p.popover-msg
52
+ .popover-footer
53
+ %button.btn.btn-webui.confirm{:data => {:dismiss => "modal"}} OK
54
+ %button.btn.btn-link.cancel{:data => {:dismiss => "modal"}} Cancel
55
+ .modal#modal-generic.fade
56
+ .modal-dialog
57
+ .modal-content
58
+
@@ -0,0 +1,6 @@
1
+ .modal-header
2
+ %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", type: "button"}
3
+ ×
4
+ %h3.modal-title= content_for(:modal_title)
5
+ .modal-body
6
+ = yield
@@ -0,0 +1,20 @@
1
+ %td
2
+ = time_tag_relative(object.processed_at)
3
+ %td
4
+ = object.entity
5
+ = "<#{object.entity.email}>"
6
+ %td
7
+ - if object.mailing.sequence?
8
+ = link_to object.mailing.sequence.title, webui_sequence_path(object.mailing.sequence)
9
+ &raquo;
10
+ = link_to object.mailing.title, webui_mailing_path(object.mailing)
11
+ %td
12
+ - case object.status
13
+ - when :delivered
14
+ %span.glyphicon.glyphicon-ok{:title => "Delivered"}
15
+ - when :skipped
16
+ %span.glyphicon.glyphicon-warning-sign{:title => "Skipped"}
17
+ - when :error
18
+ %span.glyphicon.glyphicon-remove{:title => "ERROR"}
19
+ %td.actions
20
+ = smart_listing_item_actions delivery_log_list_actions(object)
@@ -0,0 +1,19 @@
1
+ - unless smart_listing.collection.empty?
2
+ %table.table.table-striped
3
+ %thead
4
+ %tr
5
+ %th Processed at
6
+ %th Entity
7
+ %th Mailing
8
+ %th Status
9
+ %th.span1
10
+
11
+ %tbody
12
+ - smart_listing.collection.each do |log|
13
+ %tr
14
+ = render :partial => "maily_herald/webui/dashboard/log", :locals => {:object => log}
15
+
16
+ = smart_listing.paginate
17
+ = smart_listing.pagination_per_page_links
18
+ - else
19
+ %p.alert No delivery logs
@@ -0,0 +1,15 @@
1
+ - unless @logs.empty?
2
+ %table.table.table-striped
3
+ %thead
4
+ %tr
5
+ %th Id
6
+ %th Delivery date
7
+ %th Opened
8
+ %th Opened at
9
+
10
+ %tbody
11
+ - @logs.each do |log|
12
+ %tr
13
+ = render :partial => "maily_herald/webui/dashboard/log", :locals => {:object => log}
14
+ - else
15
+ %p.alert No delivery logs
@@ -0,0 +1,43 @@
1
+ %h2.border
2
+ = t(".history")
3
+ %span.dashboard-periods
4
+ = link_to({period: "week"}, :remote => true, :class => ["link link-sm period-week", ("active" if @period == 1.week)]) do
5
+ = t(".week")
6
+ = link_to({period: "month"}, :remote => true, :class => ["link link-sm period-month", ("active" if @period == 1.month)]) do
7
+ = t(".month")
8
+ = link_to({period: "6months"}, :remote => true, :class => ["link link-sm period-6months", ("active" if @period == 6.months)]) do
9
+ = t(".6months")
10
+ = link_to({period: "year"}, :remote => true, :class => ["link link-sm period-year", ("active" if @period == 1.year)]) do
11
+ = t(".year")
12
+
13
+ .history-graph{data: {delivered: @delivered.to_json, failed: @failed.to_json, skipped: @skipped.to_json}}
14
+
15
+ %p
16
+
17
+ .container-fluid
18
+ .well.row.statusbox
19
+ .col-sm-12.clearfix
20
+ .col-sm-3
21
+ %strong.text-muted.processed-count= @processed_count
22
+ %br
23
+ %span= tw("logs.status.processed")
24
+ .col-sm-3
25
+ %strong.delivered-count= @delivered_count
26
+ %br
27
+ %span= tw("logs.status.delivered")
28
+ .col-sm-3
29
+ %strong.text-warning.skipped-count= @skipped_count
30
+ %br
31
+ %span= tw("logs.status.skipped")
32
+ .col-sm-3
33
+ %strong.text-danger.failed-count= @failed_count
34
+ %br
35
+ %span= tw("logs.status.failed")
36
+
37
+ %p
38
+
39
+ = smart_listing_render :logs
40
+
41
+ %h2.border
42
+ = tw("logs.scheduled_deliveries")
43
+ = smart_listing_render :scheduled_logs
@@ -0,0 +1,15 @@
1
+ $(".dashboard-periods a").removeClass("active");
2
+ $(".period-<%= params[:period] || "month" %>").addClass("active");
3
+
4
+ <%= smart_listing_update(:logs) %>
5
+ <%= smart_listing_update(:scheduled_logs) %>
6
+
7
+ $(".processed-count").html(<%= @processed_count %>);
8
+ $(".delivered-count").html(<%= @delivered_count %>);
9
+ $(".skipped-count").html(<%= @skipped_count %>);
10
+ $(".failed-count").html(<%= @failed_count %>);
11
+
12
+ $(".history-graph").data("delivered", <%= @delivered.to_json.html_safe %>);
13
+ $(".history-graph").data("failed", <%= @failed.to_json.html_safe %>);
14
+ $(".history-graph").data("skipped", <%= @skipped.to_json.html_safe %>);
15
+ $(".history-graph").historyGraph();
@@ -0,0 +1,7 @@
1
+ %h2.border
2
+ = tw(:label_entity_plural)
3
+
4
+ = smart_listing_controls_for :entities, :class => "context-menu" do
5
+ - if @entities.any?
6
+ %form{:action => ""}= filter_box "entities_filter"
7
+ = smart_listing_render :entities
@@ -0,0 +1,4 @@
1
+ %h2.border
2
+ = tw("logs.past_deliveries")
3
+
4
+ = smart_listing_render :logs
@@ -0,0 +1,4 @@
1
+ %h2.border
2
+ = tw("logs.scheduled_deliveries")
3
+
4
+ = smart_listing_render :schedules
@@ -0,0 +1 @@
1
+ $(".dispatch-state").html("<%= escape_javascript(display_mailing_state(@item)) %>");
@@ -0,0 +1,14 @@
1
+ = render partial: "header"
2
+
3
+ .dl-horizontal
4
+ - content_for_expert do
5
+ %dt= tw("attributes.name")
6
+ %dd= @item.name
7
+ %dt= tw("attributes.title")
8
+ %dd= @item.title
9
+
10
+ %p
11
+
12
+ = render_context_attributes_info @item
13
+
14
+ %p
@@ -0,0 +1,14 @@
1
+ - unless @item.new_record?
2
+ = render partial: "header"
3
+
4
+ = form_for @item, :as => :item, :layout => :horizontal, :remote => !@item.new_record?, :control_col => "col-sm-5" do |f|
5
+ - content_for_expert do
6
+ = f.text_field :name
7
+ = f.text_field :title
8
+ - if @item.new_record?
9
+ = f.maily_context_select
10
+
11
+ - if @item.new_record?
12
+ = f.buttons :create
13
+ - else
14
+ = f.buttons :save, :cancel
@@ -0,0 +1 @@
1
+ = render partial: "details_form"
@@ -0,0 +1,13 @@
1
+ %h1
2
+ = friendly_name @item
3
+ - unless @item.locked?
4
+ = link_to edit_list_path(@item), :remote => true, :class => "link link-sm" do
5
+ = icon(:pencil)
6
+ = tw("commons.edit")
7
+ = link_to list_path(@item), :method => :delete, :data => {:confirm => t(".confirm_delete")}, :class => "link link-sm" do
8
+ = icon(:"trash-o")
9
+ = tw("commons.remove")
10
+ - else
11
+ %a.link.link-sm.text-warning{:data => {:toggle => "tooltip", :placement => "top"}, :title => tw("lists.locked_info")}
12
+ = icon(:lock)
13
+ = tw("commons.locked")