workarea-blog 3.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +20 -0
  3. data/.eslintignore +2 -0
  4. data/.eslintrc +24 -0
  5. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  6. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  7. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  8. data/.gitignore +16 -0
  9. data/.rspec +2 -0
  10. data/.scss-lint.yml +188 -0
  11. data/.tailor +180 -0
  12. data/.yardopts +1 -0
  13. data/CHANGELOG.md +1123 -0
  14. data/CODE_OF_CONDUCT.md +3 -0
  15. data/CONTRIBUTING.md +3 -0
  16. data/Gemfile +7 -0
  17. data/LICENSE +52 -0
  18. data/README.md +140 -0
  19. data/Rakefile +42 -0
  20. data/app/assets/images/workarea/admin/blog/content_block_types/blog_entry.svg +1 -0
  21. data/app/assets/images/workarea/admin/blog/icons/blog.svg +1 -0
  22. data/app/assets/images/workarea/admin/blog/icons/blog_entry.svg +1 -0
  23. data/app/assets/images/workarea/admin/blog/icons/blog_post_comment.svg +1 -0
  24. data/app/assets/javascripts/workarea/storefront/blog/modules/blog_comment_placeholder.js +33 -0
  25. data/app/assets/stylesheets/workarea/admin/blog/components/_blog_entry_card.scss +14 -0
  26. data/app/assets/stylesheets/workarea/storefront/blog/components/_blog_entry.scss +91 -0
  27. data/app/assets/stylesheets/workarea/storefront/blog/components/_blog_entry_summary.scss +74 -0
  28. data/app/assets/stylesheets/workarea/storefront/blog/components/_featured_entry_content_block.scss +22 -0
  29. data/app/controllers/workarea/admin/application_controller.decorator +5 -0
  30. data/app/controllers/workarea/admin/content_blog_comments_controller.rb +54 -0
  31. data/app/controllers/workarea/admin/content_blog_entries_controller.rb +70 -0
  32. data/app/controllers/workarea/admin/content_blogs_controller.rb +56 -0
  33. data/app/controllers/workarea/admin/create_content_blog_entries_controller.rb +69 -0
  34. data/app/controllers/workarea/storefront/blog_comments_controller.rb +14 -0
  35. data/app/controllers/workarea/storefront/blog_entries_controller.rb +48 -0
  36. data/app/controllers/workarea/storefront/blogs_controller.rb +19 -0
  37. data/app/helpers/workarea/admin/blogs_helper.rb +61 -0
  38. data/app/models/workarea/content/blog.rb +26 -0
  39. data/app/models/workarea/content/blog_comment.rb +67 -0
  40. data/app/models/workarea/content/blog_entry.rb +35 -0
  41. data/app/models/workarea/content/fields/blog_entry_id.rb +11 -0
  42. data/app/models/workarea/content/fields/blog_id.rb +8 -0
  43. data/app/models/workarea/search/admin/content_blog.rb +27 -0
  44. data/app/models/workarea/search/admin/content_blog_entry.rb +37 -0
  45. data/app/queries/workarea/metadata/content_blog.rb +6 -0
  46. data/app/queries/workarea/metadata/content_blog_entry.rb +6 -0
  47. data/app/queries/workarea/search/admin_blog_entries.rb +24 -0
  48. data/app/queries/workarea/search/admin_blogs.rb +20 -0
  49. data/app/seeds/workarea/blog_comments_seeds.rb +26 -0
  50. data/app/seeds/workarea/blog_entry_seeds.rb +73 -0
  51. data/app/seeds/workarea/blog_seeds.rb +53 -0
  52. data/app/services/workarea/search/queries/blog_admin.rb +20 -0
  53. data/app/services/workarea/search/queries/blog_entry_admin.rb +13 -0
  54. data/app/services/workarea/set_navigable.decorator +10 -0
  55. data/app/view_models/workarea/admin/blog_comments_view_model.rb +45 -0
  56. data/app/view_models/workarea/admin/blog_entries_view_model.rb +31 -0
  57. data/app/view_models/workarea/admin/blog_entry_view_model.rb +29 -0
  58. data/app/view_models/workarea/admin/blog_search_view_model.rb +6 -0
  59. data/app/view_models/workarea/admin/blog_view_model.rb +13 -0
  60. data/app/view_models/workarea/storefront/blog_entry_view_model.rb +43 -0
  61. data/app/view_models/workarea/storefront/blog_index_view_model.rb +17 -0
  62. data/app/view_models/workarea/storefront/blog_view_model.rb +83 -0
  63. data/app/view_models/workarea/storefront/content_blocks/blog_entry_content_block_view_model.rb +63 -0
  64. data/app/views/workarea/admin/activities/_content_blog_comment_create.html.haml +12 -0
  65. data/app/views/workarea/admin/activities/_content_blog_comment_destroy.html.haml +9 -0
  66. data/app/views/workarea/admin/activities/_content_blog_comment_update.html.haml +10 -0
  67. data/app/views/workarea/admin/activities/_content_blog_create.html.haml +12 -0
  68. data/app/views/workarea/admin/activities/_content_blog_destroy.html.haml +10 -0
  69. data/app/views/workarea/admin/activities/_content_blog_entry_create.html.haml +12 -0
  70. data/app/views/workarea/admin/activities/_content_blog_entry_destroy.html.haml +10 -0
  71. data/app/views/workarea/admin/activities/_content_blog_entry_update.html.haml +10 -0
  72. data/app/views/workarea/admin/activities/_content_blog_update.html.haml +10 -0
  73. data/app/views/workarea/admin/blog/_dashboard_navigation.html.haml +1 -0
  74. data/app/views/workarea/admin/blog/_menu.html.haml +13 -0
  75. data/app/views/workarea/admin/content_blocks/_blog_entry_id.html.haml +4 -0
  76. data/app/views/workarea/admin/content_blocks/_blog_id.html.haml +3 -0
  77. data/app/views/workarea/admin/content_blog_comments/_summary.html.haml +24 -0
  78. data/app/views/workarea/admin/content_blog_comments/edit.html.haml +60 -0
  79. data/app/views/workarea/admin/content_blog_comments/index.html.haml +49 -0
  80. data/app/views/workarea/admin/content_blog_entries/_aux_navigation.html.haml +4 -0
  81. data/app/views/workarea/admin/content_blog_entries/_cards.html.haml +113 -0
  82. data/app/views/workarea/admin/content_blog_entries/_summary.html.haml +10 -0
  83. data/app/views/workarea/admin/content_blog_entries/edit.html.haml +75 -0
  84. data/app/views/workarea/admin/content_blog_entries/index.html.haml +80 -0
  85. data/app/views/workarea/admin/content_blog_entries/index.json.jbuilder +5 -0
  86. data/app/views/workarea/admin/content_blog_entries/show.html.haml +20 -0
  87. data/app/views/workarea/admin/content_blog_entries/thumbnail_image.html.haml +55 -0
  88. data/app/views/workarea/admin/content_blogs/_aux_navigation.html.haml +2 -0
  89. data/app/views/workarea/admin/content_blogs/_cards.html.haml +58 -0
  90. data/app/views/workarea/admin/content_blogs/_summary.html.haml +6 -0
  91. data/app/views/workarea/admin/content_blogs/edit.html.haml +51 -0
  92. data/app/views/workarea/admin/content_blogs/index.html.haml +76 -0
  93. data/app/views/workarea/admin/content_blogs/index.json.jbuilder +4 -0
  94. data/app/views/workarea/admin/content_blogs/new.html.haml +33 -0
  95. data/app/views/workarea/admin/content_blogs/show.html.haml +19 -0
  96. data/app/views/workarea/admin/create_content_blog_entries/content.html.haml +28 -0
  97. data/app/views/workarea/admin/create_content_blog_entries/featured_products.html.haml +71 -0
  98. data/app/views/workarea/admin/create_content_blog_entries/publish.html.haml +51 -0
  99. data/app/views/workarea/admin/create_content_blog_entries/setup.html.haml +61 -0
  100. data/app/views/workarea/admin/create_content_blog_entries/thumbnail_image.html.haml +48 -0
  101. data/app/views/workarea/storefront/blog_comments/index.html.haml +31 -0
  102. data/app/views/workarea/storefront/blog_entries/_summary.html.haml +25 -0
  103. data/app/views/workarea/storefront/blog_entries/show.html.haml +85 -0
  104. data/app/views/workarea/storefront/blog_metadata/_publisher.html.haml +7 -0
  105. data/app/views/workarea/storefront/blogs/_blog_navigation.html.haml +7 -0
  106. data/app/views/workarea/storefront/blogs/index.html.haml +25 -0
  107. data/app/views/workarea/storefront/blogs/show.atom.builder +26 -0
  108. data/app/views/workarea/storefront/blogs/show.html.haml +31 -0
  109. data/app/views/workarea/storefront/content_blocks/_blog_entry.html.haml +20 -0
  110. data/app/workers/workarea/generate_content_metadata.decorator +15 -0
  111. data/bin/rails +18 -0
  112. data/config/initializers/appends.rb +26 -0
  113. data/config/initializers/content_block_types.rb +13 -0
  114. data/config/initializers/jump_to_navigation.rb +3 -0
  115. data/config/initializers/seeds.rb +5 -0
  116. data/config/initializers/workarea.rb +15 -0
  117. data/config/locales/en.yml +244 -0
  118. data/config/routes.rb +49 -0
  119. data/data/blog_thumbnails/thumbnail_1.png +0 -0
  120. data/data/blog_thumbnails/thumbnail_2.png +0 -0
  121. data/data/blog_thumbnails/thumbnail_3.png +0 -0
  122. data/lib/tasks/import_wordpress.rake +13 -0
  123. data/lib/tasks/import_wordpress_attachments.rake +18 -0
  124. data/lib/tasks/import_wordpress_pages.rake +21 -0
  125. data/lib/tasks/import_wordpress_posts.rake +25 -0
  126. data/lib/workarea/blog/engine.rb +8 -0
  127. data/lib/workarea/blog/import/wordpress/attachment.rb +40 -0
  128. data/lib/workarea/blog/import/wordpress/content_cleaner.rb +64 -0
  129. data/lib/workarea/blog/import/wordpress/entry.rb +76 -0
  130. data/lib/workarea/blog/import/wordpress/entry_parser.rb +64 -0
  131. data/lib/workarea/blog/import/wordpress/page.rb +69 -0
  132. data/lib/workarea/blog/import/wordpress/page_parser.rb +50 -0
  133. data/lib/workarea/blog/version.rb +5 -0
  134. data/lib/workarea/blog.rb +11 -0
  135. data/test/dummy/Rakefile +6 -0
  136. data/test/dummy/app/assets/config/manifest.js +4 -0
  137. data/test/dummy/app/assets/images/.keep +0 -0
  138. data/test/dummy/app/assets/javascripts/application.js +13 -0
  139. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  140. data/test/dummy/app/controllers/application_controller.rb +3 -0
  141. data/test/dummy/app/controllers/concerns/.keep +0 -0
  142. data/test/dummy/app/helpers/application_helper.rb +2 -0
  143. data/test/dummy/app/jobs/application_job.rb +2 -0
  144. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  145. data/test/dummy/app/models/concerns/.keep +0 -0
  146. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  147. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  148. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  149. data/test/dummy/bin/bundle +3 -0
  150. data/test/dummy/bin/rails +4 -0
  151. data/test/dummy/bin/rake +4 -0
  152. data/test/dummy/bin/setup +34 -0
  153. data/test/dummy/bin/update +29 -0
  154. data/test/dummy/config/application.rb +26 -0
  155. data/test/dummy/config/boot.rb +5 -0
  156. data/test/dummy/config/cable.yml +9 -0
  157. data/test/dummy/config/environment.rb +5 -0
  158. data/test/dummy/config/environments/development.rb +59 -0
  159. data/test/dummy/config/environments/production.rb +86 -0
  160. data/test/dummy/config/environments/test.rb +43 -0
  161. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  162. data/test/dummy/config/initializers/assets.rb +11 -0
  163. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  164. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  165. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  166. data/test/dummy/config/initializers/inflections.rb +16 -0
  167. data/test/dummy/config/initializers/mime_types.rb +4 -0
  168. data/test/dummy/config/initializers/new_framework_defaults.rb +18 -0
  169. data/test/dummy/config/initializers/session_store.rb +3 -0
  170. data/test/dummy/config/initializers/workarea.rb +3 -0
  171. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  172. data/test/dummy/config/locales/en.yml +23 -0
  173. data/test/dummy/config/puma.rb +47 -0
  174. data/test/dummy/config/routes.rb +5 -0
  175. data/test/dummy/config/secrets.yml +22 -0
  176. data/test/dummy/config/spring.rb +6 -0
  177. data/test/dummy/config.ru +5 -0
  178. data/test/dummy/db/seeds.rb +2 -0
  179. data/test/dummy/lib/assets/.keep +0 -0
  180. data/test/dummy/log/.keep +0 -0
  181. data/test/factories/blog.rb +33 -0
  182. data/test/factories/wordpress_import.rb +17 -0
  183. data/test/fixtures/test_wordpress.xml +493 -0
  184. data/test/integration/workarea/blog/admin_integration_test.rb +55 -0
  185. data/test/integration/workarea/blog/create_blog_entries_integration_test.rb +106 -0
  186. data/test/integration/workarea/blog/storefront_integration_test.rb +112 -0
  187. data/test/integration/workarea/blog/wordpress_import_integration_test.rb +26 -0
  188. data/test/lib/workarea/blog/import/wordpress/attachment_test.rb +20 -0
  189. data/test/lib/workarea/blog/import/wordpress/content_cleaner_test.rb +65 -0
  190. data/test/lib/workarea/blog/import/wordpress/entry_parser_test.rb +42 -0
  191. data/test/lib/workarea/blog/import/wordpress/entry_test.rb +61 -0
  192. data/test/lib/workarea/blog/import/wordpress/page_parser_test.rb +35 -0
  193. data/test/lib/workarea/blog/import/wordpress/page_test.rb +52 -0
  194. data/test/models/workarea/content/blog_comment_test.rb +57 -0
  195. data/test/models/workarea/content/blog_entry_test.rb +17 -0
  196. data/test/queries/workarea/metadata/content_blog_entry_test.rb +36 -0
  197. data/test/queries/workarea/metadata/content_blog_test.rb +36 -0
  198. data/test/support/workarea/blog/stub_wordpress_assets.rb +19 -0
  199. data/test/system/workarea/admin/blog_entries_system_test.rb +103 -0
  200. data/test/system/workarea/admin/blog_system_test.rb +93 -0
  201. data/test/system/workarea/admin/blog_taxonomy_system_test.rb +21 -0
  202. data/test/system/workarea/admin/blog_user_comments_system_test.rb +138 -0
  203. data/test/system/workarea/storefront/blog_content_block_system_test.rb +36 -0
  204. data/test/system/workarea/storefront/blog_system_test.rb +256 -0
  205. data/test/test_helper.rb +9 -0
  206. data/test/view_models/workarea/admin/blog_comments_view_model_test.rb +77 -0
  207. data/test/view_models/workarea/admin/blog_entries_view_model_test.rb +36 -0
  208. data/test/view_models/workarea/storefront/blog_entry_content_block_view_model_test.rb +100 -0
  209. data/test/view_models/workarea/storefront/blog_entry_view_model_test.rb +47 -0
  210. data/test/view_models/workarea/storefront/blog_view_model_test.rb +149 -0
  211. data/test/workers/workarea/generate_content_blog_metadata_test.rb +18 -0
  212. data/workarea-blog.gemspec +19 -0
  213. metadata +274 -0
@@ -0,0 +1,3 @@
1
+ View this plugin's code of conduct here:
2
+
3
+ <https://github.com/workarea-commerce/workarea/blob/master/CODE_OF_CONDUCT.md>
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,3 @@
1
+ View this plugin's contribution guidelines here:
2
+
3
+ <https://github.com/workarea-commerce/workarea/blob/master/CONTRIBUTING.md>
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "git@github.com:#{repo}.git" }
3
+
4
+ gemspec
5
+
6
+ gem 'listen'
7
+ gem 'workarea'
data/LICENSE ADDED
@@ -0,0 +1,52 @@
1
+ WebLinc
2
+ Business Source License
3
+
4
+ Licensor: WebLinc Corporation, 22 S. 3rd Street, 2nd Floor, Philadelphia PA 19106
5
+
6
+ Licensed Work: Workarea Commerce Platform
7
+ The Licensed Work is (c) 2019 WebLinc Corporation
8
+
9
+ Additional Use Grant:
10
+ You may make production use of the Licensed Work without an additional license agreement with WebLinc so long as you do not use the Licensed Work for a Commerce Service.
11
+
12
+ A "Commerce Service" is a commercial offering that allows third parties (other than your employees and contractors) to access the functionality of the Licensed Work by creating or managing commerce functionality, the products, taxonomy, assets and/or content of which are controlled by such third parties.
13
+
14
+ For information about obtaining an additional license agreement with WebLinc, contact licensing@workarea.com.
15
+
16
+ Change Date: 2019-08-20
17
+
18
+ Change License: Version 2.0 or later of the GNU General Public License as published by the Free Software Foundation
19
+
20
+ Terms
21
+
22
+ The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
23
+
24
+ Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
25
+
26
+ If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
27
+
28
+ All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
29
+
30
+ You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
31
+
32
+ Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
33
+
34
+ This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License). TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works and to refer to it using the trademark "Business Source License" as long as you comply with the Covenants of Licensor below.
35
+
36
+ Covenants of Licensor
37
+ In consideration of the right to use this License’s text and the "Business Source License" name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
38
+
39
+ To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
40
+
41
+ To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text "None."
42
+
43
+ To specify a Change Date.
44
+
45
+ Not to modify this License in any other way.
46
+
47
+ Notice
48
+ The Business Source License (this document, or the "License") is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
49
+
50
+ For more information on the use of the Business Source License generally, please visit the Adopting and Developing Business Source License FAQ.
51
+
52
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. "Business Source License" is a trademark of MariaDB Corporation Ab.
data/README.md ADDED
@@ -0,0 +1,140 @@
1
+ Workarea Blog
2
+ ================================================================================
3
+
4
+ A Workarea Commerce plugin for creating and managing blogs and blog entries.
5
+
6
+ Overview
7
+ --------------------------------------------------------------------------------
8
+
9
+ * Creation and management of one or more unique blogs per site
10
+ * Utilizes existing content blocks in blog entry creation
11
+ * Support for blog Entry Comments & Moderation
12
+ * Support for importing from Wordpress
13
+
14
+ Getting Started
15
+ --------------------------------------------------------------------------------
16
+
17
+ Add the gem to your application's Gemfile:
18
+
19
+ ```ruby
20
+ # ...
21
+ gem 'workarea-blog'
22
+ # ...
23
+ ```
24
+
25
+ Update your application's bundle.
26
+
27
+ ```bash
28
+ cd path/to/application
29
+ bundle
30
+ ```
31
+
32
+ Features
33
+ --------------------------------------------------------------------------------
34
+
35
+ ### Blogs and Entries vs. Categories and Posts
36
+
37
+ The workarea blog plugin uses the model 'Blog' as the parent model for
38
+ 'Entries'. A site may have many blogs, and a blog may have many entries. This
39
+ is similar to the idea of 'Categories' and 'Posts' in other blogging
40
+ platforms.
41
+
42
+ ### Commenting and Comment Moderation
43
+
44
+ Readers are permitted to comment on Blog Entries. Admin users with the proper
45
+ permissions may moderate comments left by readers.
46
+
47
+ ### Importing Wordpress Content
48
+
49
+ The workarea-blog plugin includes a set of rake tasks to import content from
50
+ Wordpress blogs. These tasks require an XML export from wordpress, this can be
51
+ generated from the Wordpress admin by following the instructions found here:
52
+ <https://codex.wordpress.org/Tools_Export_Screen>. Hosted wordpress.com blogs
53
+ will have a slightly different interface, but the process is much the same.
54
+ You should do a complete export of all data, including attachments, posts, and
55
+ pages.
56
+
57
+ Once you have the XML file downloaded you need to save it in your application.
58
+ The import will look for `/data/blog/wordpress.xml` by default, you can
59
+ configure the import to use a different path if necessary.
60
+
61
+ More information below.
62
+
63
+ Wordpress Import
64
+ --------------------------------------------------------------------------------
65
+
66
+ ### Gotchas with importing Wordpress content
67
+
68
+ All post and page content will be created as an HTML content block. This will
69
+ maintain any semantic HTML styles like `<strong>` `<i>` and heading tags.
70
+ However, we do not import styles from Wordpress, so any styles coming from
71
+ custom classes will not be included. You should set your customer's expectations
72
+ around this. If necessary you could replicate custom styles from wordpress in
73
+ your application, or re-write classes as necessary to match classes in the
74
+ Workarea application.
75
+
76
+ Depending on which version of wordpress and which editor was used, some
77
+ wordpress posts contain markup that will cause the HTML to be stripped. Before
78
+ importing you should look at the `<content:encoded>` fields in the wordpress.xml
79
+ and ensure there are no comments that look like this `<!-- wp:paragraph -->`. If
80
+ these comments are present you will need to remove them manually.
81
+
82
+ ### Post types for import
83
+
84
+ Before running the import you should examine the wordpress.xml file, checking
85
+ post types. If your Wordpress blog uses custom post types you will need to
86
+ customize the import to handle those.
87
+
88
+ The wordpress import scripts will handle the following post types:
89
+
90
+ * Attachment - Imported as assets
91
+ * Post - Imported as Blog Entries
92
+ * Page - Imported as Content Pages
93
+
94
+ ### Import configuration
95
+
96
+ Before running the import task you should use an initializer to configure the
97
+ blog name and author name for all posts coming from Wordpress. If a blog does
98
+ not exist with a matching name it will be created. All posts will be attributed
99
+ to the same author name, per the configuration.
100
+
101
+ Default configuration:
102
+
103
+ ```ruby
104
+ Workarea.configure do |config|
105
+ config.wordpress_import = {
106
+ 'blog_name': 'Wordpress Import',
107
+ 'author_name': 'Wordpress User'
108
+ }
109
+ end
110
+ ```
111
+
112
+ ### Running the import
113
+
114
+ To run the complete import run `bundle exec rake
115
+ workarea:blog:import_wordpress`. This will import attachments, posts, and pages
116
+ from the XML file provided. You can also run each of these tasks individually if
117
+ necessary. If you opt to do this you *must* run the
118
+ `workarea:blog:import_wordpress_attachments` task first as these assets need to
119
+ exist before any posts or pages can reference them.
120
+
121
+ #### Using a different path for import
122
+
123
+ All import tasks allow a custom path to be used if necessary. The default path
124
+ for your wordpress xml export is `/data/blog/wordpress.xml`. To use a different
125
+ path you can pass an argument to the rake task, note that the new path should
126
+ be from your application root directory. Example:
127
+
128
+ ```bash
129
+ bundle exec rake workarea:blog:import_wordpress['path/to/your/new_wordpress.xml']
130
+ ```
131
+
132
+ WebLinc Platform Documentation
133
+ --------------------------------------------------------------------------------
134
+
135
+ See [https://developer.workarea.com](https://developer.workarea.com) for Workarea Commerce documentation.
136
+
137
+ License
138
+ --------------------------------------------------------------------------------
139
+
140
+ Workarea Blog is released under the [Business Software License](LICENSE)
data/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
9
+ load 'rails/tasks/engine.rake'
10
+ load 'rails/tasks/statistics.rake'
11
+ load 'workarea/changelog.rake'
12
+ require 'rake/testtask'
13
+
14
+ Rake::TestTask.new(:test) do |t|
15
+ t.libs << 'lib'
16
+ t.libs << 'test'
17
+ t.pattern = 'test/**/*_test.rb'
18
+ t.verbose = false
19
+ end
20
+
21
+ task default: :test
22
+
23
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
24
+ require 'workarea/blog/version'
25
+
26
+ desc "Release version #{Workarea::Blog::VERSION} of the gem"
27
+ task :release do
28
+ host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
29
+
30
+ #Rake::Task['workarea:changelog'].execute
31
+ #system 'git add CHANGELOG.md'
32
+ #system 'git commit -m "Update CHANGELOG"'
33
+ #system 'git push origin HEAD'
34
+
35
+ system "git tag -a v#{Workarea::Blog::VERSION} -m 'Tagging #{Workarea::Blog::VERSION}'"
36
+ system 'git push --tags'
37
+
38
+ system 'gem build workarea-blog.gemspec'
39
+ system "gem push workarea-blog-#{Workarea::Blog::VERSION}.gem"
40
+ system "gem push workarea-blog-#{Workarea::Blog::VERSION}.gem --host #{host}"
41
+ system "rm workarea-blog-#{Workarea::Blog::VERSION}.gem"
42
+ end
@@ -0,0 +1 @@
1
+ <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><title>blog_entry</title><path d="M23.37,3.56A17.74,17.74,0,0,0,16,2C7.72,2,1,7.44,1,14.14S7.72,26.28,16,26.28a18.72,18.72,0,0,0,2.34-.15C21.56,29.34,25.28,29.92,29,30v-.78c-2-1-3.62-2.76-3.62-4.8a5.63,5.63,0,0,1,.06-.84A11.42,11.42,0,0,0,31,14.14,10.11,10.11,0,0,0,30,9.7L27.66,12A7,7,0,0,1,28,14.14a8.44,8.44,0,0,1-4.21,6.93,3,3,0,0,0-1.32,2.06,8.63,8.63,0,0,0-.1,1.28,11.11,11.11,0,0,0,.1,1.15,9.58,9.58,0,0,1-2-1.56A3,3,0,0,0,18,23.15a15.72,15.72,0,0,1-2,.12C9.25,23.28,4,19,4,14.14S9.25,5,16,5a15,15,0,0,1,5.07.86l2.3-2.3Z"/><path d="M30.3,5.53A2.51,2.51,0,0,1,29.79,7l-1.3,1.3L25,4.8l1.3-1.3a2.53,2.53,0,0,1,4,2ZM14,19.3l4.55-1L27.79,9,24.25,5.51,15,14.75ZM25,9l-7.07,7.07-.71-.71,7.07-7.07L25,9Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><title>Blog</title><path d="M17.31 30.26A12.35 12.35 0 0 0 25 32.8a13.94 13.94 0 0 0 1.72-.1c2.36 2.35 5.09 2.77 7.81 2.83V35a4.25 4.25 0 0 1-2.65-3.53 4.17 4.17 0 0 1 0-.61A8.36 8.36 0 0 0 36 23.9a7.4 7.4 0 0 0-.82-3.38C33 26.23 26.5 30.28 19 30.28h-.64a5.49 5.49 0 0 1-1-.09l-.09.08z"/><path d="M34 16.14c0 6.7-6.72 12.14-15 12.14a17.92 17.92 0 0 1-2.34-.15C13.44 31.34 9.72 31.92 6 32v-.78c2-1 3.62-2.77 3.62-4.81a5.93 5.93 0 0 0-.06-.84A11.41 11.41 0 0 1 4 16.14C4 9.44 10.72 4 19 4s15 5.44 15 12.14zM14.54 26a2.93 2.93 0 0 1 2.5-.86 14.23 14.23 0 0 0 2 .13c6.75 0 12-4.25 12-9.14S25.75 7 19 7 7 11.25 7 16.14a8.46 8.46 0 0 0 4.21 6.93 3 3 0 0 1 1.32 2.06 9.07 9.07 0 0 1 .09 1.28 7.11 7.11 0 0 1-.09 1.14A5 5 0 0 0 14.54 26z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><title>Blog Entry</title><path d="M23.37,3.56A17.74,17.74,0,0,0,16,2C7.72,2,1,7.44,1,14.14S7.72,26.28,16,26.28a18.72,18.72,0,0,0,2.34-.15C21.56,29.34,25.28,29.92,29,30v-.78c-2-1-3.62-2.76-3.62-4.8a5.63,5.63,0,0,1,.06-.84A11.42,11.42,0,0,0,31,14.14,10.11,10.11,0,0,0,30,9.7L27.66,12A7,7,0,0,1,28,14.14a8.44,8.44,0,0,1-4.21,6.93,3,3,0,0,0-1.32,2.06,8.63,8.63,0,0,0-.1,1.28,11.11,11.11,0,0,0,.1,1.15,9.58,9.58,0,0,1-2-1.56A3,3,0,0,0,18,23.15a15.72,15.72,0,0,1-2,.12C9.25,23.28,4,19,4,14.14S9.25,5,16,5a15,15,0,0,1,5.07.86l2.3-2.3Z"/><path d="M30.3,5.53A2.51,2.51,0,0,1,29.79,7l-1.3,1.3L25,4.8l1.3-1.3a2.53,2.53,0,0,1,4,2ZM14,19.3l4.55-1L27.79,9,24.25,5.51,15,14.75ZM25,9l-7.07,7.07-.71-.71,7.07-7.07L25,9Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><title>Blog Post Comment</title><g><path d="M17.96 30l-6.216 4.44L7 37.83V30h-.003C4.79 30 3 28.214 3 26.007V9.993C3 7.787 4.784 6 6.997 6h26.006C35.21 6 37 7.786 37 9.993v16.014C37 28.213 35.216 30 33.003 30H17.96zM10 27v5l7-5h16.003c.557 0 .997-.445.997-.993V9.993c0-.548-.446-.993-.997-.993H6.997C6.44 9 6 9.445 6 9.993v16.014c0 .548.446.993.997.993H10z"/><path d="M10 13h16v3H10v-3zM10 18h19v1H10v-1zM10 20h19v1H10v-1zM10 22h11v1H10v-1z"/></g></svg>
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @namespace WORKAREA.blogCommentPlaceholder
3
+ */
4
+ WORKAREA.registerModule('blogCommentPlaceholder', (function () {
5
+ 'use strict';
6
+
7
+ var replacePlaceholder = function (placeholder, content) {
8
+ var $content = $(content);
9
+
10
+ $(placeholder).replaceWith($content);
11
+
12
+ WORKAREA.initModules($content);
13
+ },
14
+
15
+ getContent = function (index, placeholder) {
16
+ var url = $(placeholder).data('blogCommentPlaceholder');
17
+
18
+ $.get(url).done(_.partial(replacePlaceholder, placeholder));
19
+ },
20
+
21
+ /**
22
+ * @method
23
+ * @name init
24
+ * @memberof WORKAREA.blogCommentPlaceholder
25
+ */
26
+ init = function ($scope) {
27
+ $('[data-blog-comment-placeholder]', $scope).each(getContent);
28
+ };
29
+
30
+ return {
31
+ init: init
32
+ };
33
+ }()));
@@ -0,0 +1,14 @@
1
+ /*------------------------------------*\
2
+ #BLOG-ENTRY-CARD
3
+ \*------------------------------------*/
4
+
5
+ $blog-entry-card-border-color: $gray !default;
6
+
7
+
8
+ .blog-entry-card {
9
+ @extend %list-reset;
10
+ }
11
+
12
+ .blog-entry-card__item {
13
+ border-bottom: 1px solid $blog-entry-card-border-color;
14
+ }
@@ -0,0 +1,91 @@
1
+ /*------------------------------------*\
2
+ #BLOG-ENTRY
3
+ \*------------------------------------*/
4
+
5
+ .blog-entry {}
6
+
7
+ .blog-entry__label {
8
+ display: inline-block;
9
+ margin: 0 ($spacing-unit / 2) 0 0;
10
+ }
11
+
12
+ .blog-entry__title {}
13
+
14
+ .blog-entry__author {
15
+ display: inline-block;
16
+ margin: 0 $spacing-unit 0 0;
17
+ }
18
+
19
+ .blog-entry__datetime {
20
+ display: inline-block;
21
+ }
22
+
23
+ .blog-entry__comment-count {
24
+ display: inline-block;
25
+ margin: 0 0 0 $spacing-unit;
26
+ }
27
+
28
+ .blog-entry__tags {
29
+ margin-bottom: $vertical-margin;
30
+ }
31
+
32
+ .blog-entry__tags-list {
33
+ @extend %inline-list;
34
+ display: inline-block;
35
+ }
36
+
37
+ .blog-entry__tags-list-item {
38
+ & + & {
39
+ margin: 0 0 0 ($spacing-unit / 2);
40
+ }
41
+ }
42
+
43
+ .blog-entry__body {
44
+ margin-bottom: $vertical-margin;
45
+ }
46
+
47
+ /**
48
+ * Comments
49
+ */
50
+
51
+ .blog-entry__comments {}
52
+
53
+ .blog-entry__section {}
54
+
55
+ .blog-entry__comments-header {
56
+ @extend %clearfix;
57
+ }
58
+
59
+ .blog-entry__comments-heading {
60
+ @include respond-to($medium-breakpoint) {
61
+ float: left;
62
+ }
63
+ }
64
+
65
+ .blog-entry__write-comment-link {
66
+ @include respond-to($medium-breakpoint) {
67
+ float: right;
68
+ }
69
+ }
70
+
71
+ .blog-entry__comment-group {
72
+ @extend %list-reset;
73
+ }
74
+
75
+ .blog-entry__comment {
76
+ margin-bottom: $vertical-margin;
77
+ }
78
+
79
+ .blog-entry__comment-item {
80
+ margin: 0 0 ($spacing-unit / 2);
81
+ }
82
+
83
+ .blog-entry__comment-item--author {}
84
+
85
+ .blog-entry__comment-item--datetime {}
86
+
87
+ .blog-entry__comment-item--body {
88
+ margin-bottom: ($spacing-unit * 2);
89
+ }
90
+
91
+ .blog-entry__comments-form {}
@@ -0,0 +1,74 @@
1
+ /*------------------------------------*\
2
+ #BLOG-ENTRY-SUMMARY
3
+ \*------------------------------------*/
4
+
5
+ $blog-entry-summary-thumbnail-small-width: 160px !default;
6
+
7
+
8
+ .blog-entry-summary {}
9
+
10
+ .blog-entry-summary--featured {}
11
+
12
+ .blog-entry-summary__title {}
13
+
14
+ .blog-entry-summary__banner-content {
15
+ margin-bottom: $vertical-margin;
16
+ }
17
+
18
+ .blog-entry-summary__entry-group {}
19
+
20
+ .blog-entry-summary__entry {
21
+ @extend %clearfix;
22
+ margin-bottom: $vertical-margin;
23
+ }
24
+
25
+ .blog-entry-summary__entry-thumbnail {
26
+ margin-bottom: $vertical-margin;
27
+ text-align: center;
28
+
29
+ @include respond-to($medium-breakpoint) {
30
+ margin: $spacing-unit ($spacing-unit * 2) $spacing-unit 0;
31
+ width: $blog-entry-summary-thumbnail-small-width;
32
+ float: left;
33
+ }
34
+ }
35
+
36
+ .blog-entry-summary__entry-label {
37
+ display: inline-block;
38
+ margin: 0 ($spacing-unit / 2) 0 0;
39
+ }
40
+
41
+ .blog-entry-summary__entry-title {}
42
+
43
+ .blog-entry-summary__entry-author {
44
+ display: inline-block;
45
+ margin: 0 $spacing-unit 0 0;
46
+ }
47
+
48
+ .blog-entry-summary__entry-datetime {
49
+ display: inline-block;
50
+ }
51
+
52
+ .blog-entry-summary__entry-comment-count {
53
+ display: inline-block;
54
+ margin: 0 0 0 $spacing-unit;
55
+ }
56
+
57
+ .blog-entry-summary__entry-tags {
58
+ margin-bottom: $vertical-margin;
59
+ }
60
+
61
+ .blog-entry-summary__entry-tags-list {
62
+ @extend %inline-list;
63
+ display: inline-block;
64
+ }
65
+
66
+ .blog-entry-summary__entry-tags-list-item {
67
+ & + & {
68
+ margin: 0 0 0 ($spacing-unit / 2);
69
+ }
70
+ }
71
+
72
+ .blog-entry-summary__content {
73
+ margin-bottom: $vertical-margin;
74
+ }
@@ -0,0 +1,22 @@
1
+ /*------------------------------------*\
2
+ #FEATURED-ENTRY-CONTENT-BLOCK
3
+ \*------------------------------------*/
4
+
5
+ .featured-entry-content-block {}
6
+
7
+ .featured-entry-content-block__banner {}
8
+
9
+ .featured-entry-content-block__image {}
10
+
11
+ .featured-entry-content-block__content {}
12
+
13
+ .featured-entry-content-block__category-tag {}
14
+
15
+ .featured-entry-content-block__heading {}
16
+
17
+ .featured-entry-content-block__byline {}
18
+
19
+ .featured-entry-content-block__body {}
20
+
21
+ .featured-entry-content-block__read-more {}
22
+
@@ -0,0 +1,5 @@
1
+ module Workarea
2
+ decorate Admin::ApplicationController, with: :blog do
3
+ decorated { helper Admin::BlogsHelper }
4
+ end
5
+ end
@@ -0,0 +1,54 @@
1
+ module Workarea
2
+ module Admin
3
+ class ContentBlogCommentsController < Admin::ApplicationController
4
+ required_permissions :marketing
5
+ before_action :find_blog_comment, except: :index
6
+
7
+ def index
8
+ options = params.merge(built_sort: find_sort(Content::BlogComment))
9
+ @blog_comments = Admin::BlogCommentsViewModel.new(nil, options)
10
+ end
11
+
12
+ def edit; end
13
+
14
+ def update
15
+ if @blog_comment.update_attributes(blog_comment_params)
16
+ flash[:success] = 'Blog entry comment has been updated'
17
+ redirect_to content_blog_user_comments_path(
18
+ content_blog_entry_id: params[:content_blog_entry_id]
19
+ )
20
+ else
21
+ render :edit
22
+ end
23
+ end
24
+
25
+ def destroy
26
+ @blog_comment.destroy
27
+ flash[:success] = t('workarea.admin.content_blogs_comments.flash_messages.destroyed')
28
+ redirect_to content_blog_user_comments_path
29
+ end
30
+
31
+ private
32
+
33
+ def find_blog_comment
34
+ if params[:id].present?
35
+ @blog_comment = Content::BlogComment.find(params[:id])
36
+
37
+ @user = User.where(id: @blog_comment.user_id).first
38
+ end
39
+ end
40
+
41
+ def new_admin_comment_params
42
+ params[:comment].permit(:body).merge(
43
+ user_id: current_user.id,
44
+ user_info: current_user.public_info
45
+ )
46
+ end
47
+
48
+ def blog_comment_params
49
+ return {} if params[:blog_comment].blank?
50
+ params[:blog_comment].permit(:body, :pending, :approved)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,70 @@
1
+ module Workarea
2
+ module Admin
3
+ class ContentBlogEntriesController < Admin::ApplicationController
4
+ required_permissions :marketing
5
+ before_action :find_blog_entry, except: :index
6
+
7
+ def index
8
+ query_params = if params[:content_blog_id].blank?
9
+ params
10
+ else
11
+ blog = Content::Blog.find_by(slug: params[:content_blog_id])
12
+ params.merge(blog_id: blog.id.to_s)
13
+ end
14
+
15
+ search = Search::AdminBlogEntries.new(query_params)
16
+ @search = SearchViewModel.new(search, view_model_options)
17
+ @blog = BlogViewModel.new(blog, view_model_options)
18
+ end
19
+
20
+ def show
21
+ @blog_entry = BlogEntryViewModel.new(@blog_entry, params)
22
+ end
23
+
24
+ def edit
25
+ @blog_entry = BlogEntryViewModel.new(@blog_entry, params)
26
+ end
27
+
28
+ def update
29
+ if @blog_entry.update_attributes(params[:blog_entry])
30
+ flash[:success] = t('workarea.admin.content_blog_entries.flash_messages.updated')
31
+ redirect_to edit_content_blog_entry_path(@blog_entry)
32
+ else
33
+ @blog_entry = BlogEntryViewModel.new(@blog_entry, params)
34
+ render :edit
35
+ end
36
+ end
37
+
38
+ def thumbnail_image
39
+ @blog_entry = BlogEntryViewModel.wrap(@blog_entry, params)
40
+ end
41
+
42
+ def update_thumbnail_image
43
+ if @blog_entry.update_attributes(params[:blog_entry])
44
+ flash[:success] = t('workarea.admin.content_blog_entries.flash_messages.updated')
45
+ redirect_to thumbnail_image_content_blog_entry_path(@blog_entry)
46
+ else
47
+ @blog_entry = BlogEntryViewModel.wrap(@blog_entry, params)
48
+ render :thumbnail_image
49
+ end
50
+ end
51
+
52
+ def destroy
53
+ @blog_entry.destroy
54
+ flash[:success] = t('workarea.admin.content_blog_entries.flash_messages.deleted')
55
+ redirect_to content_blog_blog_entries_path(content_blog_id: @blog_entry.blog)
56
+ end
57
+
58
+ private
59
+
60
+ def find_blog_entry
61
+ if params[:id].present?
62
+ @blog_entry = Content::BlogEntry.find_by(slug: params[:id])
63
+ else
64
+ model = Content::Blog.find_by(slug: params[:content_blog_id])
65
+ @blog_entry = model.entries.build(params[:blog_entry])
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end