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
@@ -13,7 +13,9 @@ module Workarea
13
13
 
14
14
  def create_the_release
15
15
  visit admin.releases_path
16
- click_link 'add_release'
16
+ within '.calendar__day--today' do
17
+ click_link t('workarea.admin.releases.calendar.add_new_release')
18
+ end
17
19
 
18
20
  fill_in 'release[name]', with: 'Foo Release'
19
21
  click_button 'save_setup'
@@ -21,19 +23,17 @@ module Workarea
21
23
 
22
24
  def make_page_change
23
25
  visit admin.content_page_path(@content_page)
24
- click_link 'Attributes'
26
+ click_link t('workarea.admin.cards.attributes.title')
25
27
  fill_in 'page[name]', with: 'Foo Bar'
26
28
  click_button 'save'
27
29
  end
28
30
 
29
- def test_search
31
+ def test_list_search
30
32
  create_release(name: 'Scheduled Release', publish_at: 1.week.from_now)
31
33
  create_release(name: 'Unscheduled Release')
32
34
  create_release(name: 'Published Release', published_at: 1.week.ago)
33
- create_release(name: 'Undone Release', published_at: 2.week.ago, undone_at: 1.day.ago)
34
- create_release(name: 'Scheduled Undo Release', published_at: 3.week.ago, undo_at: 1.day.from_now)
35
35
 
36
- visit admin.releases_path
36
+ visit admin.list_releases_path
37
37
 
38
38
  within '#release_search_form' do
39
39
  fill_in 'q', with: 'release'
@@ -43,19 +43,15 @@ module Workarea
43
43
  assert(page.has_content?('Scheduled Release'))
44
44
  assert(page.has_content?('Unscheduled Release'))
45
45
  assert(page.has_content?('Published Release'))
46
- assert(page.has_content?('Undone Release'))
47
- assert(page.has_content?('Scheduled Undo Release'))
48
46
 
49
47
  within '.browsing-controls' do
50
48
  click_button 'Publishing'
51
- click_link 'Published (3)'
49
+ click_link 'Published (1)'
52
50
  end
53
51
 
54
52
  refute(page.has_content?('Scheduled Release'))
55
53
  refute(page.has_content?('Unscheduled Release'))
56
54
  assert(page.has_content?('Published Release'))
57
- assert(page.has_content?('Undone Release'))
58
- assert(page.has_content?('Scheduled Undo Release'))
59
55
  end
60
56
 
61
57
  def test_saving_changes_for_a_release
@@ -67,7 +63,7 @@ module Workarea
67
63
  assert(page.has_content?('Foo Release'))
68
64
  assert(page.has_content?('Foo Bar'))
69
65
 
70
- select 'the live site', from: 'release_id'
66
+ select t('workarea.admin.releases.select.live_site'), from: 'release_id'
71
67
 
72
68
  wait_for_xhr
73
69
 
@@ -86,26 +82,25 @@ module Workarea
86
82
  make_page_change
87
83
 
88
84
  #
89
- # Set publishing
85
+ # Set Publishing, through Calendar
90
86
  #
91
87
  #
92
88
  visit admin.releases_path
93
- click_link 'Foo Release'
89
+ find('.calendar__release', text: 'Foo Release').click
94
90
 
95
- click_link 'Attributes'
96
- fill_in 'release_publish_at_date', with: (Time.current + 1.day).strftime('%Y-%m-%d')
97
- fill_in 'release_undo_at_date', with: (Time.current + 1.week).strftime('%Y-%m-%d')
91
+ click_link t('workarea.admin.cards.attributes.title')
92
+ fill_in 'release_publish_at_date', with: 1.day.from_now.strftime('%Y-%m-%d')
98
93
  click_button 'save_release'
99
94
  assert(page.has_content?('Success'))
100
95
 
101
96
  #
102
- # Delete
97
+ # Delete, through Releases List
103
98
  #
104
99
  #
105
- visit admin.releases_path
100
+ visit admin.list_releases_path
106
101
  click_link 'Foo Release'
107
102
 
108
- click_on 'Delete'
103
+ click_on t('workarea.admin.actions.delete')
109
104
  assert(page.has_current_path?(admin.releases_path))
110
105
  assert(page.has_content?('Success'))
111
106
  assert(page.has_no_content?('Foo Release'))
@@ -129,7 +124,7 @@ module Workarea
129
124
  end
130
125
 
131
126
  visit admin.release_path(Release.first)
132
- click_link 'Planned Changes'
127
+ click_link t('workarea.admin.releases.cards.planned_changes.planned')
133
128
  assert(page.has_content?('Test Page'))
134
129
  assert(page.has_content?('Foo Bar'))
135
130
  assert(page.has_content?('Test Product'))
@@ -142,14 +137,14 @@ module Workarea
142
137
  assert(page.has_content?('Test Product - SKU1'))
143
138
 
144
139
  visit admin.content_page_path(@content_page)
145
- click_link 'Timeline'
140
+ click_link t('workarea.admin.timeline.card.title')
146
141
 
147
142
  assert(page.has_content?('Test Page'))
148
143
  assert(page.has_content?('Foo Bar'))
149
144
 
150
- click_button 'Edit'
145
+ click_button t('workarea.admin.timeline.edit')
151
146
  assert_current_path(admin.content_page_path(@content_page))
152
- click_link 'Attributes'
147
+ click_link t('workarea.admin.cards.attributes.title')
153
148
  assert_equal('Foo Bar', find_field('page[name]').value)
154
149
  end
155
150
 
@@ -158,27 +153,18 @@ module Workarea
158
153
  make_page_change
159
154
 
160
155
  visit admin.releases_path
161
- click_link 'Foo Release'
156
+ find('.calendar__release', text: 'Foo Release').click
162
157
 
163
- click_button 'Publish Now'
158
+ click_button t('workarea.admin.releases.show.publish_now')
164
159
  assert(page.has_content?('Success'))
165
160
 
166
161
  visit admin.edit_content_page_path(@content_page)
167
162
  assert_equal('Foo Bar', find_field('page[name]').value)
168
-
169
- visit admin.releases_path
170
- click_link 'Foo Release'
171
-
172
- click_button 'Undo'
173
- assert(page.has_content?('Success'))
174
-
175
- visit admin.edit_content_page_path(@content_page)
176
- assert_equal('Test Page', find_field('page[name]').value)
177
163
  end
178
164
 
179
165
  def test_inline_release_creation
180
166
  visit admin.edit_content_page_path(@content_page)
181
- select 'a new release', from: 'release_id'
167
+ select t('workarea.admin.js.publish_with_release_menus.a_new_release'), from: 'release_id'
182
168
 
183
169
  within '#release_form' do
184
170
  fill_in 'release[name]', with: 'Foo Release'
@@ -206,7 +192,7 @@ module Workarea
206
192
 
207
193
  fill_in 'page[name]', with: 'Bar Page'
208
194
 
209
- select 'a new release', from: 'publishing'
195
+ select t('workarea.admin.js.publish_with_release_menus.a_new_release'), from: 'publishing'
210
196
  within '#release_form' do
211
197
  fill_in 'release[name]', with: 'Bar Release'
212
198
  click_button 'save_release'
@@ -227,6 +213,134 @@ module Workarea
227
213
 
228
214
  assert(page.has_content?('Foo Page'))
229
215
  end
216
+
217
+ def test_creating_a_release_undo
218
+ visit admin.edit_content_page_path(@content_page)
219
+ select t('workarea.admin.js.publish_with_release_menus.a_new_release'), from: 'release_id'
220
+
221
+ within '#release_form' do
222
+ fill_in 'release[name]', with: 'Foo Release'
223
+ click_button 'save_release'
224
+ end
225
+
226
+ wait_for_xhr
227
+ make_page_change
228
+
229
+ visit admin.list_releases_path
230
+ click_link 'Foo Release'
231
+ click_link t('workarea.admin.releases.cards.undo.title')
232
+
233
+ assert(page.has_content?(t('workarea.admin.releases.undo.undoing')))
234
+ click_link "#{t('workarea.admin.releases.undo.build_an_undo_now')} →"
235
+
236
+ fill_in 'release[name]', with: 'Foo Bar Undo'
237
+ click_button t('workarea.admin.create_release_undos.workflow.create_undo')
238
+ assert(page.has_content?('Test Page'))
239
+ assert(page.has_content?('Foo Bar'))
240
+
241
+ click_link "#{t('workarea.admin.create_release_undos.workflow.done')} →"
242
+ assert(page.has_content?('Foo Bar Undo'))
243
+
244
+ click_link t('workarea.admin.releases.cards.original.title')
245
+ assert(page.has_content?('Foo Release'))
246
+ assert(page.has_content?('Test Page'))
247
+ assert(page.has_content?('Foo Bar'))
248
+
249
+ within('.text.text--large', match: :first) { click_link 'Foo Release' }
250
+ assert(page.has_content?('Foo Release'))
251
+ assert(page.has_content?('Test Page'))
252
+ assert(page.has_content?('Foo Bar'))
253
+
254
+ click_link t('workarea.admin.releases.cards.undo.title')
255
+ assert(page.has_content?('Foo Bar Undo'))
256
+ assert(page.has_content?('Test Page'))
257
+ assert(page.has_content?('Foo Bar'))
258
+ end
259
+
260
+ def test_release_calendar
261
+ create_the_release
262
+ make_page_change
263
+
264
+ visit admin.releases_path
265
+ find('.calendar__release', text: 'Foo Release').click
266
+
267
+ click_button t('workarea.admin.releases.show.publish_now')
268
+ assert(page.has_content?('Success'))
269
+
270
+ visit admin.releases_path
271
+
272
+ assert(find('.calendar').has_content?('Foo Release'))
273
+
274
+ click_link t('workarea.admin.releases.calendar.next_week')
275
+ wait_for_xhr
276
+ assert(find('.calendar').has_content?('Foo Release'))
277
+
278
+ click_link t('workarea.admin.releases.calendar.next_week')
279
+ wait_for_xhr
280
+ refute(find('.calendar').has_content?('Foo Release'))
281
+
282
+ click_link t('workarea.admin.releases.calendar.previous_week')
283
+ wait_for_xhr
284
+ assert(find('.calendar').has_content?('Foo Release'))
285
+
286
+ click_link t('workarea.admin.releases.calendar.next_week')
287
+ wait_for_xhr
288
+ refute(find('.calendar').has_content?('Foo Release'))
289
+
290
+ click_button t('workarea.admin.releases.calendar.today')
291
+ wait_for_xhr
292
+ assert(find('.calendar').has_content?('Foo Release'))
293
+ end
294
+
295
+ def test_release_overflow
296
+ #
297
+ # Test maximum releases per day
298
+ #
299
+ #
300
+ current_time = Time.current
301
+
302
+ create_release(name: 'Release One', published_at: current_time)
303
+ create_release(name: 'Release Two', published_at: current_time)
304
+ create_release(name: 'Release Three', published_at: current_time)
305
+ create_release(name: 'Release Four', published_at: current_time)
306
+ create_release(name: 'Release Five', published_at: current_time)
307
+
308
+ visit admin.releases_path
309
+
310
+ assert(page.has_content?('Release One'))
311
+ assert(page.has_content?('Release Two'))
312
+ assert(page.has_content?('Release Three'))
313
+ assert(page.has_content?('Release Four'))
314
+ assert(page.has_content?('Release Five'))
315
+
316
+ #
317
+ # Test Overflow UI
318
+ #
319
+ #
320
+ create_release(name: 'Release Six', published_at: current_time)
321
+
322
+ visit admin.releases_path
323
+
324
+ refute(page.has_content?('Release Five'))
325
+ refute(page.has_content?('Release Six'))
326
+
327
+ assert(
328
+ page.has_content?(
329
+ t('workarea.admin.releases.calendar.plus_more_releases', count: 2)
330
+ )
331
+ )
332
+
333
+ find('.calendar__release[data-tooltip]').hover
334
+
335
+ within '.tooltipster-content' do
336
+ assert(page.has_content?('Release One'))
337
+ assert(page.has_content?('Release Two'))
338
+ assert(page.has_content?('Release Three'))
339
+ assert(page.has_content?('Release Four'))
340
+ assert(page.has_content?('Release Five'))
341
+ assert(page.has_content?('Release Six'))
342
+ end
343
+ end
230
344
  end
231
345
  end
232
346
  end
@@ -295,6 +295,27 @@ module Workarea
295
295
  assert(page.has_ordered_text?('Social', 'Search'))
296
296
  end
297
297
 
298
+ def test_sales_by_tender
299
+ Metrics::TenderByDay.inc(key: { tender: 'credit_card' }, orders: 1, revenue: 100)
300
+ Metrics::TenderByDay.inc(key: { tender: 'store_credit' }, orders: 2, revenue: 24)
301
+
302
+ visit admin.sales_by_tender_report_path
303
+ assert(page.has_content?('Credit Card'))
304
+ assert(page.has_content?('Store Credit'))
305
+ assert(page.has_content?('1'))
306
+ assert(page.has_content?('$100.00'))
307
+ assert(page.has_content?('2'))
308
+ assert(page.has_content?('$24.00'))
309
+
310
+ click_link t('workarea.admin.fields.revenue')
311
+ assert(page.has_content?("#{t('workarea.admin.fields.revenue')} ↓"))
312
+ assert(page.has_ordered_text?('Credit Card', 'Store Credit'))
313
+
314
+ click_link t('workarea.admin.fields.revenue')
315
+ assert(page.has_content?("#{t('workarea.admin.fields.revenue')} ↑"))
316
+ assert(page.has_ordered_text?('Store Credit', 'Credit Card'))
317
+ end
318
+
298
319
  def test_sales_over_time
299
320
  Metrics::SalesByDay.inc(
300
321
  at: Time.zone.local(2018, 11, 14),
@@ -450,6 +471,14 @@ module Workarea
450
471
  assert(page.has_content?('standard_low'))
451
472
  assert(page.has_content?('backordered_low'))
452
473
  end
474
+
475
+ def test_reports_chart
476
+ # Since we don't explicitly depend on Chart.js, but rather depend on
477
+ # ChartKick which depends on Chart.js, we want to make sure the library
478
+ # still works as we upgrade ChartKick.
479
+ visit admin.timeline_report_path
480
+ assert_match(/class=('|")chartjs-render-monitor/, page.body)
481
+ end
453
482
  end
454
483
  end
455
484
  end
@@ -0,0 +1,124 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class SegmentsSystemTest < SystemTest
6
+ include Admin::IntegrationTest
7
+
8
+ def test_creating_a_segment
9
+ visit admin.segments_path
10
+ click_link 'add_segment'
11
+
12
+ fill_in 'segment[name]', with: 'Big Spenders'
13
+ click_button 'save_setup'
14
+
15
+ assert(page.has_content?('Success'))
16
+ select t('workarea.admin.fields.revenue'), from: 'rule_type'
17
+ click_button 'add_rule'
18
+
19
+ fill_in 'rule[minimum]', with: '10000'
20
+ click_button 'save_rule'
21
+
22
+ assert(page.has_content?('Success'))
23
+ assert(page.has_content?('10,000'))
24
+
25
+ click_link "#{t('workarea.admin.create_segments.rules.complete')} →"
26
+ assert_current_path(admin.segment_path(Segment.first))
27
+
28
+ visit admin.segments_path
29
+ assert(page.has_content?('Big Spenders'))
30
+ end
31
+
32
+ def test_managing_segments
33
+ create_life_cycle_segments
34
+ visit admin.segments_path
35
+
36
+ click_link 'Loyal Customer'
37
+ click_link t('workarea.admin.segments.cards.attributes.header')
38
+
39
+ fill_in 'segment[tag_list]', with: 'life-cycle'
40
+ click_button 'save_segment'
41
+
42
+ assert(page.has_content?('Success'))
43
+ assert(page.has_content?('life-cycle'))
44
+
45
+ click_link t('workarea.admin.segments.cards.rules.header')
46
+ assert(page.has_content?(t('workarea.admin.segment_rules.index.no_edit')))
47
+ end
48
+
49
+ def test_managing_active_by_segment
50
+ one = create_segment(name: 'Foo')
51
+ two = create_segment(name: 'Bar')
52
+ three = create_segment(name: 'Baz')
53
+
54
+ category = create_category(active: false, active_segment_ids: [])
55
+ visit admin.edit_catalog_category_path(category)
56
+
57
+ within '.active-field' do
58
+ refute_content(t('workarea.admin.shared.active_field.by_segment', count: 0))
59
+ find('.toggle-button__label--negative').click
60
+ assert_content(t('workarea.admin.shared.active_field.by_segment', count: 0))
61
+ end
62
+
63
+ find('[data-active-by-segment-tooltip]').click
64
+ assert_content(t('workarea.admin.shared.active_field.active_by_segment'))
65
+
66
+ find('.select2-selection--multiple').click
67
+ find('.select2-results__option', text: 'Bar').click
68
+
69
+ execute_script("$('body').trigger('click')")
70
+ sleep(0.4) # Tooltipster's config of delay + animationDuration is 400ms
71
+
72
+ assert_content(t('workarea.admin.shared.active_field.by_segment', count: 1, name: 'Bar'))
73
+ click_button 'save_category'
74
+
75
+ assert_content('Success')
76
+ click_link 'Attributes'
77
+ assert_content(t('workarea.admin.shared.active_field.by_segment', count: 1, name: 'Bar'))
78
+ find('[data-active-by-segment-tooltip]').click
79
+
80
+ assert_selector('.select2-selection__choice', text: 'Bar')
81
+
82
+ find('.select2-selection--multiple').click
83
+ find('.select2-results__option', text: 'Baz').click
84
+
85
+ execute_script("$('body').trigger('click')")
86
+ sleep(0.4) # Tooltipster's config of delay + animationDuration is 400ms
87
+
88
+ assert_content(t('workarea.admin.shared.active_field.by_segment', count: 2, name: 'Bar', more_count: 1))
89
+ click_button 'save_category'
90
+
91
+ assert_content('Success')
92
+ click_link 'Attributes'
93
+ assert_content(t('workarea.admin.shared.active_field.by_segment', count: 1, name: 'Bar', more_count: 1))
94
+ find('[data-active-by-segment-tooltip]').click
95
+
96
+ assert_selector('.select2-selection__choice', text: 'Bar')
97
+ assert_selector('.select2-selection__choice', text: 'Baz')
98
+ end
99
+
100
+ def test_insights
101
+ segment = create_segment
102
+
103
+ Metrics::SegmentByDay.inc(
104
+ key: { segment_id: segment.id },
105
+ at: Time.zone.local(2018, 10, 27),
106
+ orders: 100,
107
+ revenue: 555.to_m
108
+ )
109
+
110
+ travel_to Time.zone.local(2018, 10, 30)
111
+
112
+ visit admin.segment_path(segment)
113
+ assert(page.has_content?('100'))
114
+ assert(page.has_content?('555'))
115
+ assert(page.has_content?('5.55'))
116
+
117
+ click_link t('workarea.admin.segments.cards.insights.header')
118
+ assert(page.has_content?('100'))
119
+ assert(page.has_content?('555'))
120
+ assert(page.has_content?('5.55'))
121
+ end
122
+ end
123
+ end
124
+ end
@@ -28,19 +28,11 @@ module Workarea
28
28
  assert(page.has_no_content?('Edited Tax Category'))
29
29
  end
30
30
 
31
- def test_viewing_existing_tax_rates
32
- create_tax_category(
31
+ def test_managing_tax_rates
32
+ category = create_tax_category(
33
33
  name: 'Test Category',
34
34
  code: '002',
35
- rates: [
36
- {
37
- percentage: 0.06,
38
- tier_min: 100.to_m,
39
- region: 'PA',
40
- country: 'US',
41
- postal_code: '19106'
42
- }
43
- ]
35
+ rates: []
44
36
  )
45
37
 
46
38
  visit admin.tax_categories_path
@@ -50,11 +42,169 @@ module Workarea
50
42
  click_link t('workarea.admin.tax_categories.cards.rates.title')
51
43
  end
52
44
 
53
- assert(page.has_content?('6.0%'))
54
- assert(page.has_content?("#{Money.default_currency.symbol}100.00"))
55
- assert(page.has_content?('PA'))
56
- assert(page.has_content?('US'))
57
- assert(page.has_content?('19106'))
45
+ assert(page.has_content?(t('workarea.admin.tax_rates.index.empty_message')))
46
+
47
+ #
48
+ # New rate
49
+ #
50
+ click_link t('workarea.admin.tax_rates.index.new_button')
51
+
52
+ fill_in 'rate[country]', with: 'US'
53
+ fill_in 'rate[region]', with: 'PA'
54
+ fill_in 'rate[postal_code]', with: '19106'
55
+
56
+ fill_in 'rate[country_percentage]', with: 2
57
+ fill_in 'rate[region_percentage]', with: 4
58
+ fill_in 'rate[postal_code_percentage]', with: 6
59
+
60
+ fill_in 'rate[tier_min]', with: 5
61
+ fill_in 'rate[tier_max]', with: 500
62
+
63
+ find('.toggle-button__label--positive').click
64
+
65
+ click_button t('workarea.admin.tax_rates.new.create_button')
66
+
67
+ assert(page.has_content?('Success'))
68
+
69
+ #
70
+ # Rates Index
71
+ #
72
+ within '.index-table__row' do
73
+ assert(page.has_content?('US'))
74
+ assert(page.has_content?('PA'))
75
+ assert(page.has_content?('19106'))
76
+
77
+ assert(page.has_content?('6.0%'))
78
+ assert(page.has_content?('4.0%'))
79
+ assert(page.has_content?('2.0%'))
80
+
81
+ assert(page.has_content?("#{Money.default_currency.symbol}5.00"))
82
+ assert(page.has_content?("#{Money.default_currency.symbol}500.00"))
83
+
84
+ assert(page.has_content?(t('workarea.admin.false')))
85
+ end
86
+
87
+ #
88
+ # Edit
89
+ #
90
+ within '.index-table__row' do
91
+ click_link t('workarea.admin.actions.edit')
92
+ end
93
+
94
+ fill_in 'rate[country_percentage]', with: 0
95
+ fill_in 'rate[region_percentage]', with: 10
96
+ fill_in 'rate[postal_code_percentage]', with: 20.5
97
+
98
+ click_button t('workarea.admin.tax_rates.edit.save_button')
99
+
100
+ assert(page.has_content?('Success'))
101
+
102
+ within '.index-table__row' do
103
+ assert(page.has_content?('10.0%'))
104
+ assert(page.has_content?('20.5%'))
105
+ end
106
+
107
+ #
108
+ # Delete
109
+ #
110
+ within '.index-table__row' do
111
+ click_link t('workarea.admin.actions.delete')
112
+ end
113
+
114
+ assert(page.has_content?('Success'))
115
+ assert_current_path(admin.tax_category_rates_path(category))
116
+ assert(page.has_content?(t('workarea.admin.tax_rates.index.empty_message')))
117
+ end
118
+
119
+ def test_sorting_rates
120
+ category = create_tax_category(
121
+ name: 'Test Category',
122
+ code: '003',
123
+ rates: [
124
+ { country: 'CA', region: 'Qux', postal_code: '10000' },
125
+ { country: 'US', region: 'Corge', postal_code: '20000' },
126
+ { country: 'AL', region: 'Grault', postal_code: '30000' }
127
+ ]
128
+ )
129
+
130
+ visit admin.tax_category_rates_path(category)
131
+
132
+ select(t('workarea.sorts.country', from: 'sort'))
133
+ assert(page.has_ordered_text?('AL', 'CA', 'US'))
134
+
135
+ select(t('workarea.sorts.region', from: 'sort'))
136
+ assert(page.has_ordered_text?('Corge', 'Grault', 'Qux'))
137
+
138
+ select(t('workarea.sorts.postal_code', from: 'sort'))
139
+ assert(page.has_ordered_text?('10000', '20000', '30000'))
140
+ end
141
+
142
+ def test_searching_rates
143
+ category = create_tax_category(
144
+ name: 'Test Category',
145
+ code: '004',
146
+ rates: [
147
+ { country: 'US', region: 'PA', postal_code: '19000' },
148
+ { country: 'US', region: 'NE Philly', postal_code: '19123' },
149
+ { country: 'RU', region: 'Siberia', postal_code: '00019' }
150
+ ]
151
+ )
152
+
153
+ visit admin.tax_category_rates_path(category)
154
+
155
+ within '.index-table' do
156
+ assert_match(/US.*PA.*19000/, page.text)
157
+ assert_match(/US.*NE Philly.*19123/, page.text)
158
+ assert_match(/RU.*Siberia.*00019/, page.text)
159
+ end
160
+
161
+ within '#rates_search_form' do
162
+ select(t('workarea.sorts.postal_code'), from: 'sort')
163
+ end
164
+
165
+ within '.index-table' do
166
+ assert(page.has_ordered_text?('Siberia', 'PA', 'NE Philly'))
167
+ end
168
+
169
+ within '#rates_search_form' do
170
+ fill_in 'search_rates', with: '19'
171
+ click_button 'search_rates'
172
+ end
173
+
174
+ within '.index-table' do
175
+ assert_match(/US.*PA.*19000/, page.text)
176
+ assert_match(/US.*NE Philly.*19123/, page.text)
177
+ refute_match(/RU.*Siberia.*00019/, page.text)
178
+ end
179
+
180
+ within '#rates_search_form' do
181
+ fill_in 'search_rates', with: 'NE P'
182
+ click_button 'search_rates'
183
+ end
184
+
185
+ within '.index-table' do
186
+ refute_match(/US.*PA.*19000/, page.text)
187
+ assert_match(/US.*NE Philly.*19123/, page.text)
188
+ refute_match(/RU.*Siberia.*00019/, page.text)
189
+ end
190
+
191
+ within '#rates_search_form' do
192
+ fill_in 'search_rates', with: 'ru'
193
+ click_button 'search_rates'
194
+ end
195
+
196
+ within '.index-table' do
197
+ refute_match(/US.*PA.*19000/, page.text)
198
+ refute_match(/US.*NE Philly.*19123/, page.text)
199
+ assert_match(/RU.*Siberia.*00019/, page.text)
200
+ end
201
+
202
+ within '#rates_search_form' do
203
+ fill_in 'search_rates', with: 'Foo'
204
+ click_button 'search_rates'
205
+ end
206
+
207
+ assert(page.has_content?(t('workarea.admin.tax_rates.index.empty_message')))
58
208
  end
59
209
  end
60
210
  end
@@ -136,6 +136,21 @@ module Workarea
136
136
  assert(page.has_content?('11'))
137
137
  assert(page.has_content?('55'))
138
138
  end
139
+
140
+ def test_user_locked
141
+ @user.update(
142
+ failed_login_count: Workarea.config.allowed_login_attempts + 1,
143
+ last_login_attempt_at: Time.current
144
+ )
145
+
146
+ visit admin.user_path(@user)
147
+ assert(page.has_content?(t('workarea.admin.users.show.locked')))
148
+
149
+ click_link t('workarea.admin.users.show.unlock')
150
+
151
+ assert(page.has_content?('Success'))
152
+ assert(page.has_no_content?(t('workarea.admin.users.show.locked')))
153
+ end
139
154
  end
140
155
  end
141
156
  end