mail_engine 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (452) hide show
  1. data/.yardoc/checksums +12 -11
  2. data/.yardoc/objects/ActionMailer.dat +0 -0
  3. data/.yardoc/objects/ActionMailer/Base.dat +0 -0
  4. data/.yardoc/objects/ActionMailer/Base/collect_responses_and_parts_order_i.dat +0 -0
  5. data/.yardoc/objects/ActionMailer/Base/mail_i.dat +0 -0
  6. data/.yardoc/objects/ActionMailer/Base/origin_mail_i.dat +0 -0
  7. data/.yardoc/objects/ActionMailer/Base/set_layout_and_partials_i.dat +0 -0
  8. data/.yardoc/objects/ActionMailer/Collector.dat +0 -0
  9. data/.yardoc/objects/ActionMailer/Collector/custom_i.dat +0 -0
  10. data/.yardoc/objects/MailEngine.dat +0 -0
  11. data/.yardoc/objects/MailEngine/ActsAsMailReceiver.dat +0 -0
  12. data/.yardoc/objects/MailEngine/ActsAsMailReceiver/ClassMethods.dat +0 -0
  13. data/.yardoc/objects/MailEngine/ActsAsMailReceiver/ClassMethods/acts_as_mail_receiver_i.dat +0 -0
  14. data/.yardoc/objects/MailEngine/ActsAsMailReceiver/ClassMethods/check_method_existance_21_i.dat +0 -0
  15. data/.yardoc/objects/MailEngine/Base.dat +0 -0
  16. data/.yardoc/objects/MailEngine/Base/_40_40configurations.dat +0 -0
  17. data/.yardoc/objects/MailEngine/Base/current_config_c.dat +0 -0
  18. data/.yardoc/objects/MailEngine/Base/send_marketing_mail_c.dat +0 -0
  19. data/.yardoc/objects/MailEngine/Configuration.dat +0 -0
  20. data/.yardoc/objects/MailEngine/Configuration/load_c.dat +0 -0
  21. data/.yardoc/objects/MailEngine/CopyMigrations.dat +0 -0
  22. data/.yardoc/objects/MailEngine/CopyMigrations/copy_migrations_i.dat +0 -0
  23. data/.yardoc/objects/MailEngine/CopyResources.dat +0 -0
  24. data/.yardoc/objects/MailEngine/CopyResources/copy_resources_i.dat +0 -0
  25. data/.yardoc/objects/MailEngine/CreateConfig.dat +0 -0
  26. data/.yardoc/objects/MailEngine/CreateConfig/create_config_file_i.dat +0 -0
  27. data/.yardoc/objects/MailEngine/Engine.dat +0 -0
  28. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer.dat +0 -0
  29. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/check_21_c.dat +0 -0
  30. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/get_resource_url_c.dat +0 -0
  31. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/process_c.dat +0 -0
  32. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_in_html_c.dat +0 -0
  33. data/.yardoc/objects/MailEngine/Install.dat +0 -0
  34. data/.yardoc/objects/MailEngine/Install/copy_migrations_i.dat +0 -0
  35. data/.yardoc/objects/MailEngine/Install/copy_resources_i.dat +0 -0
  36. data/.yardoc/objects/MailEngine/Install/create_config_i.dat +0 -0
  37. data/.yardoc/objects/MailEngine/MailLogSubscriber.dat +0 -0
  38. data/.yardoc/objects/MailEngine/MailLogSubscriber/deliver_i.dat +0 -0
  39. data/.yardoc/objects/MailEngine/PLACEHOLDERS_IN_LAYOUT.dat +0 -0
  40. data/.yardoc/objects/MailEngine/Sendgrid.dat +0 -0
  41. data/.yardoc/objects/MailEngine/Sendgrid/Base.dat +0 -0
  42. data/.yardoc/objects/MailEngine/Sendgrid/Base/ClassMethods.dat +0 -0
  43. data/.yardoc/objects/MailEngine/Sendgrid/Base/ClassMethods/sendgrid_header_i.dat +0 -0
  44. data/.yardoc/objects/MailEngine/Sendgrid/Base/InstanceMethods.dat +0 -0
  45. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting.dat +0 -0
  46. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting/data_3D_i.dat +0 -0
  47. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting/data_i.dat +0 -0
  48. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting/initialize_i.dat +0 -0
  49. data/.yardoc/objects/MailEngine/Sendgrid/FilterSetting/validate_config_21_i.dat +0 -0
  50. data/.yardoc/objects/MailEngine/Sendgrid/RestApi.dat +0 -0
  51. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/blocks_c.dat +0 -0
  52. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/bounces_c.dat +0 -0
  53. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/invalidemails_c.dat +0 -0
  54. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/spamreports_c.dat +0 -0
  55. data/.yardoc/objects/MailEngine/Sendgrid/RestApi/stats_c.dat +0 -0
  56. data/.yardoc/objects/MailEngine/Sendgrid/RestApiError.dat +0 -0
  57. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi.dat +0 -0
  58. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/add_sub_val_i.dat +0 -0
  59. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/add_to_i.dat +0 -0
  60. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/category_i.dat +0 -0
  61. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/filters_i.dat +0 -0
  62. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/initialize_i.dat +0 -0
  63. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/set_unique_args_i.dat +0 -0
  64. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/to_hash_i.dat +0 -0
  65. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/to_json_i.dat +0 -0
  66. data/.yardoc/objects/MailEngine/Sendgrid/SmtpApi/to_s_i.dat +0 -0
  67. data/.yardoc/objects/MailEngine/VERSION.dat +0 -0
  68. data/.yardoc/objects/MailEngine/ZipProcessor.dat +0 -0
  69. data/.yardoc/objects/MailEngine/ZipProcessor/extract_all_files_c.dat +0 -0
  70. data/.yardoc/objects/root.dat +0 -0
  71. data/Gemfile +16 -13
  72. data/Gemfile.lock +69 -46
  73. data/README.mkd +14 -2
  74. data/VERSION +1 -1
  75. data/app/controllers/mail_engine/application_controller.rb +4 -0
  76. data/app/controllers/mail_engine/mail_logs_controller.rb +1 -1
  77. data/app/controllers/mail_engine/mail_schedules_controller.rb +4 -4
  78. data/app/controllers/mail_engine/mail_template_files_controller.rb +4 -4
  79. data/app/controllers/mail_engine/mail_templates_controller.rb +16 -11
  80. data/app/controllers/mail_engine/reports_controller.rb +5 -1
  81. data/app/helpers/mail_engine/mail_engine_helper.rb +1 -1
  82. data/app/mailers/mail_engine/mail_dispatcher.rb +16 -9
  83. data/app/models/mail_engine/mail_log.rb +1 -1
  84. data/app/models/mail_engine/mail_schedule.rb +14 -12
  85. data/app/models/mail_engine/mail_template.rb +81 -55
  86. data/app/models/mail_engine/mail_template_file.rb +4 -3
  87. data/app/views/layouts/mail_engine/mail_engine.html.erb +31 -18
  88. data/app/views/layouts/mail_engine/simple.html.erb +14 -0
  89. data/app/views/mail_engine/dashboard/index.html.erb +18 -1
  90. data/app/views/mail_engine/mail_logs/_related_logs.html.erb +29 -0
  91. data/app/views/mail_engine/mail_logs/index.html.erb +5 -5
  92. data/app/views/mail_engine/mail_schedules/_form.html.erb +6 -5
  93. data/app/views/mail_engine/mail_schedules/index.html.erb +13 -8
  94. data/app/views/mail_engine/mail_schedules/show.html.erb +2 -0
  95. data/app/views/mail_engine/mail_template_files/_form.html.erb +20 -10
  96. data/app/views/mail_engine/mail_template_files/edit.html.erb +2 -0
  97. data/app/views/mail_engine/mail_template_files/new.html.erb +2 -0
  98. data/app/views/mail_engine/mail_templates/_form.html.erb +65 -12
  99. data/app/views/mail_engine/mail_templates/_layout_selector.html.erb +3 -3
  100. data/app/views/mail_engine/mail_templates/duplicate.html.erb +11 -7
  101. data/app/views/mail_engine/mail_templates/index.html.erb +25 -21
  102. data/app/views/mail_engine/mail_templates/new_by_upload.html.erb +11 -5
  103. data/app/views/mail_engine/mail_templates/partial_options.html.erb +2 -2
  104. data/app/views/mail_engine/mail_templates/show.html.erb +19 -29
  105. data/app/views/mail_engine/reports/charts/blocks.html.erb +2 -2
  106. data/app/views/mail_engine/reports/charts/bounces.html.erb +2 -2
  107. data/app/views/mail_engine/reports/charts/invalidemails.html.erb +2 -2
  108. data/app/views/mail_engine/reports/charts/spamreports.html.erb +2 -2
  109. data/app/views/mail_engine/reports/index.html.erb +40 -5
  110. data/config/routes.rb +5 -6
  111. data/db/migrate/20110114030841_create_table_mail_template.rb +1 -0
  112. data/doc/ActionMailer.html +108 -0
  113. data/doc/ActionMailer/Base.html +193 -0
  114. data/doc/ActionMailer/Collector.html +175 -0
  115. data/doc/MailEngine.html +146 -0
  116. data/doc/MailEngine/ActsAsMailReceiver.html +97 -0
  117. data/doc/MailEngine/ActsAsMailReceiver/ClassMethods.html +187 -0
  118. data/doc/MailEngine/Base.html +297 -0
  119. data/doc/MailEngine/Configuration.html +181 -0
  120. data/doc/MailEngine/CopyMigrations.html +187 -0
  121. data/doc/MailEngine/CopyResources.html +171 -0
  122. data/doc/MailEngine/CreateConfig.html +193 -0
  123. data/doc/MailEngine/CreateMigration.html +187 -0
  124. data/doc/MailEngine/Engine.html +100 -0
  125. data/doc/MailEngine/HtmlDocumentAssetsReplacer.html +397 -0
  126. data/doc/MailEngine/Install.html +273 -0
  127. data/doc/MailEngine/MailLogSubscriber.html +204 -0
  128. data/doc/MailEngine/Sendgrid.html +101 -0
  129. data/doc/MailEngine/Sendgrid/Base.html +97 -0
  130. data/doc/MailEngine/Sendgrid/Base/ClassMethods.html +150 -0
  131. data/doc/MailEngine/Sendgrid/Base/InstanceMethods.html +81 -0
  132. data/doc/MailEngine/Sendgrid/FilterSetting.html +257 -0
  133. data/doc/MailEngine/Sendgrid/RestApi.html +476 -0
  134. data/doc/MailEngine/Sendgrid/RestApiError.html +100 -0
  135. data/doc/MailEngine/Sendgrid/SmtpApi.html +604 -0
  136. data/doc/MailEngine/ZipProcessor.html +267 -0
  137. data/doc/_index.html +21 -7
  138. data/doc/class_list.html +1 -1
  139. data/doc/file.README.html +231 -0
  140. data/doc/index.html +231 -0
  141. data/doc/method_list.html +45 -21
  142. data/doc/top-level-namespace.html +88 -0
  143. data/lib/mail_engine.rb +7 -1
  144. data/lib/mail_engine/action_mailer_patch.rb +7 -0
  145. data/lib/mail_engine/acts_as_mail_receiver.rb +40 -6
  146. data/lib/mail_engine/base.rb +28 -7
  147. data/lib/mail_engine/configuration.rb +3 -0
  148. data/lib/mail_engine/engine.rb +5 -5
  149. data/lib/mail_engine/generators/{create_migration.rb → copy_migrations.rb} +4 -3
  150. data/lib/mail_engine/generators/copy_resources.rb +13 -0
  151. data/lib/mail_engine/generators/install.rb +21 -0
  152. data/lib/mail_engine/generators/templates/mail_engine_config.yml +10 -1
  153. data/lib/mail_engine/html_document_assets_replacer.rb +12 -23
  154. data/lib/mail_engine/mail_log_subscriber.rb +13 -5
  155. data/lib/mail_engine/zip_processor.rb +10 -1
  156. data/mail_engine.gemspec +336 -110
  157. data/public/images/mail_engine/header_and_footer_layout.png +0 -0
  158. data/public/images/mail_engine/icons/add.png +0 -0
  159. data/public/images/mail_engine/icons/copy.png +0 -0
  160. data/public/images/mail_engine/icons/delete.png +0 -0
  161. data/public/images/mail_engine/icons/edit.gif +0 -0
  162. data/public/images/mail_engine/icons/missing.png +0 -0
  163. data/public/images/mail_engine/icons/save.png +0 -0
  164. data/public/images/mail_engine/icons/show.png +0 -0
  165. data/public/images/mail_engine/logo.gif +0 -0
  166. data/public/images/mail_engine/logo.png +0 -0
  167. data/public/images/mail_engine/none_layout.png +0 -0
  168. data/public/images/mail_engine/only_footer_layout.png +0 -0
  169. data/public/images/mail_engine/unselect_header_and_footer_layout.png +0 -0
  170. data/public/images/mail_engine/unselect_none_layout.png +0 -0
  171. data/public/images/mail_engine/unselect_only_footer_layout.png +0 -0
  172. data/public/javascripts/mail_engine/fancybox/blank.gif +0 -0
  173. data/public/javascripts/mail_engine/fancybox/fancy_close.png +0 -0
  174. data/public/javascripts/mail_engine/fancybox/fancy_loading.png +0 -0
  175. data/public/javascripts/mail_engine/fancybox/fancy_nav_left.png +0 -0
  176. data/public/javascripts/mail_engine/fancybox/fancy_nav_right.png +0 -0
  177. data/public/javascripts/mail_engine/fancybox/fancy_shadow_e.png +0 -0
  178. data/public/javascripts/mail_engine/fancybox/fancy_shadow_n.png +0 -0
  179. data/public/javascripts/mail_engine/fancybox/fancy_shadow_ne.png +0 -0
  180. data/public/javascripts/mail_engine/fancybox/fancy_shadow_nw.png +0 -0
  181. data/public/javascripts/mail_engine/fancybox/fancy_shadow_s.png +0 -0
  182. data/public/javascripts/mail_engine/fancybox/fancy_shadow_se.png +0 -0
  183. data/public/javascripts/mail_engine/fancybox/fancy_shadow_sw.png +0 -0
  184. data/public/javascripts/mail_engine/fancybox/fancy_shadow_w.png +0 -0
  185. data/public/javascripts/mail_engine/fancybox/fancy_title_left.png +0 -0
  186. data/public/javascripts/mail_engine/fancybox/fancy_title_main.png +0 -0
  187. data/public/javascripts/mail_engine/fancybox/fancy_title_over.png +0 -0
  188. data/public/javascripts/mail_engine/fancybox/fancy_title_right.png +0 -0
  189. data/public/javascripts/mail_engine/fancybox/fancybox-x.png +0 -0
  190. data/public/javascripts/mail_engine/fancybox/fancybox-y.png +0 -0
  191. data/public/javascripts/mail_engine/fancybox/fancybox.png +0 -0
  192. data/public/javascripts/mail_engine/fancybox/jquery.easing-1.3.pack.js +72 -0
  193. data/public/javascripts/mail_engine/fancybox/jquery.fancybox-1.3.4.css +359 -0
  194. data/public/javascripts/mail_engine/fancybox/jquery.fancybox-1.3.4.js +1156 -0
  195. data/public/javascripts/mail_engine/fancybox/jquery.fancybox-1.3.4.pack.js +46 -0
  196. data/public/javascripts/mail_engine/fancybox/jquery.mousewheel-3.0.4.pack.js +14 -0
  197. data/public/javascripts/mail_engine/jquery-ui.min.js +577 -0
  198. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/jquery.iframe-auto-height.plugin.js +0 -0
  199. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/jquery.string.js +0 -0
  200. data/{test/dummy/public/javascripts/mail_engine_application.js → public/javascripts/mail_engine/mail_engine.js} +0 -0
  201. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/jquery.markitup.js +0 -0
  202. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/bold.png +0 -0
  203. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/css.png +0 -0
  204. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/italic.png +0 -0
  205. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/picture.png +0 -0
  206. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/stroke.png +0 -0
  207. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/tag.png +0 -0
  208. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_align_center.png +0 -0
  209. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_align_justify.png +0 -0
  210. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_align_left.png +0 -0
  211. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_align_right.png +0 -0
  212. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_indent.png +0 -0
  213. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_letterspacing.png +0 -0
  214. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_linespacing.png +0 -0
  215. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_lowercase.png +0 -0
  216. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_padding_bottom.png +0 -0
  217. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_padding_left.png +0 -0
  218. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_padding_right.png +0 -0
  219. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_padding_top.png +0 -0
  220. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/images/text_uppercase.png +0 -0
  221. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/readme.txt +0 -0
  222. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/set.js +0 -0
  223. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/css/style.css +0 -0
  224. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/images/bold.png +0 -0
  225. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/images/clean.png +0 -0
  226. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/images/image.png +0 -0
  227. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/images/italic.png +0 -0
  228. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/images/link.png +0 -0
  229. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/images/picture.png +0 -0
  230. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/images/preview.png +0 -0
  231. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/images/stroke.png +0 -0
  232. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/set.js +0 -0
  233. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/default/style.css +0 -0
  234. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/bold.png +0 -0
  235. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/clean.png +0 -0
  236. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/h1.png +0 -0
  237. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/h2.png +0 -0
  238. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/h3.png +0 -0
  239. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/h4.png +0 -0
  240. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/h5.png +0 -0
  241. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/h6.png +0 -0
  242. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/image.png +0 -0
  243. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/italic.png +0 -0
  244. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/link.png +0 -0
  245. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/list-bullet.png +0 -0
  246. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/list-item.png +0 -0
  247. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/list-numeric.png +0 -0
  248. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/paragraph.png +0 -0
  249. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/picture.png +0 -0
  250. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/preview.png +0 -0
  251. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/images/stroke.png +0 -0
  252. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/readme.txt +0 -0
  253. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/set.js +0 -0
  254. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/sets/html/style.css +0 -0
  255. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-container.png +0 -0
  256. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
  257. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
  258. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor-html.png +0 -0
  259. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor-json.png +0 -0
  260. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
  261. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
  262. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
  263. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
  264. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/bg-editor.png +0 -0
  265. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/handle.png +0 -0
  266. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/menu.png +0 -0
  267. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/images/submenu.png +0 -0
  268. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/markitup/style.css +0 -0
  269. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/simple/images/handle.png +0 -0
  270. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/simple/images/menu.png +0 -0
  271. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/simple/images/submenu.png +0 -0
  272. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/skins/simple/style.css +0 -0
  273. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/templates/preview.css +0 -0
  274. data/{test/dummy/public/javascripts → public/javascripts/mail_engine}/markitup/templates/preview.html +0 -0
  275. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  276. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  277. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  278. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  279. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  280. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  281. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  282. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  283. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_222222_256x240.png +0 -0
  284. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  285. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_454545_256x240.png +0 -0
  286. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_888888_256x240.png +0 -0
  287. data/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  288. data/public/stylesheets/mail_engine/jquery-ui/smoothness/jquery-ui.css +544 -0
  289. data/{test/dummy/public/stylesheets → public/stylesheets/mail_engine}/style.css +6 -2
  290. data/test/dummy/app/controllers/application_controller.rb +0 -8
  291. data/test/dummy/app/models/user.rb +6 -4
  292. data/test/dummy/config/application.rb +2 -2
  293. data/test/dummy/config/database.yml +2 -2
  294. data/test/dummy/db/migrate/20110114030841_create_table_mail_template.rb +1 -0
  295. data/test/dummy/db/migrate/20110206025002_create_mail_logs.rb +1 -1
  296. data/test/dummy/db/schema.rb +1 -0
  297. data/test/dummy/public/images/mail_engine/icons/add.png +0 -0
  298. data/test/dummy/public/images/mail_engine/icons/copy.png +0 -0
  299. data/test/dummy/public/images/mail_engine/icons/delete.png +0 -0
  300. data/test/dummy/public/images/mail_engine/icons/edit.gif +0 -0
  301. data/test/dummy/public/images/mail_engine/icons/missing.png +0 -0
  302. data/test/dummy/public/images/mail_engine/icons/save.png +0 -0
  303. data/test/dummy/public/images/mail_engine/icons/show.png +0 -0
  304. data/test/dummy/public/javascripts/mail_engine/fancybox/blank.gif +0 -0
  305. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_close.png +0 -0
  306. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_loading.png +0 -0
  307. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_nav_left.png +0 -0
  308. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_nav_right.png +0 -0
  309. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_shadow_e.png +0 -0
  310. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_shadow_n.png +0 -0
  311. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_shadow_ne.png +0 -0
  312. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_shadow_nw.png +0 -0
  313. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_shadow_s.png +0 -0
  314. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_shadow_se.png +0 -0
  315. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_shadow_sw.png +0 -0
  316. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_shadow_w.png +0 -0
  317. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_title_left.png +0 -0
  318. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_title_main.png +0 -0
  319. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_title_over.png +0 -0
  320. data/test/dummy/public/javascripts/mail_engine/fancybox/fancy_title_right.png +0 -0
  321. data/test/dummy/public/javascripts/mail_engine/fancybox/fancybox-x.png +0 -0
  322. data/test/dummy/public/javascripts/mail_engine/fancybox/fancybox-y.png +0 -0
  323. data/test/dummy/public/javascripts/mail_engine/fancybox/fancybox.png +0 -0
  324. data/test/dummy/public/javascripts/mail_engine/fancybox/jquery.easing-1.3.pack.js +72 -0
  325. data/test/dummy/public/javascripts/mail_engine/fancybox/jquery.fancybox-1.3.4.css +359 -0
  326. data/test/dummy/public/javascripts/mail_engine/fancybox/jquery.fancybox-1.3.4.js +1156 -0
  327. data/test/dummy/public/javascripts/mail_engine/fancybox/jquery.fancybox-1.3.4.pack.js +46 -0
  328. data/test/dummy/public/javascripts/mail_engine/fancybox/jquery.mousewheel-3.0.4.pack.js +14 -0
  329. data/test/dummy/public/javascripts/mail_engine/jquery-ui.min.js +577 -0
  330. data/test/dummy/public/javascripts/mail_engine/jquery.iframe-auto-height.plugin.js +50 -0
  331. data/test/dummy/public/javascripts/mail_engine/jquery.string.js +425 -0
  332. data/test/dummy/public/javascripts/mail_engine/mail_engine.js +2 -0
  333. data/test/dummy/public/javascripts/mail_engine/markitup/jquery.markitup.js +564 -0
  334. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/bold.png +0 -0
  335. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/css.png +0 -0
  336. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/italic.png +0 -0
  337. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/picture.png +0 -0
  338. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/stroke.png +0 -0
  339. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/tag.png +0 -0
  340. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_align_center.png +0 -0
  341. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_align_justify.png +0 -0
  342. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_align_left.png +0 -0
  343. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_align_right.png +0 -0
  344. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_indent.png +0 -0
  345. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_letterspacing.png +0 -0
  346. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_linespacing.png +0 -0
  347. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_lowercase.png +0 -0
  348. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_padding_bottom.png +0 -0
  349. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_padding_left.png +0 -0
  350. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_padding_right.png +0 -0
  351. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_padding_top.png +0 -0
  352. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/images/text_uppercase.png +0 -0
  353. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/readme.txt +28 -0
  354. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/set.js +52 -0
  355. data/test/dummy/public/javascripts/mail_engine/markitup/sets/css/style.css +72 -0
  356. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/images/bold.png +0 -0
  357. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/images/clean.png +0 -0
  358. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/images/image.png +0 -0
  359. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/images/italic.png +0 -0
  360. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/images/link.png +0 -0
  361. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/images/picture.png +0 -0
  362. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/images/preview.png +0 -0
  363. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/images/stroke.png +0 -0
  364. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/set.js +27 -0
  365. data/test/dummy/public/javascripts/mail_engine/markitup/sets/default/style.css +27 -0
  366. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/bold.png +0 -0
  367. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/clean.png +0 -0
  368. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/h1.png +0 -0
  369. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/h2.png +0 -0
  370. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/h3.png +0 -0
  371. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/h4.png +0 -0
  372. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/h5.png +0 -0
  373. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/h6.png +0 -0
  374. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/image.png +0 -0
  375. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/italic.png +0 -0
  376. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/link.png +0 -0
  377. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/list-bullet.png +0 -0
  378. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/list-item.png +0 -0
  379. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/list-numeric.png +0 -0
  380. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/paragraph.png +0 -0
  381. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/picture.png +0 -0
  382. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/preview.png +0 -0
  383. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/images/stroke.png +0 -0
  384. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/readme.txt +11 -0
  385. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/set.js +40 -0
  386. data/test/dummy/public/javascripts/mail_engine/markitup/sets/html/style.css +59 -0
  387. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-container.png +0 -0
  388. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
  389. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
  390. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor-html.png +0 -0
  391. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor-json.png +0 -0
  392. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
  393. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
  394. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
  395. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
  396. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/bg-editor.png +0 -0
  397. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/handle.png +0 -0
  398. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/menu.png +0 -0
  399. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/images/submenu.png +0 -0
  400. data/test/dummy/public/javascripts/mail_engine/markitup/skins/markitup/style.css +147 -0
  401. data/test/dummy/public/javascripts/mail_engine/markitup/skins/simple/images/handle.png +0 -0
  402. data/test/dummy/public/javascripts/mail_engine/markitup/skins/simple/images/menu.png +0 -0
  403. data/test/dummy/public/javascripts/mail_engine/markitup/skins/simple/images/submenu.png +0 -0
  404. data/test/dummy/public/javascripts/mail_engine/markitup/skins/simple/style.css +118 -0
  405. data/test/dummy/public/javascripts/mail_engine/markitup/templates/preview.css +5 -0
  406. data/test/dummy/public/javascripts/mail_engine/markitup/templates/preview.html +11 -0
  407. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  408. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  409. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  410. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  411. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  412. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  413. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  414. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  415. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_222222_256x240.png +0 -0
  416. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  417. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_454545_256x240.png +0 -0
  418. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_888888_256x240.png +0 -0
  419. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  420. data/test/dummy/public/stylesheets/mail_engine/jquery-ui/smoothness/jquery-ui.css +544 -0
  421. data/test/dummy/public/stylesheets/mail_engine/style.css +685 -0
  422. data/test/factories.rb +31 -4
  423. data/test/functional/mail_engine/{mail_schedules_controller_controller_test.rb → dashboard_controller_test.rb} +2 -2
  424. data/test/functional/mail_engine/{mail_templates_controller_controller_test.rb → mail_logs_controller_test.rb} +2 -2
  425. data/test/functional/mail_engine/mail_schedules_controller_test.rb +8 -0
  426. data/test/functional/mail_engine/mail_template_files_controller_test.rb +8 -0
  427. data/test/functional/mail_engine/mail_templates_controller_test.rb +8 -0
  428. data/test/functional/mail_engine/reports_controller_test.rb +8 -0
  429. data/test/functional/user_mailer_test.rb +14 -0
  430. data/test/test_helper.rb +4 -1
  431. data/test/unit/mail_engine/mail_log_test.rb +1 -1
  432. data/test/unit/mail_engine/mail_schedule_test.rb +34 -1
  433. data/test/unit/mail_engine/mail_template_test.rb +51 -12
  434. data/test/unit/user_test.rb +20 -0
  435. metadata +370 -125
  436. data/.yardoc/objects/MailEngine/Base/send_mail_c.dat +0 -0
  437. data/.yardoc/objects/MailEngine/CreateMigration.dat +0 -0
  438. data/.yardoc/objects/MailEngine/CreateMigration/create_migrations_i.dat +0 -0
  439. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_filename_in_html_c.dat +0 -0
  440. data/.yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_url_in_html_c.dat +0 -0
  441. data/.yardoc/objects/PLACEHOLDERS_IN_LAYOUT.dat +0 -0
  442. data/lib/mail_engine/placeholders_in_layout.rb +0 -5
  443. data/test/dummy/public/javascripts/jquery.nyroModal/img/ajaxLoader.gif +0 -0
  444. data/test/dummy/public/javascripts/jquery.nyroModal/img/close.gif +0 -0
  445. data/test/dummy/public/javascripts/jquery.nyroModal/img/next.gif +0 -0
  446. data/test/dummy/public/javascripts/jquery.nyroModal/img/prev.gif +0 -0
  447. data/test/dummy/public/javascripts/jquery.nyroModal/js/jquery.nyroModal-ie6.js +0 -186
  448. data/test/dummy/public/javascripts/jquery.nyroModal/js/jquery.nyroModal-ie6.min.js +0 -9
  449. data/test/dummy/public/javascripts/jquery.nyroModal/js/jquery.nyroModal.custom.js +0 -1599
  450. data/test/dummy/public/javascripts/jquery.nyroModal/js/jquery.nyroModal.custom.min.js +0 -34
  451. data/test/dummy/public/javascripts/jquery.nyroModal/styles/nyroModal.css +0 -102
  452. data/test/dummy/public/stylesheets/.gitkeep +0 -0
data/README.mkd CHANGED
@@ -12,7 +12,7 @@ integration configuration to take advantage that system. (More information at ht
12
12
  6. Allow logging all sent mails, you can check which mail been sent to which user.
13
13
  7. You can know send the email to the active users, so that you don't need to waste your credits of sendgrid or amazon.
14
14
 
15
- Problem when using third part mail system
15
+ Problem when using third party mail system
16
16
  =========================================
17
17
  We are using mailchimp mostly for the newsletter solution, but it's has many problems that we have to make a new mail engine
18
18
  to fit our needs in real project:
@@ -33,6 +33,18 @@ Installation
33
33
 
34
34
  ** Step 2: **
35
35
 
36
+ Add management page needed javascript lib and css files, migration files and mail_engine_config.yml under config directory.
37
+
38
+ rails g mail_engine:install
39
+
40
+ ** Step 3: **
41
+
42
+ Run migration.
43
+
44
+ rake db:migrate
45
+
46
+ ** Step 4: **
47
+
36
48
  Add below line to the crontab list of your sever:
37
49
 
38
50
  ### check mail schedule for every 15 minutes ###
@@ -51,7 +63,7 @@ Mail Engine use Liquid template engine, so you can read the Liquid Reference at
51
63
 
52
64
  Steps:
53
65
 
54
- 1. Just create a template in mail engine.
66
+ 1. Create a template in mail engine.
55
67
 
56
68
  ** For Marketing Mail: **
57
69
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
@@ -4,4 +4,8 @@ class MailEngine::ApplicationController < ActionController::Base
4
4
  layout 'mail_engine/mail_engine'
5
5
  include MailEngine
6
6
  helper MailEngine::MailEngineHelper
7
+
8
+ def close_modal_and_refresh
9
+ render :text => "<script>parent.$.fancybox.close();parent.window.location.reload();</script>"
10
+ end
7
11
  end
@@ -2,7 +2,7 @@ class MailEngine::MailLogsController < MailEngine::ApplicationController
2
2
  before_filter :find_model
3
3
 
4
4
  def index
5
- @mail_logs = MailLog.order("created_at desc").paginate :page => params[:page], :per_page => 20
5
+ @mail_logs = MailLog.order("created_at desc").page(params[:page]).per(20)
6
6
  end
7
7
 
8
8
  def show
@@ -2,7 +2,7 @@ class MailEngine::MailSchedulesController < MailEngine::ApplicationController
2
2
  before_filter :find_model
3
3
 
4
4
  def index
5
- @mail_schedules = MailSchedule.paginate :page => params[:page], :per_page => 20
5
+ @mail_schedules = MailSchedule.order("created_at desc").page(params[:page]).per(20)
6
6
  end
7
7
 
8
8
  def show
@@ -43,10 +43,10 @@ class MailEngine::MailSchedulesController < MailEngine::ApplicationController
43
43
  end
44
44
 
45
45
  def send_test_mail
46
- @mail_schedule.send_test_mail_to!(params[:recipient])
47
- render :text => "alert('Test Mail sent to #{params[:recipient]}'); $('#recipient').val('');"
46
+ @mail_schedule.send_test_mail_to!(params[:recipient], params[:sample_user_id])
47
+ render :text => %Q{alert("Test Mail sent to #{params[:recipient]}"); $('#recipient').val('');}
48
48
  rescue => e
49
- render :text => "alert('Test Mail failed to send to #{params[:recipient]}, due to #{e.to_s}'); $('#recipient').val('');"
49
+ render :text => %Q{alert("Test Mail failed to send to #{params[:recipient]}, due to #{e.to_s}"); $('#recipient').val('');}
50
50
  end
51
51
 
52
52
  private
@@ -1,5 +1,5 @@
1
1
  class MailEngine::MailTemplateFilesController < MailEngine::ApplicationController
2
- layout :false
2
+ layout "mail_engine/simple"
3
3
  before_filter :find_model
4
4
 
5
5
  def index
@@ -10,9 +10,9 @@ class MailEngine::MailTemplateFilesController < MailEngine::ApplicationControlle
10
10
  end
11
11
 
12
12
  def create
13
- @mail_template_file = @mail_template.mail_template_files.new(params[:mail_engine_mail_template_file])
13
+ @mail_template_file = @mail_template.mail_template_files.build(params[:mail_engine_mail_template_file])
14
14
  if @mail_template_file.save
15
- redirect_to edit_mail_template_path(@mail_template)
15
+ close_modal_and_refresh
16
16
  else
17
17
  render :new
18
18
  end
@@ -23,7 +23,7 @@ class MailEngine::MailTemplateFilesController < MailEngine::ApplicationControlle
23
23
 
24
24
  def update
25
25
  if @mail_template_file.update_attributes(params[:mail_engine_mail_template_file])
26
- redirect_to edit_mail_template_path(@mail_template)
26
+ close_modal_and_refresh
27
27
  else
28
28
  render :edit
29
29
  end
@@ -14,7 +14,7 @@ class MailEngine::MailTemplatesController < MailEngine::ApplicationController
14
14
  return
15
15
  end
16
16
 
17
- @mail_templates = @mail_templates.group("path").paginate :page => params[:page], :per_page => 20
17
+ @mail_templates = @mail_templates.group("path").page(params[:page]).per(20)
18
18
  end
19
19
 
20
20
  def show
@@ -47,14 +47,14 @@ class MailEngine::MailTemplatesController < MailEngine::ApplicationController
47
47
  if request.put?
48
48
  @duplicated_mail_template = @mail_template.duplicate(params[:mail_engine_mail_template])
49
49
  if @duplicated_mail_template.errors.blank?
50
- redirect_to mail_templates_path(:type => params[:type])
50
+ close_modal_and_refresh
51
51
  return
52
52
  end
53
53
  else
54
54
  @duplicated_mail_template = @mail_template
55
55
  end
56
56
 
57
- render :layout => false
57
+ render :layout => "mail_engine/simple"
58
58
  end
59
59
 
60
60
  def destroy
@@ -76,7 +76,12 @@ class MailEngine::MailTemplatesController < MailEngine::ApplicationController
76
76
  end
77
77
 
78
78
  def new
79
- @mail_template = MailTemplate.new :layout => 'none'
79
+ @mail_template = MailTemplate.new :layout => 'none', :partial => params[:type] == 'partial'
80
+ end
81
+
82
+ def get_existed_subject
83
+ subject = MailTemplate.get_subject_from_bother_template(params[:path], params[:locale], params[:for_marketing] == 'true')
84
+ render :text => %Q{#{subject}}
80
85
  end
81
86
 
82
87
  def new_by_upload
@@ -118,7 +123,7 @@ class MailEngine::MailTemplatesController < MailEngine::ApplicationController
118
123
 
119
124
  def update
120
125
  if @mail_template.update_attributes(params[:mail_engine_mail_template])
121
- redirect_to mail_template_path(@mail_template), :notice => 'Mail template was successfully created.'
126
+ redirect_to mail_template_path(@mail_template), :notice => 'Mail template was successfully updated.'
122
127
  else
123
128
  render "edit"
124
129
  end
@@ -127,12 +132,12 @@ class MailEngine::MailTemplatesController < MailEngine::ApplicationController
127
132
  def edit
128
133
  end
129
134
 
130
- def send_test_mail
131
- @mail_template.send_test_mail_to!(params[:recipient])
132
- render :text => "alert('Test Mail sent to #{params[:recipient]}'); $('#recipient').val('');"
133
- rescue => e
134
- render :text => "alert(\"Test Mail failed to send to #{params[:recipient]}, due to #{e.to_s}\"); $('#recipient').val('');"
135
- end
135
+ # def send_test_mail
136
+ # @mail_template.send_test_mail_to!(params[:recipient])
137
+ # render :text => "alert('Test Mail sent to #{params[:recipient]}'); $('#recipient').val('');"
138
+ # rescue => e
139
+ # render :text => "alert(\"Test Mail failed to send to #{params[:recipient]}, due to #{e.to_s}\"); $('#recipient').val('');"
140
+ # end
136
141
 
137
142
  private
138
143
  def find_model
@@ -18,7 +18,11 @@ class MailEngine::ReportsController < MailEngine::ApplicationController
18
18
  "repeat_unsubscribes"
19
19
  ]
20
20
 
21
- @stats_data = MailEngine::Sendgrid::RestApi.stats(:days => 6)
21
+ @stats_data = if params[:report] and params[:report][:from] and params[:report][:to]
22
+ MailEngine::Sendgrid::RestApi.stats(:start_date => params[:report][:from], :end_date => params[:report][:to])
23
+ else
24
+ MailEngine::Sendgrid::RestApi.stats(:days => 6)
25
+ end
22
26
  @data_of_today = @stats_data.last
23
27
  end
24
28
 
@@ -2,7 +2,7 @@ module MailEngine
2
2
  module MailEngineHelper
3
3
 
4
4
  def show_no_record collection, &block
5
- if collection.blank?
5
+ if collection.all.blank?
6
6
  return raw("<div class='notice' style='margin-top:10px'>No Record</div>")
7
7
  else
8
8
  block.call
@@ -1,7 +1,7 @@
1
1
  class MailEngine::MailDispatcher < ActionMailer::Base
2
2
  default :from => "info@itjob.fm"
3
3
  sendgrid_header do
4
- category "itjob_test"
4
+ category MailEngine::Base.current_config["sendgrid_category"]
5
5
 
6
6
  filters {
7
7
  opentrack "enable" => 1
@@ -14,26 +14,33 @@ class MailEngine::MailDispatcher < ActionMailer::Base
14
14
 
15
15
  protected
16
16
 
17
+ ###
18
+ # MailEngine::MailDispatcher.{any template name}(
19
+ # :subject => 'hello',
20
+ # :to => 'm@theplant.jp',
21
+ # :values => {:username => @user.name}
22
+ # ).deliver
23
+ #
17
24
  def self.method_missing(method, *args)
18
25
  return super if respond_to?(method) # basically it won't unless subclass
19
26
 
27
+ options = args.dup.extract_options!
28
+ options[:locale] ||= I18n.locale
29
+
20
30
  # TODO if template file exists, don't need to exam the db.
21
- templates = MailEngine::MailTemplate.where(:path => method).order('format desc').all
31
+ templates = MailEngine::MailTemplate.where(:path => method, :locale => options[:locale], :for_marketing => true, :partial => false).order('format desc').all
22
32
  raise "No Template added." if templates.blank?
23
33
 
34
+ subject = templates.first.subject
24
35
  formats = templates.map {|t| "format.#{t.format}" }.sort.reverse
25
36
 
26
- ###
27
- # MailEngine::MailDispatcher.{any template name}(
28
- # :subject => 'hello',
29
- # :to => 'm@theplant.jp',
30
- # :values => {:username => @user.name}
31
- # ).deliver
32
- #
37
+ # generate the method for db template.
33
38
  class_eval <<-METHOD
34
39
  def #{method} options
35
40
  ### extract mail options, used for mail method.
36
41
  mail_options = {}
42
+ mail_options[:subject] = "#{%Q{#{subject}}}"
43
+
37
44
  options.delete_if {|key, value|
38
45
  if [:subject, :to, :from, :cc, :bcc, :reply_to, :date].include?(key.to_sym)
39
46
  mail_options[key] = value
@@ -1,4 +1,4 @@
1
- class MailEngine::MailLog < ActiveRecord::Base
1
+ class MailEngine::MailLog < ActiveRecord::Base
2
2
  validates_presence_of :mail_template_path
3
3
 
4
4
  # Callback of Mail gem when delivering mails
@@ -1,9 +1,14 @@
1
1
  class MailEngine::MailSchedule < ActiveRecord::Base
2
2
  validates_presence_of :name, :user_group, :mail_template_id, :period, :count, :first_send_at
3
3
  belongs_to :mail_template
4
-
5
4
  scope :available, where("sent_count < count OR count = 0")
6
5
 
6
+ # list mail log with the same mail_template_path to current mail_template's path
7
+ def logs(count = 10)
8
+ MailEngine::MailLog.where(:mail_template_path => self.mail_template.actual_path).order("id desc").limit(count)
9
+ end
10
+
11
+ # load user info into payload hash used at mail template.
7
12
  def load_payload user
8
13
  payload_hash = {}
9
14
  self.payload.split(",").each do |col|
@@ -12,17 +17,13 @@ class MailEngine::MailSchedule < ActiveRecord::Base
12
17
  payload_hash
13
18
  end
14
19
 
15
- def send_test_mail_to!(recipient)
16
- # raise "Wrong email format." if recipient.blank? or recipient !~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
17
- sample_user = User.send(self.user_group.to_sym).first
18
- raise "Can not find any user in group #{self.user_group}" if sample_user.blank?
20
+ # send test mail to specific recipient email address, with loading sample_user's data.
21
+ def send_test_mail_to!(recipient, sample_user_id)
22
+ raise "Wrong email format." if recipient.blank? or recipient !~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
23
+ sample_user = MailEngine::USER_MODEL.find(sample_user_id)
19
24
 
20
25
  I18n.with_locale(mail_template.locale) do
21
- MailEngine::MailDispatcher.send(
22
- mail_template.template_name.to_sym,
23
- :to => recipient,
24
- :values => self.load_payload(sample_user)
25
- ).deliver
26
+ MailEngine::MailDispatcher.send( mail_template.template_name.to_sym, :to => recipient, :values => self.load_payload(sample_user) ).deliver
26
27
  end
27
28
  end
28
29
 
@@ -50,15 +51,16 @@ class MailEngine::MailSchedule < ActiveRecord::Base
50
51
  ready_to_send or (not_sent_mail_within_15_minutes and result_by_period)
51
52
  end
52
53
 
54
+ # used in Rake task, the main mail sending method.
53
55
  def sendmail
54
- puts "---> Schedule: '#{self.name}'"
56
+ puts "---> Schedule: '#{self.name}'" if Rails.env != 'test'
55
57
 
56
58
  unless ready_to_send?
57
59
  puts "---> not ready"
58
60
  return false
59
61
  end
60
62
 
61
- User.send(self.user_group.to_sym).each do |user|
63
+ MailEngine::USER_MODEL.send(self.user_group.to_sym).each do |user|
62
64
  puts "-> sending mail to #{user.email}"
63
65
  MailEngine::MailDispatcher.send(mail_template.template_name.to_sym, :to => user.email, :values => self.load_payload(user) ).deliver
64
66
  end
@@ -4,19 +4,20 @@ class MailEngine::MailTemplate < ActiveRecord::Base
4
4
  mount_uploader :zip_file, MailEngine::ZipFileUploader
5
5
 
6
6
  validates :name, :path, :presence => true
7
+ validates :subject, :presence => true, :if => Proc.new { |template| !template.partial? }
7
8
  validates :locale, :inclusion => I18n.available_locales.map(&:to_s)
8
9
  validates :format, :inclusion => Mime::SET.symbols.map(&:to_s)
9
10
  validates :layout, :presence => true, :if => Proc.new {|template| !template.partial? }
10
11
  validates :body, :presence => true, :if => Proc.new {|template| template.create_by_upload.blank? }
11
12
  validates :zip_file, :presence => true, :if => Proc.new {|template| template.create_by_upload.present? }
12
13
  validates :path, :format => { :with => /([^\/]+\/)+/i, :message => "path should looks like 'controller/action'" }, :if => Proc.new { |template| !template.for_marketing? }
14
+ validates :path, :format => { :with => /^[a-z\_]+$/i, :message => "path should be consisted of english character and underscore." }, :if => Proc.new { |template| template.for_marketing? }
13
15
  # validates :handler, :inclusion => ActionView::Template::Handlers.extensions.map(&:to_s)
14
16
  validates_uniqueness_of :path, :scope => [:locale, :handler, :format, :partial]
15
-
16
17
  after_validation :check_placeholders_for_layout
17
18
  before_validation :check_zip_file, :if => Proc.new {|template| template.create_by_upload.present? }
18
19
 
19
- has_many :mail_schedules
20
+ has_many :mail_schedules, :dependent => :nullify
20
21
  has_many :template_partials, :dependent => :destroy
21
22
  has_many :partials, :through => :template_partials
22
23
  has_many :mail_template_files
@@ -34,25 +35,53 @@ class MailEngine::MailTemplate < ActiveRecord::Base
34
35
 
35
36
  after_create :process_zip_file
36
37
  before_save :delete_partials_if_new_partials_added
37
-
38
38
  after_save do
39
- MailEngine::MailTemplate::Resolver.instance.clear_cache # clear cached paths
39
+ # clear cached paths
40
+ MailEngine::MailTemplate::Resolver.instance.clear_cache
41
+
42
+ # update subject
43
+ MailEngine::MailTemplate.update_all(["subject=?", self.subject], ["path = ? AND locale = ?", self.path, self.locale])
44
+ end
45
+
46
+ # class methods
47
+ class << self
48
+ def get_subject_from_bother_template(path, locale, for_marketing)
49
+ return nil if path.blank?
50
+ MailEngine::MailTemplate.where(:path => path, :locale => locale, :for_marketing => for_marketing, :partial => false).select("subject").first.try(:subject)
51
+ end
40
52
  end
41
53
 
54
+ # detect if current partial template is used by other templates.
42
55
  def partial_in_use?
43
56
  self.partial? and self.mail_templates.count > 0
44
57
  end
45
58
 
59
+ # list the templates with same path, but different locale and format
46
60
  def variations
47
- self.class.where(:path => self.path).order("locale, format")
61
+ existed_variations = self.class.where(:path => self.path, :partial => false).order("locale, format")
62
+
63
+ all_variation_codes = I18n.available_locales.product([:html, :text])
64
+ existed_variation_codes = existed_variations.map do |template|
65
+ [template.locale.to_sym, template.format.to_sym]
66
+ end
67
+ missing_variations = (all_variation_codes - existed_variation_codes).map do |locale, format|
68
+ MailEngine::MailTemplate.new :locale => locale.to_s, :format => format.to_s
69
+ end
70
+
71
+ missing_variations + existed_variations
72
+ end
73
+
74
+ def actual_path
75
+ return "mail_engine/mail_dispatcher/#{self.path}" if self.for_marketing?
76
+ self.path
48
77
  end
49
78
 
50
79
  # has_many :logs, :class_name => "MailEngine::MailLog", :conditions => {:mail_template_path => self.path}
51
80
  def logs
52
- MailEngine::MailLog.where(:mail_template_path => self.path)
81
+ MailEngine::MailLog.where(:mail_template_path => self.actual_path).order("id desc").limit(10)
53
82
  end
54
83
 
55
- # TODOS: if no changes just keep the same, it sill will remove the template partial and add a new one
84
+ # FIXME: if no changes just keep the same, it sill will remove the template partial and add a new one
56
85
  def delete_partials_if_new_partials_added
57
86
  if self.template_partials.detect {|tmp| !tmp.persisted? }.present? || self.layout == 'none' # has new partials selected
58
87
  MailEngine::TemplatePartial.destroy_all(:mail_template_id => self) # remove previous partials
@@ -115,6 +144,7 @@ class MailEngine::MailTemplate < ActiveRecord::Base
115
144
  return 'marketing' if self.for_marketing?
116
145
  end
117
146
 
147
+ # controller/action_name => for get the action_name
118
148
  def template_name
119
149
  self.path.scan(/[^\/]+$/).first
120
150
  end
@@ -133,23 +163,16 @@ class MailEngine::MailTemplate < ActiveRecord::Base
133
163
  "#{filename}.#{self.locale}.#{self.format}.#{self.handler}"
134
164
  end
135
165
 
136
- # return one clone version of self
166
+ # return one clone version of self with all duplicated relations.
137
167
  def duplicate merge_options = {}
138
- ### create dictionary for custom cloning file object.
139
- # dict = { :mail_template_files => {} }
140
- # self.mail_template_files.each{ |f|
141
- # clone_file = f.clone
142
- # clone_file.file = File.open(f.file.path)
143
- # dict[:mail_template_files][f] = clone_file
144
- # }
145
-
146
168
  # start to clone
147
169
  duplicated_obj = self.clone :except => [:zip_file], :include => [:template_partials, :mail_template_files]
148
- duplicated_obj.zip_file = File.open(self.zip_file.path) if self.zip_file.path
149
- duplicated_obj.attributes = merge_options if merge_options.is_a? Hash
170
+ duplicated_obj.zip_file = File.open(self.zip_file.path) if self.zip_file.path # it will make a copy version of zipfile
171
+ duplicated_obj.attributes = merge_options if merge_options.is_a? Hash # merge custom options
150
172
  # without saving can't not create files. so save it first.
151
173
  duplicated_obj.save
152
174
 
175
+ ### below code is used to clone mail_template_files and replace the new url for cloned template body.
153
176
  # pair the mail_template_files and insert into substitution_array.
154
177
  substitution_pair_array = []
155
178
  self.mail_template_files.each_with_index do |origin_file, index|
@@ -160,52 +183,55 @@ class MailEngine::MailTemplate < ActiveRecord::Base
160
183
  original_body = self.body
161
184
 
162
185
  substitution_pair_array.each do |origin_file, new_file|
163
- original_body = MailEngine::HtmlDocumentAssetsReplacer.replace_resource_url_in_html(
186
+ original_body = MailEngine::HtmlDocumentAssetsReplacer.replace_resource_in_html(
164
187
  original_body,
165
188
  origin_file.file.url,
166
- new_file.file.url
189
+ new_file.file.url,
190
+ :url
167
191
  )
168
192
  end
169
193
 
170
- # FIXME save twice here. but if not save the resource won't get correct url.
194
+ # write back the new body with cloned resource urls.
171
195
  duplicated_obj.update_attributes :body => original_body
172
196
  duplicated_obj
173
197
  end
174
198
 
175
- def send_test_mail_to!(recipient)
176
- # raise "Wrong email format." if recipient.blank? or recipient !~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
177
- raise "Can not find any user." if (sample_user = User.first).blank?
178
-
179
- ### 3 conditions
180
- # 1. action - marketing mail only have one action
181
- # 2. controler/action
182
- # 3. namespace/namespace/controller/action
183
- #
184
- path_sections = self.path.split("/")
185
-
186
- if self.for_marketing?
187
- action_name = path_sections.last
188
- mailer_class_name = "MailEngine::MailDispatcher"
189
- else
190
- mailer_name = path_sections[-2]
191
- action_name = path_sections[-1]
192
- namespaces = path_sections - Array.wrap(path_sections[-2..-1])
193
-
194
- if namespaces.present?
195
- mailer_class_name = namespaces.map(&:classify).join("::")
196
- mailer_class_name += "::#{mailer_name.classify}"
197
- else
198
- mailer_class_name = "#{mailer_name.classify}"
199
- end
200
- end
201
-
202
- I18n.with_locale(self.locale) do
203
- mailer_class_name.constantize.send(
204
- action_name.to_sym,
205
- :to => recipient
206
- ).deliver
207
- end
208
- end
199
+ # def send_test_mail_to!(recipient)
200
+ # # raise "Wrong email format." if recipient.blank? or recipient !~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
201
+ # raise "Can not find any user." if (sample_user = MailEngine::USER_MODEL.first).blank?
202
+ #
203
+ # ### 3 conditions
204
+ # # 1. action - marketing mail only have one action
205
+ # # 2. controler/action
206
+ # # 3. namespace/namespace/controller/action
207
+ # #
208
+ # path_sections = self.path.split("/")
209
+ #
210
+ # # marketing mail
211
+ # if self.for_marketing?
212
+ # action_name = path_sections.last
213
+ # mailer_class_name = "MailEngine::MailDispatcher"
214
+ # else
215
+ # mailer_name = path_sections[-2]
216
+ # action_name = path_sections[-1]
217
+ # namespaces = path_sections - Array.wrap(path_sections[-2..-1])
218
+ #
219
+ # if namespaces.present?
220
+ # mailer_class_name = namespaces.map(&:classify).join("::")
221
+ # mailer_class_name += "::#{mailer_name.classify}"
222
+ # else
223
+ # mailer_class_name = "#{mailer_name.classify}"
224
+ # end
225
+ # end
226
+ #
227
+ # # send mail.
228
+ # I18n.with_locale(self.locale) do
229
+ # mailer_class_name.constantize.send(
230
+ # action_name.to_sym,
231
+ # :to => recipient
232
+ # ).deliver
233
+ # end
234
+ # end
209
235
 
210
236
 
211
237
  ###############################