dm_cms 4.2.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (298) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +22 -0
  3. data/README.md +31 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/javascripts/dm_cms/admin.js +58 -0
  6. data/app/assets/javascripts/dm_cms/application.js +16 -0
  7. data/app/assets/stylesheets/dm_cms/admin.css +3 -0
  8. data/app/assets/stylesheets/dm_cms/application.css +13 -0
  9. data/app/controllers/dm_cms/admin/admin_controller.rb +14 -0
  10. data/app/controllers/dm_cms/admin/cms_blogs_controller.rb +89 -0
  11. data/app/controllers/dm_cms/admin/cms_contentitems_controller.rb +96 -0
  12. data/app/controllers/dm_cms/admin/cms_pages_controller.rb +100 -0
  13. data/app/controllers/dm_cms/admin/cms_posts_controller.rb +67 -0
  14. data/app/controllers/dm_cms/admin/cms_snippets_controller.rb +73 -0
  15. data/app/controllers/dm_cms/admin/dashboard_controller.rb +12 -0
  16. data/app/controllers/dm_cms/admin/media_files_controller.rb +80 -0
  17. data/app/controllers/dm_cms/application_controller.rb +9 -0
  18. data/app/controllers/dm_cms/blogs_controller.rb +50 -0
  19. data/app/controllers/dm_cms/comments_controller.rb +3 -0
  20. data/app/controllers/dm_cms/contact_form_controller.rb +27 -0
  21. data/app/controllers/dm_cms/pages_controller.rb +67 -0
  22. data/app/controllers/dm_cms/posts_controller.rb +69 -0
  23. data/app/datatables/blog_user_datatable.rb +79 -0
  24. data/app/helpers/dm_cms/analytics_helper.rb +27 -0
  25. data/app/helpers/dm_cms/application_helper.rb +4 -0
  26. data/app/helpers/dm_cms/cms_contentitems_helper.rb +8 -0
  27. data/app/helpers/dm_cms/cms_pages_helper.rb +30 -0
  28. data/app/helpers/dm_cms/pages_helper.rb +204 -0
  29. data/app/helpers/dm_cms/posts_helper.rb +26 -0
  30. data/app/helpers/dm_cms/render_helper.rb +50 -0
  31. data/app/inputs/media_input.rb +17 -0
  32. data/app/liquid/tags/markdown.rb +30 -0
  33. data/app/mailers/post_notify_mailer.rb +36 -0
  34. data/app/models/cms_blog.rb +89 -0
  35. data/app/models/cms_contentitem.rb +76 -0
  36. data/app/models/cms_page.rb +227 -0
  37. data/app/models/cms_post.rb +76 -0
  38. data/app/models/cms_snippet.rb +42 -0
  39. data/app/models/contact_form.rb +28 -0
  40. data/app/models/dm_cms/concerns/ability.rb +54 -0
  41. data/app/models/dm_cms/permitted_params.rb +34 -0
  42. data/app/models/media_file.rb +102 -0
  43. data/app/presenters/cms_blog_presenter.rb +15 -0
  44. data/app/presenters/cms_page_presenter.rb +23 -0
  45. data/app/presenters/cms_post_presenter.rb +11 -0
  46. data/app/presenters/cms_snippet_presenter.rb +10 -0
  47. data/app/uploaders/media_uploader.rb +169 -0
  48. data/app/views/customized/analytics/_google_analytics.html.erb +11 -0
  49. data/app/views/dm_cms/admin/cms_blogs/_form.html.erb +34 -0
  50. data/app/views/dm_cms/admin/cms_blogs/edit.html.erb +2 -0
  51. data/app/views/dm_cms/admin/cms_blogs/index.html.erb +44 -0
  52. data/app/views/dm_cms/admin/cms_blogs/new.html.erb +2 -0
  53. data/app/views/dm_cms/admin/cms_blogs/show.html.erb +167 -0
  54. data/app/views/dm_cms/admin/cms_contentitems/_form.html.erb +43 -0
  55. data/app/views/dm_cms/admin/cms_contentitems/_form_dialog.html.erb +17 -0
  56. data/app/views/dm_cms/admin/cms_contentitems/edit.html.erb +1 -0
  57. data/app/views/dm_cms/admin/cms_contentitems/markdown.html.erb +21 -0
  58. data/app/views/dm_cms/admin/cms_contentitems/new_content.html.erb +1 -0
  59. data/app/views/dm_cms/admin/cms_pages/_content_toolbar.html.erb +11 -0
  60. data/app/views/dm_cms/admin/cms_pages/_form.html.erb +50 -0
  61. data/app/views/dm_cms/admin/cms_pages/_tree.html.erb +20 -0
  62. data/app/views/dm_cms/admin/cms_pages/_tree_sidebar.html.erb +8 -0
  63. data/app/views/dm_cms/admin/cms_pages/edit.html.erb +2 -0
  64. data/app/views/dm_cms/admin/cms_pages/index.html.erb +32 -0
  65. data/app/views/dm_cms/admin/cms_pages/new_page.html.erb +2 -0
  66. data/app/views/dm_cms/admin/cms_pages/show.html.erb +54 -0
  67. data/app/views/dm_cms/admin/cms_posts/_form.html.erb +59 -0
  68. data/app/views/dm_cms/admin/cms_posts/edit.html.erb +2 -0
  69. data/app/views/dm_cms/admin/cms_posts/new.html.erb +1 -0
  70. data/app/views/dm_cms/admin/cms_snippets/_form.html.erb +28 -0
  71. data/app/views/dm_cms/admin/cms_snippets/edit.html.erb +1 -0
  72. data/app/views/dm_cms/admin/cms_snippets/index.html.erb +29 -0
  73. data/app/views/dm_cms/admin/cms_snippets/new.html.erb +1 -0
  74. data/app/views/dm_cms/admin/dashboard/_widget_blog_comments.html.erb +37 -0
  75. data/app/views/dm_cms/admin/dashboard/widget_blog_comments.js.erb +1 -0
  76. data/app/views/dm_cms/admin/media_files/_form.html.erb +102 -0
  77. data/app/views/dm_cms/admin/media_files/edit.html.erb +3 -0
  78. data/app/views/dm_cms/admin/media_files/index.html.erb +98 -0
  79. data/app/views/dm_cms/admin/media_files/new.html.erb +3 -0
  80. data/app/views/dm_cms/admin/shared/_liquid_tags_ref.html.erb +35 -0
  81. data/app/views/dm_cms/blogs/show.html.erb +0 -0
  82. data/app/views/dm_cms/blogs/toggle_follow.js.coffee +5 -0
  83. data/app/views/dm_cms/contact_form/create.html.erb +2 -0
  84. data/app/views/dm_cms/contact_form/create.js.erb +2 -0
  85. data/app/views/dm_cms/pages/_content_fragment.html.erb +13 -0
  86. data/app/views/dm_cms/pages/_snippet_fragment.html.erb +12 -0
  87. data/app/views/dm_cms/pages/coming_soon.html.erb +2 -0
  88. data/app/views/dm_cms/pages/show.html.erb +0 -0
  89. data/app/views/dm_cms/posts/show.html.erb +0 -0
  90. data/app/views/dm_cms/shared/_comment.html.erb +22 -0
  91. data/app/views/dm_cms/shared/_comment_form.html.erb +16 -0
  92. data/app/views/dm_cms/shared/_comment_list.html.erb +11 -0
  93. data/app/views/dm_cms/shared/_social_buttons.html.erb +6 -0
  94. data/app/views/layouts/email_templates/dm_cms_email_layout.html.erb +320 -0
  95. data/app/views/layouts/email_templates/dm_cms_email_layout.text.erb +1 -0
  96. data/app/views/layouts/email_templates/dm_cms_post_notify.html.erb +13 -0
  97. data/app/views/layouts/email_templates/dm_cms_post_notify.text.erb +9 -0
  98. data/app/views/liquid_tags/_contact_form.html.erb +17 -0
  99. data/config/initializers/liquid_init.rb +2 -0
  100. data/config/locales/cms.cs.yml +42 -0
  101. data/config/locales/cms.de.yml +42 -0
  102. data/config/locales/cms.en.yml +42 -0
  103. data/config/locales/cms.fi.yml +42 -0
  104. data/config/locales/cms.ja.yml +42 -0
  105. data/config/routes.rb +70 -0
  106. data/db/migrate/20121103181909_create_cms.rb +91 -0
  107. data/db/migrate/20130206213720_add_account_to_cms.rb +10 -0
  108. data/db/migrate/20130507123255_create_blog.rb +61 -0
  109. data/db/migrate/20130531212537_add_notification_sent.rb +5 -0
  110. data/db/migrate/20130605184116_add_blog_comment.rb +7 -0
  111. data/db/migrate/20131128201053_add_blog_image.rb +5 -0
  112. data/db/migrate/20140217135228_rename_snippet_slug.rb +13 -0
  113. data/db/migrate/20140303121217_add_requires_subscription_blog.rb +7 -0
  114. data/db/migrate/20140328205246_add_pages_ranked_model.rb +22 -0
  115. data/db/migrate/20140423113417_add_blog_owner.rb +6 -0
  116. data/db/migrate/20140428122156_create_media_files.rb +29 -0
  117. data/db/migrate/20140523134543_add_cmspage_summary.rb +6 -0
  118. data/db/migrate/20140601151631_add_blog_image_email_header.rb +5 -0
  119. data/db/migrate/20141004154725_add_header_image.rb +9 -0
  120. data/db/migrate/20160821150108_index_foreign_keys_in_cms_blogs.rb +6 -0
  121. data/db/migrate/20160821150109_index_foreign_keys_in_cms_media_files.rb +6 -0
  122. data/db/migrate/20160821150110_index_foreign_keys_in_cms_posts.rb +6 -0
  123. data/lib/dm_cms.rb +4 -0
  124. data/lib/dm_cms/engine.rb +16 -0
  125. data/lib/dm_cms/liquid/filters/liquid_filters.rb +11 -0
  126. data/lib/dm_cms/liquid/tags/contact_form.rb +35 -0
  127. data/lib/dm_cms/liquid/tags/div.rb +42 -0
  128. data/lib/dm_cms/liquid/tags/image.rb +76 -0
  129. data/lib/dm_cms/liquid/tags/quote.rb +38 -0
  130. data/lib/dm_cms/liquid/tags/snippet.rb +37 -0
  131. data/lib/dm_cms/liquid/tags/url_asset.rb +41 -0
  132. data/lib/dm_cms/liquid/tags/url_media.rb +42 -0
  133. data/lib/dm_cms/liquid/tags/url_protected.rb +31 -0
  134. data/lib/tasks/dm_cms_tasks.rake +4 -0
  135. data/spec/controllers/admin/cms_blogs_controller_spec.rb +173 -0
  136. data/spec/controllers/admin/cms_pages_controller_spec.rb +182 -0
  137. data/spec/controllers/admin/cms_posts_controller_spec.rb +166 -0
  138. data/spec/dummy/README.rdoc +28 -0
  139. data/spec/dummy/Rakefile +6 -0
  140. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  141. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  142. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  143. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  144. data/spec/dummy/app/models/ability.rb +12 -0
  145. data/spec/dummy/app/models/user.rb +6 -0
  146. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  147. data/spec/dummy/bin/bundle +3 -0
  148. data/spec/dummy/bin/rails +4 -0
  149. data/spec/dummy/bin/rake +4 -0
  150. data/spec/dummy/config.ru +4 -0
  151. data/spec/dummy/config/application.rb +26 -0
  152. data/spec/dummy/config/boot.rb +5 -0
  153. data/spec/dummy/config/database.yml +25 -0
  154. data/spec/dummy/config/environment.rb +5 -0
  155. data/spec/dummy/config/environments/development.rb +37 -0
  156. data/spec/dummy/config/environments/production.rb +82 -0
  157. data/spec/dummy/config/environments/test.rb +39 -0
  158. data/spec/dummy/config/initializers/_themes_for_rails.rb +39 -0
  159. data/spec/dummy/config/initializers/account_initialization.rb +28 -0
  160. data/spec/dummy/config/initializers/assets.rb +8 -0
  161. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  162. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  163. data/spec/dummy/config/initializers/dm_core.rb +6 -0
  164. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  165. data/spec/dummy/config/initializers/inflections.rb +16 -0
  166. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  167. data/spec/dummy/config/initializers/session_store.rb +3 -0
  168. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  169. data/spec/dummy/config/locales/en.yml +23 -0
  170. data/spec/dummy/config/routes.rb +19 -0
  171. data/spec/dummy/config/secrets.yml +22 -0
  172. data/spec/dummy/db/development.sqlite3 +0 -0
  173. data/spec/dummy/db/migrate/20141114170927_add_globalize_countries.dm_core.rb +50 -0
  174. data/spec/dummy/db/migrate/20141114170928_devise_create_users.dm_core.rb +46 -0
  175. data/spec/dummy/db/migrate/20141114170929_add_user_fields.dm_core.rb +14 -0
  176. data/spec/dummy/db/migrate/20141114170930_rolify_create_roles.dm_core.rb +20 -0
  177. data/spec/dummy/db/migrate/20141114170931_add_last_access.dm_core.rb +10 -0
  178. data/spec/dummy/db/migrate/20141114170932_create_versions.dm_core.rb +19 -0
  179. data/spec/dummy/db/migrate/20141114170933_add_object_changes_column_to_versions.dm_core.rb +12 -0
  180. data/spec/dummy/db/migrate/20141114170934_create_dm_core_accounts.dm_core.rb +13 -0
  181. data/spec/dummy/db/migrate/20141114170935_add_account_to_users.dm_core.rb +9 -0
  182. data/spec/dummy/db/migrate/20141114170936_create_preferences.dm_core.rb +13 -0
  183. data/spec/dummy/db/migrate/20141114170937_create_comments.dm_core.rb +22 -0
  184. data/spec/dummy/db/migrate/20141114170938_add_activity.dm_core.rb +21 -0
  185. data/spec/dummy/db/migrate/20141114170939_add_type_to_comments.dm_core.rb +9 -0
  186. data/spec/dummy/db/migrate/20141114170940_add_category.dm_core.rb +28 -0
  187. data/spec/dummy/db/migrate/20141114170941_create_email_table.dm_core.rb +26 -0
  188. data/spec/dummy/db/migrate/20141114170942_add_user_profile.dm_core.rb +46 -0
  189. data/spec/dummy/db/migrate/20141114170943_add_profile_email.dm_core.rb +14 -0
  190. data/spec/dummy/db/migrate/20141114170944_create_payment_history.dm_core.rb +37 -0
  191. data/spec/dummy/db/migrate/20141114170945_change_anchor_field.dm_core.rb +10 -0
  192. data/spec/dummy/db/migrate/20141114170946_create_user_site_profile.dm_core.rb +27 -0
  193. data/spec/dummy/db/migrate/20141114170947_add_avatar.dm_core.rb +12 -0
  194. data/spec/dummy/db/migrate/20141114170948_add_notify_to_payment_history.dm_core.rb +8 -0
  195. data/spec/dummy/db/migrate/20141114170949_acts_as_votable_migration.dm_core.rb +28 -0
  196. data/spec/dummy/db/migrate/20141114170950_add_user_site_profile_uuid.dm_core.rb +19 -0
  197. data/spec/dummy/db/migrate/20141114170951_add_invoice_id.dm_core.rb +7 -0
  198. data/spec/dummy/db/migrate/20141114170952_acts_as_follower_migration.dm_core.rb +18 -0
  199. data/spec/dummy/db/migrate/20141114170953_rename_invoice_id.dm_core.rb +12 -0
  200. data/spec/dummy/db/migrate/20141114170954_add_core_addresses.dm_core.rb +18 -0
  201. data/spec/dummy/db/migrate/20141114170955_papertrail_increase_column.dm_core.rb +9 -0
  202. data/spec/dummy/db/migrate/20141114170956_acts_as_taggable_on_migration.dm_core.rb +32 -0
  203. data/spec/dummy/db/migrate/20141114170957_add_missing_unique_indices.dm_core.rb +23 -0
  204. data/spec/dummy/db/migrate/20141114170958_add_taggings_counter_cache_to_tags.dm_core.rb +16 -0
  205. data/spec/dummy/db/migrate/20141114170959_create_custom_fields.dm_core.rb +40 -0
  206. data/spec/dummy/db/migrate/20141114170960_add_missing_taggable_index.dm_core.rb +11 -0
  207. data/spec/dummy/db/migrate/20141114170961_create_documents.dm_knowledge.rb +19 -0
  208. data/spec/dummy/db/migrate/20141114170962_add_document_notes.dm_knowledge.rb +7 -0
  209. data/spec/dummy/db/migrate/20160128134522_add_favored_locale.dm_core.rb +17 -0
  210. data/spec/dummy/db/migrate/20160128134523_update_papertrail_v4.dm_core.rb +41 -0
  211. data/spec/dummy/db/schema.rb +590 -0
  212. data/spec/dummy/db/seeds.rb +18 -0
  213. data/spec/dummy/public/404.html +67 -0
  214. data/spec/dummy/public/422.html +67 -0
  215. data/spec/dummy/public/500.html +66 -0
  216. data/spec/dummy/public/favicon.ico +0 -0
  217. data/spec/dummy/themes/_mbus/_readme.md +6 -0
  218. data/spec/dummy/themes/_mbus/_theme.yml +21 -0
  219. data/spec/dummy/themes/_mbus/theme_assets/_mbus/javascripts/application.js +9 -0
  220. data/spec/dummy/themes/_mbus/theme_assets/_mbus/javascripts/bootstrap.js +2114 -0
  221. data/spec/dummy/themes/_mbus/theme_assets/_mbus/javascripts/bootstrap.min.js +6 -0
  222. data/spec/dummy/themes/_mbus/theme_assets/_mbus/javascripts/contact_me.js +75 -0
  223. data/spec/dummy/themes/_mbus/theme_assets/_mbus/javascripts/jqBootstrapValidation.js +912 -0
  224. data/spec/dummy/themes/_mbus/theme_assets/_mbus/javascripts/jquery-1.11.0.js +4 -0
  225. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/application.css +14 -0
  226. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/bootstrap.css +6203 -0
  227. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/bootstrap.min.css +5 -0
  228. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/css/font-awesome.css +1566 -0
  229. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/css/font-awesome.min.css +4 -0
  230. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/fonts/FontAwesome.otf +0 -0
  231. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/fonts/fontawesome-webfont.eot +0 -0
  232. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/fonts/fontawesome-webfont.svg +504 -0
  233. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/fonts/fontawesome-webfont.ttf +0 -0
  234. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/fonts/fontawesome-webfont.woff +0 -0
  235. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/bordered-pulled.less +16 -0
  236. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/core.less +12 -0
  237. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/fixed-width.less +6 -0
  238. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/font-awesome.less +17 -0
  239. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/icons.less +506 -0
  240. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/larger.less +13 -0
  241. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/list.less +19 -0
  242. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/mixins.less +20 -0
  243. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/path.less +14 -0
  244. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/rotated-flipped.less +9 -0
  245. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/spinning.less +32 -0
  246. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/stacked.less +20 -0
  247. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/less/variables.less +515 -0
  248. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_bordered-pulled.scss +16 -0
  249. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_core.scss +12 -0
  250. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_fixed-width.scss +6 -0
  251. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_icons.scss +506 -0
  252. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_larger.scss +13 -0
  253. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_list.scss +19 -0
  254. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_mixins.scss +20 -0
  255. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_path.scss +14 -0
  256. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_rotated-flipped.scss +9 -0
  257. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_spinning.scss +32 -0
  258. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_stacked.scss +20 -0
  259. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/_variables.scss +515 -0
  260. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/font-awesome-4.1.0/scss/font-awesome.scss +17 -0
  261. data/spec/dummy/themes/_mbus/theme_assets/_mbus/stylesheets/modern-business.css +93 -0
  262. data/spec/dummy/themes/_mbus/theme_support/config/load_theme.rb +0 -0
  263. data/spec/dummy/themes/_mbus/theme_support/locales/site.cs.yml +57 -0
  264. data/spec/dummy/themes/_mbus/theme_support/locales/site.de.yml +57 -0
  265. data/spec/dummy/themes/_mbus/theme_support/locales/site.en.yml +57 -0
  266. data/spec/dummy/themes/_mbus/theme_support/locales/site.fi.yml +58 -0
  267. data/spec/dummy/themes/_mbus/theme_support/locales/site.ja.yml +57 -0
  268. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_blog_right_sidebar.html.erb +91 -0
  269. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_comment.html.erb +21 -0
  270. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_comment_form.html.erb +16 -0
  271. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_comment_list.html.erb +7 -0
  272. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_comment_section.html.erb +17 -0
  273. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_page_footer.html.erb +11 -0
  274. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_page_header.html.erb +39 -0
  275. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_page_top.html.erb +24 -0
  276. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_post_summary_item.html.erb +11 -0
  277. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/_social_buttons_initialization.html.erb +10 -0
  278. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/blog.html.erb +47 -0
  279. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/blog_post.html.erb +55 -0
  280. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/content_full_width.html.erb +28 -0
  281. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/content_with_left_nav.html.erb +44 -0
  282. data/spec/dummy/themes/_mbus/theme_support/views/layouts/cms_templates/index.html.erb +19 -0
  283. data/spec/dummy/themes/local/_theme.yml +8 -0
  284. data/spec/factories/accounts.rb +17 -0
  285. data/spec/factories/blogs.rb +19 -0
  286. data/spec/factories/posts.rb +23 -0
  287. data/spec/factories/user_profiles.rb +10 -0
  288. data/spec/factories/users.rb +19 -0
  289. data/spec/features/admin/blog_admin_spec.rb +16 -0
  290. data/spec/models/cms_blog_spec.rb +37 -0
  291. data/spec/models/cms_page_spec.rb +9 -0
  292. data/spec/models/cms_post_spec.rb +44 -0
  293. data/spec/rails_helper.rb +70 -0
  294. data/spec/spec_helper.rb +85 -0
  295. data/spec/support/accounts.rb +17 -0
  296. data/spec/support/devise.rb +44 -0
  297. data/spec/support/fix_locale.rb +57 -0
  298. metadata +545 -0
@@ -0,0 +1,166 @@
1
+ require 'rails_helper'
2
+
3
+ describe DmCms::Admin::CmsPostsController do
4
+ routes { DmCms::Engine.routes }
5
+ login_admin
6
+
7
+ #------------------------------------------------------------------------------
8
+ it "verify using admin role" do
9
+ expect(@current_user.is_admin?).to eq true
10
+ end
11
+
12
+ describe 'GET #new' do
13
+ let(:blog) { create(:blog) }
14
+
15
+ #------------------------------------------------------------------------------
16
+ it "assigns a new Post to @post" do
17
+ get :new, cms_blog_id: blog
18
+ expect(assigns(:post)).to be_a_new(CmsPost)
19
+ end
20
+ #------------------------------------------------------------------------------
21
+ it "renders the :new template" do
22
+ get :new, cms_blog_id: blog
23
+ expect(response).to render_template :new
24
+ end
25
+ end
26
+
27
+ describe 'GET #edit' do
28
+ let(:blog) { create(:blog) }
29
+ let(:post) { blog.posts.create(attributes_for(:post)) }
30
+
31
+ #------------------------------------------------------------------------------
32
+ it "assigns the requested post to @post" do
33
+ get :edit, cms_blog_id: blog, id: post
34
+ expect(assigns(:post)).to eq post
35
+ end
36
+
37
+ #------------------------------------------------------------------------------
38
+ it "renders the :edit template" do
39
+ get :edit, cms_blog_id: blog, id: post
40
+ expect(response).to render_template :edit
41
+ end
42
+
43
+ #------------------------------------------------------------------------------
44
+ it "ensure the edited post is scoped to the correct blog (same slugs, different blogs)" do
45
+ blog2 = create(:news_blog)
46
+ post2 = blog2.posts.create(attributes_for(:post))
47
+
48
+ get :edit, cms_blog_id: blog, id: post
49
+ expect(assigns(:post)).to eq post
50
+ get :edit, cms_blog_id: blog2, id: post2
51
+ expect(assigns(:post)).to eq post2
52
+ end
53
+ end
54
+
55
+ describe "POST #create" do
56
+ let(:blog) { create(:blog) }
57
+
58
+ context "with valid attributes" do
59
+ #------------------------------------------------------------------------------
60
+ it "saves the new post in the database" do
61
+ expect {
62
+ post :create, cms_blog_id: blog, cms_post: attributes_for(:post)
63
+ }.to change(blog.posts, :count).by(1)
64
+ end
65
+
66
+ #------------------------------------------------------------------------------
67
+ it "redirects to blog#show" do
68
+ post :create, cms_blog_id: blog, cms_post: attributes_for(:post)
69
+ expect(response).to redirect_to admin_cms_blog_url(assigns[:blog])
70
+ end
71
+ end
72
+
73
+ context "with invalid attributes" do
74
+ #------------------------------------------------------------------------------
75
+ it "does not save the new post in the database" do
76
+ expect {
77
+ post :create, cms_blog_id: blog, cms_post: attributes_for(:invalid_post)
78
+ }.to_not change(blog.posts, :count)
79
+ end
80
+
81
+ #------------------------------------------------------------------------------
82
+ it "re-renders the :new template" do
83
+ post :create, cms_blog_id: blog, cms_post: attributes_for(:invalid_post)
84
+ expect(response).to render_template :new
85
+ end
86
+ end
87
+ end
88
+
89
+ describe 'PATCH #update' do
90
+ let(:blog) { create(:blog) }
91
+ let(:post) { blog.posts.create(attributes_for(:post)) }
92
+
93
+ context "with valid attributes" do
94
+ #------------------------------------------------------------------------------
95
+ it "locates the requested @post" do
96
+ blog2 = create(:news_blog)
97
+ post2 = blog2.posts.create(attributes_for(:post))
98
+
99
+ patch :update, cms_blog_id: blog, id: post, cms_post: attributes_for(:post)
100
+ expect(assigns(:post)).to eq post
101
+ patch :update, cms_blog_id: blog2, id: post2, cms_post: attributes_for(:post)
102
+ expect(assigns(:post)).to eq post2
103
+ end
104
+
105
+ #------------------------------------------------------------------------------
106
+ it "updates the post in the database" do
107
+ patch :update, cms_blog_id: blog, id: post, cms_post: attributes_for(:post, title: 'Updated title', content: 'Updated content')
108
+ post.reload
109
+ expect(post.title).to eq('Updated title')
110
+ expect(post.content).to eq('Updated content')
111
+ end
112
+
113
+ #------------------------------------------------------------------------------
114
+ it "redirects to the blog" do
115
+ patch :update, cms_blog_id: blog, id: post, cms_post: attributes_for(:post)
116
+ expect(response).to redirect_to admin_cms_blog_url(blog)
117
+ end
118
+ end
119
+
120
+ context "with invalid attributes" do
121
+ #------------------------------------------------------------------------------
122
+ it "does not update the post" do
123
+ patch :update, cms_blog_id: blog, id: post, cms_post: attributes_for(:post, title: 'Updated title', content: nil)
124
+ post.reload
125
+ expect(post.title).to eq(attributes_for(:post)[:title])
126
+ expect(post.content).to eq(attributes_for(:post)[:content])
127
+ end
128
+
129
+ #------------------------------------------------------------------------------
130
+ it "re-renders the #edit template" do
131
+ patch :update, cms_blog_id: blog, id: post, cms_post: attributes_for(:post, title: 'Updated title', content: nil)
132
+ expect(response).to render_template :edit
133
+ end
134
+ end
135
+ end
136
+
137
+ describe 'DELETE #destroy' do
138
+ let(:blog) { create(:blog) }
139
+ let(:post) { blog.posts.create(attributes_for(:post)) }
140
+
141
+ #------------------------------------------------------------------------------
142
+ it "deletes the post from the blog" do
143
+ post # make sure post is created before the expect
144
+ expect { delete :destroy, cms_blog_id: blog, id: post }.to change(blog.posts, :count).by(-1)
145
+ end
146
+
147
+ #------------------------------------------------------------------------------
148
+ it "redirects to cms_blogs#index" do
149
+ delete :destroy, cms_blog_id: blog, id: post
150
+ expect(response).to redirect_to admin_cms_blog_url(blog)
151
+ end
152
+ end
153
+
154
+ describe 'PATCH #send_notifications_emails' do
155
+ it "write test"
156
+ # #------------------------------------------------------------------------------
157
+ # it "replaces the tags on a srcid with the given tag list" do
158
+ # document = create(:document)
159
+ # document.set_tag_list_on(DmKnowledge::Document.tagcontext_from_srcid('1.12'), "tag1,tag2")
160
+ # document.save
161
+ # patch :add_tags, id: document.id, document: {srcid: '1.12', tag_list: 'tag3, tag4'}
162
+ # document.reload
163
+ # expect(DmKnowledge::Document.all_tags_list).to eq ['tag3', 'tag4']
164
+ # end
165
+ end
166
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < DmCore::ApplicationController
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,12 @@
1
+ # Application's CanCan ability class, include all gem abilities
2
+ #------------------------------------------------------------------------------
3
+ class Ability
4
+ include CanCan::Ability
5
+ include DmCore::Concerns::Ability
6
+ include DmCms::Concerns::Ability
7
+
8
+ def initialize(user)
9
+ dm_cms_abilities(user) if respond_to? :dm_cms_abilities
10
+ dm_core_abilities(user) if respond_to? :dm_core_abilities
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ #--- DmCore already has default devise fields/tokens
4
+ include DmCore::Concerns::User
5
+
6
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "dm_cms"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
+ # config.time_zone = 'Central Time (US & Canada)'
17
+
18
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
+ # config.i18n.default_locale = :de
21
+
22
+ # Do not swallow errors in after_commit/after_rollback callbacks.
23
+ config.active_record.raise_in_transactional_callbacks = true
24
+ end
25
+ end
26
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,37 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Adds additional error checking when serving assets at runtime.
31
+ # Checks for improperly declared sprockets dependencies.
32
+ # Raises helpful error messages.
33
+ config.assets.raise_runtime_errors = true
34
+
35
+ # Raises error for missing translations
36
+ # config.action_view.raise_on_missing_translations = true
37
+ end
@@ -0,0 +1,82 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_files = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # `config.assets.precompile` has moved to config/initializers/assets.rb
36
+
37
+ # Specifies the header that your server uses for sending files.
38
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
39
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
40
+
41
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
42
+ # config.force_ssl = true
43
+
44
+ # Set to :debug to see everything in the log.
45
+ config.log_level = :info
46
+
47
+ # Prepend all log lines with the following tags.
48
+ # config.log_tags = [ :subdomain, :uuid ]
49
+
50
+ # Use a different logger for distributed setups.
51
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
52
+
53
+ # Use a different cache store in production.
54
+ # config.cache_store = :mem_cache_store
55
+
56
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
57
+ # config.action_controller.asset_host = "http://assets.example.com"
58
+
59
+ # Precompile additional assets.
60
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
61
+ # config.assets.precompile += %w( search.js )
62
+
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
+ # config.action_mailer.raise_delivery_errors = false
66
+
67
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
+ # the I18n.default_locale when a translation cannot be found).
69
+ config.i18n.fallbacks = true
70
+
71
+ # Send deprecation notices to registered listeners.
72
+ config.active_support.deprecation = :notify
73
+
74
+ # Disable automatic flushing of the log to improve performance.
75
+ # config.autoflush_log = false
76
+
77
+ # Use default logging formatter so that PID and timestamp are not suppressed.
78
+ config.log_formatter = ::Logger::Formatter.new
79
+
80
+ # Do not dump schema after migrations.
81
+ config.active_record.dump_schema_after_migration = false
82
+ end