workarea-admin 3.4.45 → 3.5.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (388) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +52 -0
  3. data/app/assets/images/workarea/admin/email_logo.png +0 -0
  4. data/app/assets/javascripts/workarea/admin/application.js.erb +11 -1
  5. data/app/assets/javascripts/workarea/admin/config.js.erb +96 -0
  6. data/app/assets/javascripts/workarea/admin/modules/active_by_segment_tooltips.js +108 -0
  7. data/app/assets/javascripts/workarea/admin/modules/calendars.js +1 -1
  8. data/app/assets/javascripts/workarea/admin/modules/categorized_autocomplete_fields.js +1 -1
  9. data/app/assets/javascripts/workarea/admin/modules/impersonation_notification.js +44 -0
  10. data/app/assets/javascripts/workarea/admin/modules/jump_to_menus.js +74 -0
  11. data/app/assets/javascripts/workarea/admin/modules/new_navigation_taxons.js +1 -2
  12. data/app/assets/javascripts/workarea/admin/modules/release_reminder.js +1 -0
  13. data/app/assets/javascripts/workarea/admin/modules/selects.js +33 -0
  14. data/app/assets/javascripts/workarea/admin/modules/style_guide_autocomplete_fields.js +42 -0
  15. data/app/assets/javascripts/workarea/admin/modules/timeline_report_chart.js +105 -0
  16. data/app/assets/javascripts/workarea/admin/modules/toggle_elements.js +27 -0
  17. data/app/assets/javascripts/workarea/admin/modules/tribute_areas.js +91 -0
  18. data/app/assets/javascripts/workarea/admin/templates/chart_legend.jst.ejs +17 -9
  19. data/app/assets/javascripts/workarea/admin/templates/jump_to_menu.jst.ejs +13 -0
  20. data/app/assets/stylesheets/workarea/admin/application.scss.erb +3 -0
  21. data/app/assets/stylesheets/workarea/admin/base/_forms.scss +2 -2
  22. data/app/assets/stylesheets/workarea/admin/components/_activity.scss +24 -16
  23. data/app/assets/stylesheets/workarea/admin/components/_activity_group.scss +3 -19
  24. data/app/assets/stylesheets/workarea/admin/components/_box.scss +21 -5
  25. data/app/assets/stylesheets/workarea/admin/components/_calendar.scss +102 -140
  26. data/app/assets/stylesheets/workarea/admin/components/_chart_legend.scss +10 -13
  27. data/app/assets/stylesheets/workarea/admin/components/_checkbox.scss +49 -23
  28. data/app/assets/stylesheets/workarea/admin/components/_content_block_list.scss +5 -3
  29. data/app/assets/stylesheets/workarea/admin/components/_date_marker.scss +24 -3
  30. data/app/assets/stylesheets/workarea/admin/components/_index_table.scss +5 -0
  31. data/app/assets/stylesheets/workarea/admin/components/_jump_to_menu.scss +57 -0
  32. data/app/assets/stylesheets/workarea/admin/components/_product_summary.scss +46 -0
  33. data/app/assets/stylesheets/workarea/admin/components/_toggle_button.scss +1 -4
  34. data/app/assets/stylesheets/workarea/admin/email/_base.scss +30 -2
  35. data/app/assets/stylesheets/workarea/admin/email/_components.scss +66 -5
  36. data/app/assets/stylesheets/workarea/admin/email/_helpers.scss +16 -5
  37. data/app/assets/stylesheets/workarea/admin/email/{_settings.scss → _settings.scss.erb} +4 -4
  38. data/app/controllers/workarea/admin/application_controller.rb +2 -4
  39. data/app/controllers/workarea/admin/bulk_action_sequential_product_edits_controller.rb +4 -6
  40. data/app/controllers/workarea/admin/bulk_variant_saving.rb +1 -2
  41. data/app/controllers/workarea/admin/catalog_products_controller.rb +4 -6
  42. data/app/controllers/workarea/admin/catalog_variants_controller.rb +2 -3
  43. data/app/controllers/workarea/admin/comments_controller.rb +9 -0
  44. data/app/controllers/workarea/admin/configurations_controller.rb +29 -0
  45. data/app/controllers/workarea/admin/content_assets_controller.rb +3 -1
  46. data/app/controllers/workarea/admin/content_blocks_controller.rb +1 -7
  47. data/app/controllers/workarea/admin/create_catalog_products_controller.rb +2 -8
  48. data/app/controllers/workarea/admin/create_release_undos_controller.rb +43 -0
  49. data/app/controllers/workarea/admin/create_segments_controller.rb +68 -0
  50. data/app/controllers/workarea/admin/dashboards_controller.rb +2 -0
  51. data/app/controllers/workarea/admin/data_file_imports_controller.rb +7 -2
  52. data/app/controllers/workarea/admin/fulfillment_skus_controller.rb +58 -0
  53. data/app/controllers/workarea/admin/fulfillment_tokens_controller.rb +56 -0
  54. data/app/controllers/workarea/admin/guest_browsings_controller.rb +2 -2
  55. data/app/controllers/workarea/admin/impersonations_controller.rb +3 -4
  56. data/app/controllers/workarea/admin/orders_controller.rb +3 -0
  57. data/app/controllers/workarea/admin/pricing_discount_redemptions_controller.rb +13 -0
  58. data/app/controllers/workarea/admin/pricing_overrides_controller.rb +1 -1
  59. data/app/controllers/workarea/admin/product_rules_controller.rb +1 -2
  60. data/app/controllers/workarea/admin/releases_controller.rb +8 -13
  61. data/app/controllers/workarea/admin/reports_controller.rb +18 -0
  62. data/app/controllers/workarea/admin/segment_overrides_controller.rb +19 -0
  63. data/app/controllers/workarea/admin/segment_rules_controller.rb +62 -0
  64. data/app/controllers/workarea/admin/segments_controller.rb +48 -0
  65. data/app/controllers/workarea/admin/tax_rates_controller.rb +62 -1
  66. data/app/controllers/workarea/admin/unsubscribes_controller.rb +40 -0
  67. data/app/controllers/workarea/admin/users_controller.rb +19 -0
  68. data/app/helpers/workarea/admin/application_helper.rb +2 -12
  69. data/app/helpers/workarea/admin/configurations_helper.rb +9 -0
  70. data/app/helpers/workarea/admin/content_helper.rb +2 -3
  71. data/app/helpers/workarea/admin/fulfillment_helper.rb +10 -0
  72. data/app/helpers/workarea/admin/icons_helper.rb +26 -0
  73. data/app/helpers/workarea/admin/navigation_helper.rb +1 -0
  74. data/app/helpers/workarea/admin/pricing_overrides_helper.rb +1 -1
  75. data/app/helpers/workarea/admin/products_helper.rb +13 -0
  76. data/app/helpers/workarea/admin/releases_helper.rb +5 -21
  77. data/app/helpers/workarea/admin/segments_helper.rb +68 -0
  78. data/app/helpers/workarea/admin/settings_helper.rb +11 -3
  79. data/app/mailers/workarea/admin/comment_mailer.rb +3 -3
  80. data/app/mailers/workarea/admin/status_report_mailer.rb +19 -6
  81. data/app/view_models/workarea/admin/bulk_action_product_edit_view_model.rb +5 -0
  82. data/app/view_models/workarea/admin/changeset_view_model.rb +15 -3
  83. data/app/view_models/workarea/admin/code_list_view_model.rb +1 -1
  84. data/app/view_models/workarea/admin/commentable_view_model.rb +4 -0
  85. data/app/view_models/workarea/admin/content_view_model.rb +2 -0
  86. data/app/view_models/workarea/admin/dashboards/marketing_view_model.rb +5 -9
  87. data/app/view_models/workarea/admin/dashboards/reports_view_model.rb +25 -0
  88. data/app/view_models/workarea/admin/discounts/buy_some_get_some_view_model.rb +6 -0
  89. data/app/view_models/workarea/admin/discounts/category_view_model.rb +6 -0
  90. data/app/view_models/workarea/admin/discounts/free_gift_view_model.rb +6 -0
  91. data/app/view_models/workarea/admin/discounts/order_total_view_model.rb +6 -0
  92. data/app/view_models/workarea/admin/discounts/product_attribute_view_model.rb +6 -0
  93. data/app/view_models/workarea/admin/discounts/product_view_model.rb +6 -0
  94. data/app/view_models/workarea/admin/discounts/quantity_fixed_price_view_model.rb +6 -0
  95. data/app/view_models/workarea/admin/discounts/shipping_view_model.rb +6 -0
  96. data/app/view_models/workarea/admin/featured_products_view_model.rb +6 -12
  97. data/app/view_models/workarea/admin/fulfillment_sku_view_model.rb +22 -0
  98. data/app/view_models/workarea/admin/fulfillment_token_view_model.rb +15 -0
  99. data/app/view_models/workarea/admin/fulfillment_view_model.rb +14 -0
  100. data/app/view_models/workarea/admin/insight_view_model.rb +2 -2
  101. data/app/view_models/workarea/admin/insights/product_view_model.rb +2 -2
  102. data/app/view_models/workarea/admin/insights/segment_view_model.rb +25 -0
  103. data/app/view_models/workarea/admin/order_view_model.rb +4 -0
  104. data/app/view_models/workarea/admin/pricing_sku_view_model.rb +0 -51
  105. data/app/view_models/workarea/admin/product_rules_preview_view_model.rb +2 -2
  106. data/app/view_models/workarea/admin/product_view_model.rb +26 -5
  107. data/app/view_models/workarea/admin/recommendations_view_model.rb +3 -11
  108. data/app/view_models/workarea/admin/release_calendar_view_model.rb +4 -9
  109. data/app/view_models/workarea/admin/release_event_view_model.rb +8 -41
  110. data/app/view_models/workarea/admin/release_view_model.rb +10 -17
  111. data/app/view_models/workarea/admin/releases_feed_view_model.rb +5 -13
  112. data/app/view_models/workarea/admin/reports/customers_view_model.rb +4 -2
  113. data/app/view_models/workarea/admin/reports/low_inventory_view_model.rb +2 -5
  114. data/app/view_models/workarea/admin/reports/sales_by_category_view_model.rb +2 -5
  115. data/app/view_models/workarea/admin/reports/sales_by_discount_view_model.rb +2 -5
  116. data/app/view_models/workarea/admin/reports/sales_by_product_view_model.rb +2 -5
  117. data/app/view_models/workarea/admin/reports/sales_by_tender_view_model.rb +13 -0
  118. data/app/view_models/workarea/admin/reports/timeline_view_model.rb +74 -0
  119. data/app/view_models/workarea/admin/search_customization_product_rules_view_model.rb +1 -1
  120. data/app/view_models/workarea/admin/segment_view_model.rb +19 -0
  121. data/app/view_models/workarea/admin/user_view_model.rb +6 -9
  122. data/app/view_models/workarea/admin/variant_view_model.rb +8 -0
  123. data/app/views/layouts/workarea/admin/application.html.haml +1 -1
  124. data/app/views/layouts/workarea/admin/email.html.haml +35 -41
  125. data/app/views/workarea/admin/activities/_configuration_admin_update.html.haml +10 -0
  126. data/app/views/workarea/admin/activities/_fulfillment_sku_create.html.haml +12 -0
  127. data/app/views/workarea/admin/activities/_fulfillment_sku_destroy.html.haml +10 -0
  128. data/app/views/workarea/admin/activities/_fulfillment_sku_update.html.haml +10 -0
  129. data/app/views/workarea/admin/activities/_segment_create.html.haml +12 -0
  130. data/app/views/workarea/admin/activities/_segment_destroy.html.haml +10 -0
  131. data/app/views/workarea/admin/activities/_segment_update.html.haml +10 -0
  132. data/app/views/workarea/admin/activities/show.html.haml +18 -11
  133. data/app/views/workarea/admin/bulk_action_product_edits/edit.html.haml +4 -0
  134. data/app/views/workarea/admin/bulk_action_product_edits/review.html.haml +11 -4
  135. data/app/views/workarea/admin/bulk_action_sequential_product_edits/product.html.haml +1 -1
  136. data/app/views/workarea/admin/catalog_categories/_cards.html.haml +3 -1
  137. data/app/views/workarea/admin/catalog_categories/edit.html.haml +1 -4
  138. data/app/views/workarea/admin/catalog_categories/index.html.haml +1 -0
  139. data/app/views/workarea/admin/catalog_product_images/edit.html.haml +1 -1
  140. data/app/views/workarea/admin/catalog_products/_cards.html.haml +2 -4
  141. data/app/views/workarea/admin/catalog_products/edit.html.haml +2 -1
  142. data/app/views/workarea/admin/catalog_products/index.html.haml +4 -2
  143. data/app/views/workarea/admin/catalog_products/insights.html.haml +2 -0
  144. data/app/views/workarea/admin/catalog_variants/edit.html.haml +6 -1
  145. data/app/views/workarea/admin/catalog_variants/index.html.haml +2 -0
  146. data/app/views/workarea/admin/catalog_variants/new.html.haml +5 -0
  147. data/app/views/workarea/admin/changesets/fields/_active_segment_ids.html.haml +4 -0
  148. data/app/views/workarea/admin/comment_mailer/notify.html.haml +27 -19
  149. data/app/views/workarea/admin/comments/index.html.haml +18 -12
  150. data/app/views/workarea/admin/configurations/_overridden.html.haml +2 -0
  151. data/app/views/workarea/admin/configurations/show.html.haml +49 -0
  152. data/app/views/workarea/admin/configurations/types/_array.html.haml +3 -0
  153. data/app/views/workarea/admin/configurations/types/_boolean.html.haml +1 -0
  154. data/app/views/workarea/admin/configurations/types/_duration.html.haml +2 -0
  155. data/app/views/workarea/admin/configurations/types/_encrypted.html.haml +1 -0
  156. data/app/views/workarea/admin/configurations/types/_float.html.haml +1 -0
  157. data/app/views/workarea/admin/configurations/types/_hash.html.haml +17 -0
  158. data/app/views/workarea/admin/configurations/types/_integer.html.haml +1 -0
  159. data/app/views/workarea/admin/configurations/types/_select.html.haml +1 -0
  160. data/app/views/workarea/admin/configurations/types/_string.html.haml +1 -0
  161. data/app/views/workarea/admin/configurations/types/_symbol.html.haml +1 -0
  162. data/app/views/workarea/admin/content/_edit.html.haml +8 -1
  163. data/app/views/workarea/admin/content/_form.html.haml +13 -7
  164. data/app/views/workarea/admin/content/advanced.html.haml +18 -10
  165. data/app/views/workarea/admin/content_assets/_cards.html.haml +3 -0
  166. data/app/views/workarea/admin/content_assets/_summary.html.haml +1 -1
  167. data/app/views/workarea/admin/content_assets/edit.html.haml +6 -0
  168. data/app/views/workarea/admin/content_assets/index.html.haml +7 -2
  169. data/app/views/workarea/admin/content_assets/new.html.haml +10 -3
  170. data/app/views/workarea/admin/content_blocks/_asset.html.haml +8 -1
  171. data/app/views/workarea/admin/content_pages/_cards.html.haml +1 -0
  172. data/app/views/workarea/admin/content_pages/edit.html.haml +1 -1
  173. data/app/views/workarea/admin/content_pages/index.html.haml +1 -0
  174. data/app/views/workarea/admin/create_catalog_categories/publish.html.haml +1 -0
  175. data/app/views/workarea/admin/create_catalog_products/content.html.haml +1 -1
  176. data/app/views/workarea/admin/create_catalog_products/publish.html.haml +1 -0
  177. data/app/views/workarea/admin/create_content_pages/publish.html.haml +1 -0
  178. data/app/views/workarea/admin/create_pricing_discounts/publish.html.haml +1 -0
  179. data/app/views/workarea/admin/create_release_undos/new.html.haml +45 -0
  180. data/app/views/workarea/admin/create_release_undos/review.html.haml +51 -0
  181. data/app/views/workarea/admin/create_releases/plan.html.haml +4 -3
  182. data/app/views/workarea/admin/create_releases/setup.html.haml +8 -12
  183. data/app/views/workarea/admin/create_segments/rules.html.haml +55 -0
  184. data/app/views/workarea/admin/create_segments/setup.html.haml +42 -0
  185. data/app/views/workarea/admin/create_users/admin.html.haml +0 -2
  186. data/app/views/workarea/admin/dashboards/catalog.html.haml +1 -0
  187. data/app/views/workarea/admin/dashboards/people.html.haml +1 -1
  188. data/app/views/workarea/admin/dashboards/reports.html.haml +31 -0
  189. data/app/views/workarea/admin/dashboards/settings.html.haml +23 -3
  190. data/app/views/workarea/admin/data_file_imports/new.html.haml +4 -2
  191. data/app/views/workarea/admin/data_file_mailer/export.html.haml +2 -0
  192. data/app/views/workarea/admin/data_file_mailer/import.html.haml +2 -0
  193. data/app/views/workarea/admin/data_file_mailer/import_failure.html.haml +2 -0
  194. data/app/views/workarea/admin/facets/_applied.html.haml +1 -1
  195. data/app/views/workarea/admin/featured_products/_selected.html.haml +3 -2
  196. data/app/views/workarea/admin/featured_products/_unselected.html.haml +3 -1
  197. data/app/views/workarea/admin/featured_products/edit.html.haml +3 -3
  198. data/app/views/workarea/admin/featured_products/select.html.haml +0 -1
  199. data/app/views/workarea/admin/fulfillment_skus/_aux_navigation.html.haml +3 -0
  200. data/app/views/workarea/admin/fulfillment_skus/_cards.html.haml +57 -0
  201. data/app/views/workarea/admin/fulfillment_skus/_summary.html.haml +6 -0
  202. data/app/views/workarea/admin/fulfillment_skus/edit.html.haml +53 -0
  203. data/app/views/workarea/admin/fulfillment_skus/index.html.haml +75 -0
  204. data/app/views/workarea/admin/fulfillment_skus/new.html.haml +41 -0
  205. data/app/views/workarea/admin/fulfillment_skus/show.html.haml +17 -0
  206. data/app/views/workarea/admin/fulfillment_tokens/index.html.haml +73 -0
  207. data/app/views/workarea/admin/fulfillments/show.html.haml +41 -6
  208. data/app/views/workarea/admin/insights/_most_discounted_products.html.haml +4 -4
  209. data/app/views/workarea/admin/inventory_skus/show.html.haml +1 -1
  210. data/app/views/workarea/admin/navigation_menus/_summary.html.haml +1 -1
  211. data/app/views/workarea/admin/navigation_menus/edit.html.haml +1 -1
  212. data/app/views/workarea/admin/navigation_menus/index.html.haml +3 -1
  213. data/app/views/workarea/admin/navigation_redirects/index.html.haml +0 -5
  214. data/app/views/workarea/admin/navigation_taxons/index.html.haml +20 -4
  215. data/app/views/workarea/admin/orders/_cards.html.haml +23 -5
  216. data/app/views/workarea/admin/orders/attributes.html.haml +4 -1
  217. data/app/views/workarea/admin/orders/fraud.html.haml +43 -0
  218. data/app/views/workarea/admin/orders/index.html.haml +1 -0
  219. data/app/views/workarea/admin/orders/timeline.html.haml +1 -1
  220. data/app/views/workarea/admin/pricing_discount_code_lists/_cards.html.haml +1 -1
  221. data/app/views/workarea/admin/pricing_discount_code_lists/promo_codes.html.haml +1 -1
  222. data/app/views/workarea/admin/pricing_discount_redemptions/index.html.haml +44 -0
  223. data/app/views/workarea/admin/pricing_discounts/_cards.html.haml +22 -0
  224. data/app/views/workarea/admin/pricing_discounts/conditions/_segments.html.haml +5 -0
  225. data/app/views/workarea/admin/pricing_discounts/edit.html.haml +5 -15
  226. data/app/views/workarea/admin/pricing_discounts/index.html.haml +1 -0
  227. data/app/views/workarea/admin/pricing_discounts/properties/_buy_some_get_some.html.haml +1 -0
  228. data/app/views/workarea/admin/pricing_discounts/properties/_category.html.haml +1 -0
  229. data/app/views/workarea/admin/pricing_discounts/properties/_free_gift.html.haml +1 -0
  230. data/app/views/workarea/admin/pricing_discounts/properties/_order_total.html.haml +1 -0
  231. data/app/views/workarea/admin/pricing_discounts/properties/_product.html.haml +1 -0
  232. data/app/views/workarea/admin/pricing_discounts/properties/_product_attribute.html.haml +2 -1
  233. data/app/views/workarea/admin/pricing_discounts/properties/_quantity_fixed_price.html.haml +1 -0
  234. data/app/views/workarea/admin/pricing_discounts/properties/_shipping.html.haml +1 -0
  235. data/app/views/workarea/admin/pricing_skus/_cards.html.haml +7 -7
  236. data/app/views/workarea/admin/pricing_skus/edit.html.haml +5 -5
  237. data/app/views/workarea/admin/pricing_skus/index.html.haml +4 -4
  238. data/app/views/workarea/admin/pricing_skus/new.html.haml +6 -9
  239. data/app/views/workarea/admin/product_rules/_card.html.haml +2 -2
  240. data/app/views/workarea/admin/product_rules/_form.html.haml +1 -0
  241. data/app/views/workarea/admin/product_rules/index.html.haml +2 -0
  242. data/app/views/workarea/admin/releases/_cards.html.haml +50 -12
  243. data/app/views/workarea/admin/releases/_publish.html.haml +1 -1
  244. data/app/views/workarea/admin/releases/edit.html.haml +33 -46
  245. data/app/views/workarea/admin/releases/index.html.haml +81 -90
  246. data/app/views/workarea/admin/releases/list.html.haml +107 -0
  247. data/app/views/workarea/admin/releases/original.html.haml +50 -0
  248. data/app/views/workarea/admin/releases/show.html.haml +3 -17
  249. data/app/views/workarea/admin/releases/undo.html.haml +64 -0
  250. data/app/views/workarea/admin/reports/average_order_value.html.haml +1 -1
  251. data/app/views/workarea/admin/reports/customers.html.haml +4 -0
  252. data/app/views/workarea/admin/reports/first_time_vs_returning_sales.html.haml +1 -1
  253. data/app/views/workarea/admin/reports/reference.html.haml +19 -60
  254. data/app/views/workarea/admin/reports/sales_by_country.html.haml +6 -0
  255. data/app/views/workarea/admin/reports/sales_by_product.html.haml +6 -0
  256. data/app/views/workarea/admin/reports/sales_by_sku.html.haml +6 -0
  257. data/app/views/workarea/admin/reports/sales_by_tender.html.haml +30 -0
  258. data/app/views/workarea/admin/reports/sales_over_time.html.haml +5 -1
  259. data/app/views/workarea/admin/reports/timeline.html.haml +20 -0
  260. data/app/views/workarea/admin/search_customizations/_cards.html.haml +1 -0
  261. data/app/views/workarea/admin/search_customizations/edit.html.haml +1 -1
  262. data/app/views/workarea/admin/search_customizations/index.html.haml +1 -0
  263. data/app/views/workarea/admin/searches/show.html.haml +6 -5
  264. data/app/views/workarea/admin/segment_overrides/show.html.haml +29 -0
  265. data/app/views/workarea/admin/segment_rules/_form.html.haml +13 -0
  266. data/app/views/workarea/admin/segment_rules/fields/_browser_info.html.haml +13 -0
  267. data/app/views/workarea/admin/segment_rules/fields/_geolocation.html.haml +4 -0
  268. data/app/views/workarea/admin/segment_rules/fields/_last_order.html.haml +3 -0
  269. data/app/views/workarea/admin/segment_rules/fields/_logged_in.html.haml +2 -0
  270. data/app/views/workarea/admin/segment_rules/fields/_orders.html.haml +5 -0
  271. data/app/views/workarea/admin/segment_rules/fields/_revenue.html.haml +9 -0
  272. data/app/views/workarea/admin/segment_rules/fields/_sessions.html.haml +5 -0
  273. data/app/views/workarea/admin/segment_rules/fields/_tags.html.haml +4 -0
  274. data/app/views/workarea/admin/segment_rules/fields/_traffic_referrer.html.haml +13 -0
  275. data/app/views/workarea/admin/segment_rules/geolocation_options.json.jbuilder +4 -0
  276. data/app/views/workarea/admin/segment_rules/index.html.haml +25 -0
  277. data/app/views/workarea/admin/segment_rules/summaries/_browser_info.html.haml +11 -0
  278. data/app/views/workarea/admin/segment_rules/summaries/_geolocation.html.haml +2 -0
  279. data/app/views/workarea/admin/segment_rules/summaries/_last_order.html.haml +2 -0
  280. data/app/views/workarea/admin/segment_rules/summaries/_logged_in.html.haml +5 -0
  281. data/app/views/workarea/admin/segment_rules/summaries/_orders.html.haml +6 -0
  282. data/app/views/workarea/admin/segment_rules/summaries/_revenue.html.haml +7 -0
  283. data/app/views/workarea/admin/segment_rules/summaries/_sessions.html.haml +6 -0
  284. data/app/views/workarea/admin/segment_rules/summaries/_tags.html.haml +2 -0
  285. data/app/views/workarea/admin/segment_rules/summaries/_traffic_referrer.html.haml +10 -0
  286. data/app/views/workarea/admin/segments/_cards.html.haml +81 -0
  287. data/app/views/workarea/admin/segments/_publish.html.haml +10 -0
  288. data/app/views/workarea/admin/segments/edit.html.haml +41 -0
  289. data/app/views/workarea/admin/segments/index.html.haml +64 -0
  290. data/app/views/workarea/admin/segments/insights.html.haml +52 -0
  291. data/app/views/workarea/admin/segments/show.html.haml +20 -0
  292. data/app/views/workarea/admin/shared/_active_field.html.haml +17 -0
  293. data/app/views/workarea/admin/shared/_bulk_actions.html.haml +10 -8
  294. data/app/views/workarea/admin/shared/_primary_nav.html.haml +5 -2
  295. data/app/views/workarea/admin/shared/_toggle_button.html.haml +1 -1
  296. data/app/views/workarea/admin/shipping_services/edit.html.haml +0 -4
  297. data/app/views/workarea/admin/shipping_services/new.html.haml +0 -4
  298. data/app/views/workarea/admin/status_report_mailer/report.html.haml +83 -86
  299. data/app/views/workarea/admin/style_guides/components/_activity.html.haml +3 -5
  300. data/app/views/workarea/admin/style_guides/components/_activity_group.html.haml +9 -15
  301. data/app/views/workarea/admin/style_guides/components/_box.html.haml +12 -7
  302. data/app/views/workarea/admin/style_guides/components/_checkbox.html.haml +21 -2
  303. data/app/views/workarea/admin/style_guides/components/_release_changeset.html.haml +3 -5
  304. data/app/views/workarea/admin/tax_rates/edit.html.haml +64 -0
  305. data/app/views/workarea/admin/tax_rates/index.html.haml +59 -20
  306. data/app/views/workarea/admin/tax_rates/new.html.haml +62 -0
  307. data/app/views/workarea/admin/timeline/show.html.haml +34 -41
  308. data/app/views/workarea/admin/toolbar/show.html.haml +11 -1
  309. data/app/views/workarea/admin/trash/index.html.haml +1 -1
  310. data/app/views/workarea/admin/users/edit.html.haml +60 -57
  311. data/app/views/workarea/admin/users/index.html.haml +1 -3
  312. data/app/views/workarea/admin/users/index.json.jbuilder +8 -0
  313. data/app/views/workarea/admin/users/insights.html.haml +31 -23
  314. data/app/views/workarea/admin/users/permissions.html.haml +10 -1
  315. data/app/views/workarea/admin/users/show.html.haml +7 -0
  316. data/config/locales/en.yml +569 -124
  317. data/config/routes.rb +57 -5
  318. data/lib/workarea/mailer_previews/admin/status_report_mailer_preview.rb +3 -1
  319. data/public/workarea/import_samples/tax_rates.csv +3 -3
  320. data/test/dummy/config/initializers/session_store.rb +1 -1
  321. data/test/helpers/workarea/admin/application_helper_test.rb +0 -16
  322. data/test/helpers/workarea/admin/icons_helper_test.rb +9 -0
  323. data/test/helpers/workarea/admin/products_helper_test.rb +73 -0
  324. data/test/helpers/workarea/admin/releases_helper_test.rb +0 -49
  325. data/test/helpers/workarea/admin/settings_helper_test.rb +22 -1
  326. data/test/integration/workarea/admin/assets_integration_test.rb +2 -5
  327. data/test/integration/workarea/admin/comments_integration_test.rb +27 -7
  328. data/test/integration/workarea/admin/configurations_integration_test.rb +21 -0
  329. data/test/integration/workarea/admin/create_release_undos_integration_test.rb +29 -0
  330. data/test/integration/workarea/admin/create_segments_integration_test.rb +26 -0
  331. data/test/integration/workarea/admin/data_file_imports_integration_test.rb +34 -8
  332. data/test/integration/workarea/admin/fulfillment_skus_integration_test.rb +55 -0
  333. data/test/integration/workarea/admin/fulfillment_tokens_integration_test.rb +43 -0
  334. data/test/integration/workarea/admin/guest_browsings_integration_test.rb +8 -32
  335. data/test/integration/workarea/admin/impersonations_integration_test.rb +13 -57
  336. data/test/integration/workarea/admin/jump_to_integration_test.rb +0 -29
  337. data/test/integration/workarea/admin/pricing_overrides_integration_test.rb +11 -0
  338. data/test/integration/workarea/admin/products_integration_test.rb +0 -13
  339. data/test/integration/workarea/admin/releases_integration_test.rb +71 -87
  340. data/test/integration/workarea/admin/segment_overrides_integration_test.rb +28 -0
  341. data/test/integration/workarea/admin/segment_rules_integration_test.rb +49 -0
  342. data/test/integration/workarea/admin/segments_integration_test.rb +31 -0
  343. data/test/integration/workarea/admin/shipping_service_integration_test.rb +1 -3
  344. data/test/integration/workarea/admin/tax_categories_integration_test.rb +1 -1
  345. data/test/integration/workarea/admin/unsubscribes_integration_test.rb +32 -0
  346. data/test/integration/workarea/admin/users_integration_test.rb +32 -0
  347. data/test/javascripts/fixtures/release_reminder.html.haml +3 -3
  348. data/test/javascripts/new_navigation_taxons_spec.js +1 -12
  349. data/test/mailers/workarea/admin/comment_mailer_test.rb +35 -0
  350. data/test/mailers/workarea/admin/status_report_mailer_test.rb +30 -25
  351. data/test/system/workarea/admin/alerts_system_test.rb +2 -1
  352. data/test/system/workarea/admin/bulk_actions_system_test.rb +1 -1
  353. data/test/system/workarea/admin/comments_system_test.rb +43 -0
  354. data/test/system/workarea/admin/content_system_test.rb +6 -0
  355. data/test/system/workarea/admin/dashboard_system_test.rb +8 -9
  356. data/test/system/workarea/admin/data_files_system_test.rb +1 -1
  357. data/test/system/workarea/admin/discounts_system_test.rb +18 -0
  358. data/test/system/workarea/admin/featured_products_system_test.rb +3 -0
  359. data/test/system/workarea/admin/fulfillment_skus_system_test.rb +48 -0
  360. data/test/system/workarea/admin/impersonation_system_test.rb +5 -2
  361. data/test/system/workarea/admin/orders_system_test.rb +32 -21
  362. data/test/system/workarea/admin/payment_transactions_system_test.rb +34 -32
  363. data/test/system/workarea/admin/releases_system_test.rb +151 -37
  364. data/test/system/workarea/admin/reports_system_test.rb +29 -0
  365. data/test/system/workarea/admin/segments_system_test.rb +124 -0
  366. data/test/system/workarea/admin/tax_categories_system_test.rb +166 -16
  367. data/test/system/workarea/admin/users_system_test.rb +15 -0
  368. data/test/view_models/workarea/admin/changeset_view_model_test.rb +59 -9
  369. data/test/view_models/workarea/admin/code_list_view_model_test.rb +0 -5
  370. data/test/view_models/workarea/admin/content_view_model_test.rb +13 -11
  371. data/test/view_models/workarea/admin/insights/product_view_model_test.rb +4 -4
  372. data/test/view_models/workarea/admin/insights/segment_view_model_test.rb +73 -0
  373. data/test/view_models/workarea/admin/product_rules_preview_view_model_test.rb +37 -0
  374. data/test/view_models/workarea/admin/product_view_model_test.rb +13 -19
  375. data/test/view_models/workarea/admin/release_calendar_view_model_test.rb +16 -0
  376. data/test/view_models/workarea/admin/release_view_model_test.rb +13 -56
  377. data/test/view_models/workarea/admin/releases_feed_view_model_test.rb +8 -21
  378. data/test/view_models/workarea/admin/reports/timeline_view_model_test.rb +76 -0
  379. data/test/view_models/workarea/admin/search_analysis_view_model_test.rb +14 -16
  380. data/test/view_models/workarea/admin/timeline_view_model_test.rb +1 -1
  381. metadata +128 -17
  382. data/app/views/workarea/admin/featured_products/_release_preview_warning.html.haml +0 -4
  383. data/app/views/workarea/admin/releases/calendar.html.haml +0 -54
  384. data/test/dummy/tmp/screenshots/.keep +0 -0
  385. data/test/helpers/workarea/admin/content_helper_test.rb +0 -17
  386. data/test/integration/workarea/admin/index_tracking_integration_test.rb +0 -21
  387. data/test/javascripts/fixtures/existing_navigation_taxon.html.haml +0 -10
  388. data/test/view_models/workarea/admin/pricing_sku_view_model_test.rb +0 -84
data/config/routes.rb CHANGED
@@ -50,8 +50,12 @@ Workarea::Admin::Engine.routes.draw do
50
50
  only: [:show, :edit, :update], controller: :bulk_action_exports
51
51
 
52
52
  resources :commentables, only: [] do
53
- resources :comments, except: :new
54
- get :unsubscribe, to: 'comments#unsubscribe'
53
+ resources :comments, except: :new do
54
+ collection do
55
+ put :subscribe
56
+ put :unsubscribe
57
+ end
58
+ end
55
59
  end
56
60
 
57
61
  resources :content_assets do
@@ -104,14 +108,20 @@ Workarea::Admin::Engine.routes.draw do
104
108
  resources :releases do
105
109
  resources :changesets, only: [:index, :destroy]
106
110
  resources :releasables, only: [:index, :show]
111
+ resource :undo, controller: 'create_release_undos', only: [:new, :create] do
112
+ get :review
113
+ post :complete
114
+ end
107
115
 
108
116
  member do
109
117
  get 'edit_for/:type', action: :edit_for, as: :edit_for
118
+ get :undo
119
+ get :original
110
120
  patch :publish
111
- patch :undo
112
121
  end
113
122
 
114
123
  collection do
124
+ get 'list'
115
125
  get 'calendar_feed/:token/site_planner.ics', action: :calendar_feed, as: :calendar_feed
116
126
  end
117
127
  end
@@ -131,10 +141,12 @@ Workarea::Admin::Engine.routes.draw do
131
141
  get :sales_by_country
132
142
  get :sales_by_discount
133
143
  get :sales_by_product
134
- get :sales_by_traffic_referrer
135
144
  get :sales_by_sku
145
+ get :sales_by_tender
146
+ get :sales_by_traffic_referrer
136
147
  get :sales_over_time
137
148
  get :searches
149
+ get :timeline
138
150
 
139
151
  post :export
140
152
  get '/:id/download', action: :download, as: :download
@@ -146,6 +158,7 @@ Workarea::Admin::Engine.routes.draw do
146
158
  member do
147
159
  get :attributes
148
160
  get :timeline
161
+ get :fraud
149
162
  end
150
163
 
151
164
  resources :shippings, only: :index
@@ -159,6 +172,9 @@ Workarea::Admin::Engine.routes.draw do
159
172
  resources :payment_transactions, only: [:index, :show]
160
173
 
161
174
  resources :fulfillments, only: :show
175
+ resources :fulfillment_skus do
176
+ resources :fulfillment_tokens, as: :tokens
177
+ end
162
178
 
163
179
  resources :catalog_products, except: [:new, :create] do
164
180
  resources :variants, controller: 'catalog_variants', except: :show do
@@ -296,6 +312,8 @@ Workarea::Admin::Engine.routes.draw do
296
312
  end
297
313
 
298
314
  resources :pricing_discounts, except: [:new, :create] do
315
+ resources :redemptions, only: [:index], controller: 'pricing_discount_redemptions'
316
+
299
317
  member do
300
318
  get :rules
301
319
  get :insights
@@ -334,6 +352,38 @@ Workarea::Admin::Engine.routes.draw do
334
352
  get :addresses
335
353
  get :permissions
336
354
  get :insights
355
+ post :send_password_reset
356
+ patch :unlock
357
+ end
358
+ end
359
+
360
+ resources :unsubscribes, only: [] do
361
+ member do
362
+ get :status_report
363
+ get :commentable
364
+ end
365
+ end
366
+
367
+ resources :segments, except: [:new, :create] do
368
+ resources :rules, except: [:show, :new, :edit], controller: 'segment_rules'
369
+
370
+ member do
371
+ get :insights
372
+ end
373
+ end
374
+ resource :segment_override, only: [:show, :create]
375
+ resources :segment_rules, only: [] do
376
+ collection do
377
+ get :geolocation_options
378
+ end
379
+ end
380
+
381
+ resources :create_segments, except: :show do
382
+ member do
383
+ get :rules
384
+ get :new_rule
385
+ get 'edit_rule/:rule_id', action: :edit_rule, as: :edit_rule
386
+ get :review
337
387
  end
338
388
  end
339
389
 
@@ -341,7 +391,7 @@ Workarea::Admin::Engine.routes.draw do
341
391
 
342
392
  resources :shipping_services
343
393
  resources :tax_categories do
344
- resources :tax_rates, only: :index, as: :rates, path: 'rates'
394
+ resources :tax_rates, except: :show, as: :rates, path: 'rates'
345
395
  end
346
396
 
347
397
  get 'toolbar', to: 'toolbar#show', as: 'toolbar'
@@ -368,5 +418,7 @@ Workarea::Admin::Engine.routes.draw do
368
418
  get :settings
369
419
  end
370
420
 
421
+ resource :configuration, only: [:show, :update]
422
+
371
423
  root to: 'dashboards#index', via: :get
372
424
  end
@@ -2,7 +2,9 @@ module Workarea
2
2
  module Admin
3
3
  class StatusReportMailerPreview < ActionMailer::Preview
4
4
  def report
5
- StatusReportMailer.report('test@workarea.com', Date.current)
5
+ user = User.status_email_recipients.to_a.first
6
+ email = user&.email || 'test@workarea.com'
7
+ StatusReportMailer.report(email, user: user)
6
8
  end
7
9
  end
8
10
  end
@@ -1,3 +1,3 @@
1
- state,zip_code,tax_region_name,tax_region_code,estimated_combined_rate,state_rate,county_rate,city_rate,special_rate,country,tier_min,tier_max,charge_on_shipping
2
- PA,19106,PHILADELPHIA COUNTY,BMWV,0.080000,0.060000,0.020000,0,0,US,0,10000.00,false
3
- PA,19021,,,0.060000,,,,,,,
1
+ state,zip_code,tax_region_name,tax_region_code,estimated_combined_rate,federal_rate,state_rate,county_rate,city_rate,special_rate,country,tier_min,tier_max,charge_on_shipping
2
+ PA,19106,PHILADELPHIA COUNTY,BMWV,0.080000,0,0.060000,0.020000,0,0,US,0,10000.00,false
3
+ PA,19021,,,0.060000,0,0.060000,0,0,0,,,
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.session_store :cookie_store, key: '_dummy_session'
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session', expire_after: 30.minutes
@@ -78,22 +78,6 @@ module Workarea
78
78
  result = pagination_path_for(page: 2)
79
79
  assert_equal('/foo?asdf=blah&page=2', result)
80
80
  end
81
-
82
- def test_duration_in_words
83
- assert_equal(
84
- t('workarea.duration.days', count: 2),
85
- duration_in_words(2.days)
86
- )
87
-
88
- assert_equal(
89
- [
90
- t('workarea.duration.years', count: 1),
91
- t('workarea.duration.months', count: 2),
92
- t('workarea.duration.days', count: 12),
93
- ].to_sentence,
94
- duration_in_words(2.months + 1.years + 12.days)
95
- )
96
- end
97
81
  end
98
82
  end
99
83
  end
@@ -57,6 +57,15 @@ module Workarea
57
57
  result = trending_icon_for(ProductViewModel.wrap(product))
58
58
  assert_equal('workarea/admin/icons/fire.svg', result.first)
59
59
  end
60
+
61
+ def test_fraud_icon_for
62
+ order = create_order
63
+ assert_nil(fraud_icon_for(order))
64
+
65
+ order = create_order(fraud_suspected_at: Time.current)
66
+ result = fraud_icon_for(order)
67
+ assert_equal('workarea/admin/icons/alert.svg', result.first)
68
+ end
60
69
  end
61
70
  end
62
71
  end
@@ -0,0 +1,73 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class ProductsHelperTest < ViewTest
6
+ setup :create_products
7
+
8
+ def create_products
9
+ inactive = create_product(active: false)
10
+ @inactive = ProductViewModel.wrap(inactive)
11
+
12
+ backordered = create_product(variants: [{ sku: 'BACKORDERED' }])
13
+ @backordered = ProductViewModel.wrap(backordered)
14
+
15
+ out_of_stock = create_product(variants: [{ sku: 'OUTOFSTOCK' }])
16
+ @out_of_stock = ProductViewModel.wrap(out_of_stock)
17
+
18
+ low_inventory = create_product(variants: [{ sku: 'LOWINVENTORY' }])
19
+ @low_inventory = ProductViewModel.wrap(low_inventory)
20
+
21
+ displayable = create_product(variants: [{ sku: 'DISPLAYABLE' }])
22
+ @displayable = ProductViewModel.wrap(displayable)
23
+
24
+ create_inventory(
25
+ id: 'BACKORDERED',
26
+ policy: 'allow_backorder',
27
+ backordered: 1,
28
+ available: 0
29
+ )
30
+
31
+ create_inventory(
32
+ id: 'OUTOFSTOCK',
33
+ policy: 'standard',
34
+ backordered: 0,
35
+ available: 0
36
+ )
37
+
38
+ create_inventory(
39
+ id: 'LOWINVENTORY',
40
+ available: Workarea.config.low_inventory_threshold - 1
41
+ )
42
+
43
+ create_inventory(
44
+ id: 'DISPLAYABLE',
45
+ policy: 'displayable_when_out_of_stock',
46
+ backordered: 0,
47
+ available: 0
48
+ )
49
+ end
50
+
51
+ def test_summary_inventory_status_css_classes
52
+ result = summary_inventory_status_css_classes(@inactive)
53
+ assert_includes(result, 'product-summary--inactive')
54
+ assert_includes(result, 'product-summary--status-issue')
55
+
56
+ result = summary_inventory_status_css_classes(@backordered)
57
+ assert_includes(result, 'product-summary--backordered')
58
+ assert_includes(result, 'product-summary--status-issue')
59
+
60
+ result = summary_inventory_status_css_classes(@out_of_stock)
61
+ assert_includes(result, 'product-summary--out-of-stock')
62
+ assert_includes(result, 'product-summary--status-issue')
63
+
64
+ result = summary_inventory_status_css_classes(@low_inventory)
65
+ assert_includes(result, 'product-summary--low-inventory')
66
+ assert_includes(result, 'product-summary--status-issue')
67
+
68
+ result = summary_inventory_status_css_classes(@displayable)
69
+ assert(result.empty?)
70
+ end
71
+ end
72
+ end
73
+ end
@@ -98,55 +98,6 @@ module Workarea
98
98
  assert(classes.include?('calendar__day--today'))
99
99
  assert_equal(start_of_week, classes.include?('calendar__day--start-of-week'))
100
100
  end
101
-
102
- def test_calendar_release_classes
103
- today = Time.zone.today
104
- day = today.strftime('%Y-%m-%d')
105
-
106
- release = create_release({ published_at: today })
107
- view_model = ReleaseViewModel.new(release)
108
-
109
- classes = calendar_release_classes(day, view_model)
110
-
111
- assert(classes.include?('calendar__release'))
112
- assert(classes.include?('calendar__release--start'))
113
- assert(classes.include?('calendar__release--end'))
114
- assert(classes.include?('calendar__release--content'))
115
-
116
- today = Time.zone.today
117
- day = today.strftime('%Y-%m-%d')
118
-
119
- release = create_release({ published_at: today, undo_at: today + 1.day })
120
- view_model = ReleaseViewModel.new(release)
121
-
122
- classes = calendar_release_classes(day, view_model)
123
-
124
- assert(classes.include?('calendar__release'))
125
- assert(classes.include?('calendar__release--start'))
126
- refute(classes.include?('calendar__release--end'))
127
- refute(classes.include?('calendar__release--content'))
128
- end
129
-
130
- def test_calendar_release_styles
131
- release = ReleaseViewModel.new(create_release(published_at: Time.zone.today))
132
-
133
- assert_nil(calendar_release_styles(release))
134
-
135
- dark_release = ReleaseViewModel.new(create_release(
136
- name: "Foo",
137
- published_at: Time.zone.today,
138
- undo_at: Time.zone.today + 1.day
139
- ))
140
-
141
- light_release = ReleaseViewModel.new(create_release(
142
- name: "Bar",
143
- published_at: Time.zone.today + 1.week,
144
- undo_at: Time.zone.today + 2.weeks
145
- ))
146
-
147
- assert_match(/; color: #ffffff/, calendar_release_styles(dark_release))
148
- assert_match(/; color: #000000/, calendar_release_styles(light_release))
149
- end
150
101
  end
151
102
  end
152
103
  end
@@ -7,7 +7,8 @@ module Workarea
7
7
 
8
8
  def test_sanitize_config_value
9
9
  assert(sanitize_config_value([]).blank?)
10
- assert(sanitize_config_value(Object.new).blank?)
10
+ assert(sanitize_config_value('').blank?)
11
+ assert(sanitize_config_value(nil).blank?)
11
12
 
12
13
  assert_equal(
13
14
  '<code class="code code--block">foo</code>',
@@ -19,6 +20,21 @@ module Workarea
19
20
  sanitize_config_value(':foo')
20
21
  )
21
22
 
23
+ assert_equal(
24
+ '<code class="code code--block">3</code>',
25
+ sanitize_config_value(3)
26
+ )
27
+
28
+ assert_equal(
29
+ '<code class="code code--block">false</code>',
30
+ sanitize_config_value(false)
31
+ )
32
+
33
+ assert_equal(
34
+ '<code class="code code--block">30 days</code>',
35
+ sanitize_config_value(30.days)
36
+ )
37
+
22
38
  assert_match(
23
39
  /pre.*expandable.*code.*{\n.*foo.*bar.*\n.*}/,
24
40
  sanitize_config_value({ foo: 'bar' })
@@ -28,6 +44,11 @@ module Workarea
28
44
  /pre.*expandable.*code.*\[\n.*foo.*\n.*bar.*\n.*\]/,
29
45
  sanitize_config_value(['foo', 'bar'])
30
46
  )
47
+
48
+ assert_match(
49
+ /pre.*expandable.*code.*\[\n.*foo.*\n.*bar.*\n.*\]/,
50
+ sanitize_config_value(SwappableList.new(['foo', 'bar']))
51
+ )
31
52
  end
32
53
  end
33
54
  end
@@ -6,16 +6,13 @@ module Workarea
6
6
  include Admin::IntegrationTest
7
7
 
8
8
  def test_ensures_cors_policy_for_bulk_upload
9
- Workarea.s3.expects(:get_bucket_cors).returns(mock_s3_cors_response).once
10
- Workarea.s3.expects(:put_bucket_cors).once
9
+ DirectUpload.expects(:ensure_cors!).once
11
10
  get admin.content_assets_path
12
11
  assert(response.ok?)
13
12
 
13
+ DirectUpload.expects(:ensure_cors!).never
14
14
  get admin.content_assets_path, xhr: true
15
15
  assert(response.ok?)
16
-
17
- get admin.content_assets_path
18
- assert(response.ok?)
19
16
  end
20
17
 
21
18
  def test_can_create_an_asset
@@ -50,6 +50,16 @@ module Workarea
50
50
  end
51
51
  end
52
52
 
53
+ def test_viewing_comments_without_an_author
54
+ create_comment(
55
+ commentable: commentable,
56
+ body: 'system generated comment'
57
+ )
58
+
59
+ get admin.commentable_comments_path(commentable.to_global_id)
60
+ assert(response.ok?)
61
+ end
62
+
53
63
  def test_adding_comment_and_subscribing
54
64
  create_comment(commentable: commentable, body: 'comment history')
55
65
 
@@ -112,13 +122,6 @@ module Workarea
112
122
  assert_equal(0, Comment.count)
113
123
  end
114
124
 
115
- def test_unsubscribing_from_email_notifications
116
- get admin.commentable_unsubscribe_url(commentable.to_global_id)
117
-
118
- commentable.reload
119
- assert_equal([user_1.id.to_s], commentable.subscribed_user_ids)
120
- end
121
-
122
125
  def test_commenting_with_active_release
123
126
  product = create_product(name: 'Foo')
124
127
  release = create_release
@@ -142,6 +145,23 @@ module Workarea
142
145
  assert_equal('Foo', product.name)
143
146
  release.as_current { assert_equal('Bar', product.reload.name) }
144
147
  end
148
+
149
+ def test_subscribing_to_comments
150
+ put admin.subscribe_commentable_comments_path(commentable.to_global_id)
151
+
152
+ assert_redirected_to(admin.commentable_comments_path(commentable.to_global_id))
153
+ assert(flash[:success].present?)
154
+ assert_includes(commentable.reload.subscribed_user_ids, current_user.id.to_s)
155
+ end
156
+
157
+ def test_unsubscribing_to_comments
158
+ commentable.update!(subscribed_user_ids: [current_user.id])
159
+ put admin.unsubscribe_commentable_comments_path(commentable.to_global_id)
160
+
161
+ assert_redirected_to(admin.commentable_comments_path(commentable.to_global_id))
162
+ assert(flash[:success].present?)
163
+ refute_includes(commentable.reload.subscribed_user_ids, current_user.id.to_s)
164
+ end
145
165
  end
146
166
  end
147
167
  end
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class ConfigurationsIntegrationTest < Workarea::IntegrationTest
6
+ include Admin::IntegrationTest
7
+
8
+ def test_update
9
+ patch admin.configuration_path,
10
+ params: {
11
+ 'configuration' => {
12
+ 'allow_shipping_address_po_box' => 'false'
13
+ }
14
+ }
15
+
16
+ assert_redirected_to(admin.configuration_path)
17
+ refute(Workarea.config.allow_shipping_address_po_box)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class CreateReleaseUndosIntegrationTest < Workarea::IntegrationTest
6
+ include Admin::IntegrationTest
7
+
8
+ def test_create
9
+ releasable = create_page(name: 'Foo')
10
+ release = create_release
11
+
12
+ release.as_current { releasable.update_attributes!(name: 'Bar') }
13
+
14
+ post admin.release_undo_path(release),
15
+ params: { release: { name: 'Undo Bar', tag_list: 'foo,bar,baz' } }
16
+
17
+ assert_equal(2, Release.count)
18
+ undo_release = Release.desc(:created_at).first
19
+
20
+ assert_equal(undo_release, release.reload.undo)
21
+ assert_equal('Undo Bar', undo_release.name)
22
+ assert_equal(%w(foo bar baz), undo_release.tags)
23
+ assert_equal(1, undo_release.changesets.size)
24
+ assert_equal(1, undo_release.changesets.first.changeset.size)
25
+ assert_equal(releasable, undo_release.changesets.first.releasable)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class CreateSegmentsIntegrationTest < Workarea::IntegrationTest
6
+ include Admin::IntegrationTest
7
+
8
+ def test_creates_segments
9
+ post admin.create_segments_path, params: { segment: { name: 'foo bar' } }
10
+
11
+ assert_equal(1, Segment.count)
12
+ assert_equal('foo bar', Segment.desc(:created_at).first.name)
13
+ end
14
+
15
+ def test_updates_segments
16
+ segment = create_segment(name: 'Custom Segment')
17
+
18
+ post admin.create_segments_path,
19
+ params: { id: segment.id, segment: { name: 'foo bar' } }
20
+
21
+ assert_equal(1, Segment.count)
22
+ assert_equal('foo bar', Segment.first.name)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -79,14 +79,6 @@ module Workarea
79
79
 
80
80
  file = create_tempfile(response.body, extension: file_type)
81
81
  assert(IO.read(file.path).present?)
82
- assert_equal(
83
- "#{MIME::Types.type_for(file_type).first.to_s}; charset=utf-8",
84
- response.headers['Content-Type']
85
- )
86
- assert_equal(
87
- %(attachment; filename="catalog product.#{file_type}"),
88
- response.headers['Content-Disposition']
89
- )
90
82
 
91
83
  assert_no_changes 'Catalog::Product.first' do
92
84
  post admin.data_file_imports_path,
@@ -156,6 +148,40 @@ module Workarea
156
148
 
157
149
  assert_equal(subject, email.subject)
158
150
  end
151
+
152
+ def test_importing_for_a_release
153
+ sample = create_product(name: 'Test Product')
154
+ sample.name = "Test Product Changed"
155
+ format = Workarea::DataFile::Csv.new
156
+ file = create_tempfile(format.serialize(sample), extension: 'csv')
157
+ release = create_release
158
+
159
+ post admin.data_file_imports_path,
160
+ params: {
161
+ return_to: admin.catalog_products_path,
162
+ publishing: release.id,
163
+ import: {
164
+ model_type: 'Workarea::Catalog::Product',
165
+ file: Rack::Test::UploadedFile.new(file.path)
166
+ }
167
+ }
168
+
169
+ assert_redirected_to(admin.catalog_products_path)
170
+
171
+ assert_equal(1, Catalog::Product.count)
172
+
173
+ sample.reload
174
+ assert_equal('Test Product', sample.name)
175
+
176
+ Release.with_current(release) do
177
+ assert_equal('Test Product Changed', sample.reload.name)
178
+ end
179
+
180
+ assert_equal(1, DataFile::Import.count)
181
+ import = DataFile::Import.first
182
+ assert(import.created_by_id.present?)
183
+ assert_equal(release.id.to_s, import.release_id)
184
+ end
159
185
  end
160
186
  end
161
187
  end
@@ -0,0 +1,55 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class FulfillmentSkusIntegrationTest < Workarea::IntegrationTest
6
+ include Admin::IntegrationTest
7
+
8
+ def test_create
9
+ post admin.fulfillment_skus_path,
10
+ params: {
11
+ sku: {
12
+ id: 'SKU1',
13
+ policy: 'ignore',
14
+ }
15
+ }
16
+
17
+ assert_equal(1, Fulfillment::Sku.count)
18
+ assert_redirected_to(admin.fulfillment_sku_path('SKU1'))
19
+
20
+ sku = Fulfillment::Sku.first
21
+ assert_equal('SKU1', sku.id)
22
+ assert_equal('ignore', sku.policy)
23
+ end
24
+
25
+ def test_update
26
+ sku = create_fulfillment_sku(id: 'SKU1')
27
+
28
+ patch admin.fulfillment_sku_path('SKU1'),
29
+ params: {
30
+ sku: {
31
+ policy: 'download',
32
+ file: Rack::Test::UploadedFile.new(product_image_file_path)
33
+ }
34
+ }
35
+
36
+ assert_equal(1, Fulfillment::Sku.count)
37
+
38
+ assert_redirected_to(admin.fulfillment_sku_path('SKU1'))
39
+
40
+ sku.reload
41
+ assert_equal('SKU1', sku.id)
42
+ assert_equal('download', sku.policy)
43
+ assert(sku.file_name.present?)
44
+ end
45
+
46
+ def test_destroy
47
+ sku = create_fulfillment_sku(id: 'SKU1')
48
+ delete admin.fulfillment_sku_path('SKU1')
49
+
50
+ assert_equal(0, Fulfillment::Sku.count)
51
+ assert_redirected_to(admin.fulfillment_skus_path)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,43 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class FulfillmentTokensIntegrationTest < Workarea::IntegrationTest
6
+ include Admin::IntegrationTest
7
+
8
+ def test_create
9
+ sku = create_fulfillment_sku(
10
+ id: 'SKU1',
11
+ policy: 'download',
12
+ file: product_image_file_path
13
+ )
14
+
15
+ post admin.fulfillment_sku_tokens_path(sku)
16
+
17
+ assert_equal(1, Fulfillment::Token.count)
18
+
19
+ token = Fulfillment::Token.first
20
+ assert_equal('SKU1', token.sku)
21
+
22
+ assert_redirected_to(
23
+ admin.fulfillment_sku_tokens_path(sku, new_token: token.id)
24
+ )
25
+ end
26
+
27
+ def test_update
28
+ sku = create_fulfillment_sku(id: 'SKU1')
29
+ token = Fulfillment::Token.create!(sku: sku.id)
30
+
31
+ patch admin.fulfillment_sku_token_path(sku, token),
32
+ params: { token: { enabled: '0' } }
33
+
34
+ assert_equal(1, Fulfillment::Token.count)
35
+
36
+ assert_redirected_to(admin.fulfillment_sku_tokens_path(sku))
37
+
38
+ token.reload
39
+ assert(token.disabled?)
40
+ end
41
+ end
42
+ end
43
+ end