disco_app 0.8.9 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/disco_app/icons.svg +0 -0
  3. data/app/assets/javascripts/disco_app/components/{filterable_shop_list.js.jsx → custom/filterable_shop_list.js.jsx} +1 -1
  4. data/app/assets/javascripts/disco_app/components/custom/inline-radio-options.es6.jsx +59 -0
  5. data/app/assets/javascripts/disco_app/components/custom/rules-editor.es6.jsx +360 -0
  6. data/app/assets/javascripts/disco_app/components/{shop_list.js.jsx → custom/shop_list.js.jsx} +9 -11
  7. data/app/assets/javascripts/disco_app/components/custom/shop_row.js.jsx +43 -0
  8. data/app/assets/javascripts/disco_app/components/ui-kit/cards/card-section.es6.jsx +30 -0
  9. data/app/assets/javascripts/disco_app/components/ui-kit/cards/card.es6.jsx +9 -0
  10. data/app/assets/javascripts/disco_app/components/ui-kit/cards/cart-section-title.es6.jsx +7 -0
  11. data/app/assets/javascripts/disco_app/components/ui-kit/forms/base_form.es6.jsx +72 -0
  12. data/app/assets/javascripts/disco_app/components/ui-kit/forms/base_input.es6.jsx +20 -0
  13. data/app/assets/javascripts/disco_app/components/ui-kit/forms/button.es6.jsx +13 -0
  14. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-radio.es6.jsx +30 -0
  15. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-select.es6.jsx +39 -0
  16. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-text.es6.jsx +59 -0
  17. data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-textarea.es6.jsx +48 -0
  18. data/app/assets/javascripts/disco_app/components/ui-kit/icons/icon-chevron.es6.jsx +33 -0
  19. data/app/assets/javascripts/disco_app/components/ui-kit/icons/next-icon.es6.jsx +18 -0
  20. data/app/assets/javascripts/disco_app/components/ui-kit/input_select.es6.jsx +21 -0
  21. data/app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-annotated-section.es6.jsx +29 -0
  22. data/app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-empty-state.es6.jsx +35 -0
  23. data/app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-footer-help.es6.jsx +13 -0
  24. data/app/assets/javascripts/disco_app/components/ui-kit/ui-layout/ui-page-actions.es6.jsx +39 -0
  25. data/app/assets/javascripts/disco_app/components.js +1 -4
  26. data/app/assets/javascripts/disco_app/disco_app.js +3 -0
  27. data/app/assets/javascripts/disco_app/ui-kit.js +1 -0
  28. data/app/assets/stylesheets/disco_app/admin/_header.scss +66 -0
  29. data/app/assets/stylesheets/disco_app/admin/_layout.scss +40 -0
  30. data/app/assets/stylesheets/disco_app/admin/_nav.scss +172 -0
  31. data/app/assets/stylesheets/disco_app/admin.scss +11 -0
  32. data/app/assets/stylesheets/disco_app/disco_app.scss +12 -12
  33. data/app/assets/stylesheets/disco_app/{disco/mixins → mixins}/_flexbox.scss +6 -0
  34. data/app/assets/stylesheets/disco_app/ui-kit/_ui-empty-state.scss +94 -0
  35. data/app/assets/stylesheets/disco_app/ui-kit/_ui-footer-help.scss +25 -0
  36. data/app/assets/stylesheets/disco_app/ui-kit/_ui-icons.scss +28 -0
  37. data/app/assets/stylesheets/disco_app/ui-kit/_ui-kit.scss +5086 -0
  38. data/app/assets/stylesheets/disco_app/ui-kit/_ui-layout.scss +10 -0
  39. data/app/assets/stylesheets/disco_app/ui-kit/_ui-page-actions.scss +21 -0
  40. data/app/assets/stylesheets/disco_app/{disco/_tabs.scss → ui-kit/_ui-tabs.scss} +3 -1
  41. data/app/assets/stylesheets/disco_app/ui-kit/_ui-type.scss +13 -0
  42. data/app/controllers/disco_app/admin/concerns/plans_controller.rb +8 -5
  43. data/app/controllers/disco_app/admin/concerns/subscriptions_controller.rb +32 -0
  44. data/app/controllers/disco_app/admin/subscriptions_controller.rb +3 -0
  45. data/app/helpers/disco_app/application_helper.rb +22 -0
  46. data/app/models/disco_app/concerns/plan.rb +2 -2
  47. data/app/models/disco_app/concerns/shop.rb +0 -4
  48. data/app/models/disco_app/concerns/subscription.rb +12 -0
  49. data/app/resources/disco_app/admin/resources/concerns/shop_resource.rb +40 -3
  50. data/app/views/disco_app/admin/plans/_form.html.erb +18 -21
  51. data/app/views/disco_app/admin/plans/_plan_code_fields.html.erb +15 -0
  52. data/app/views/disco_app/admin/plans/index.html.erb +2 -0
  53. data/app/views/disco_app/admin/shops/index.html.erb +2 -1
  54. data/app/views/disco_app/admin/subscriptions/edit.html.erb +33 -0
  55. data/app/views/disco_app/shared/_icons.html.erb +3 -0
  56. data/app/views/layouts/admin/_nav_items.erb +20 -0
  57. data/app/views/layouts/admin.html.erb +53 -9
  58. data/app/views/layouts/embedded_app.html.erb +2 -0
  59. data/app/views/layouts/embedded_app_modal.html.erb +11 -0
  60. data/config/routes.rb +4 -2
  61. data/lib/disco_app/engine.rb +2 -1
  62. data/lib/disco_app/version.rb +1 -1
  63. data/lib/generators/disco_app/disco_app_generator.rb +35 -2
  64. data/lib/generators/disco_app/templates/assets/javascripts/components.js +3 -0
  65. data/lib/generators/disco_app/templates/config/database.yml.tt +20 -0
  66. data/lib/tasks/database.rake +8 -0
  67. data/test/controllers/disco_app/charges_controller_test.rb +9 -2
  68. data/test/fixtures/api/widget_store/charges/create_recurring_application_charge_request.json +1 -1
  69. data/test/fixtures/api/widget_store/charges/create_second_recurring_application_charge_request.json +1 -1
  70. data/test/fixtures/disco_app/subscriptions.yml +1 -0
  71. data/test/models/disco_app/subscription_test.rb +19 -0
  72. data/test/services/disco_app/charges_service_test.rb +9 -2
  73. data/test/test_helper.rb +3 -0
  74. metadata +80 -21
  75. data/app/assets/javascripts/disco_app/components/shop_row.js.jsx +0 -27
  76. data/app/assets/stylesheets/disco_app/bootstrap/_custom.scss +0 -54
  77. data/app/assets/stylesheets/disco_app/bootstrap/_variables.scss +0 -872
  78. data/app/assets/stylesheets/disco_app/disco/_buttons.scss +0 -31
  79. data/app/assets/stylesheets/disco_app/disco/_cards.scss +0 -52
  80. data/app/assets/stylesheets/disco_app/disco/_forms.scss +0 -23
  81. data/app/assets/stylesheets/disco_app/disco/_grid.scss +0 -58
  82. data/app/assets/stylesheets/disco_app/disco/_sections.scss +0 -61
  83. data/app/assets/stylesheets/disco_app/disco/_tables.scss +0 -57
  84. data/app/assets/stylesheets/disco_app/disco/_type.scss +0 -39
  85. data/app/views/layouts/admin/_navbar.html.erb +0 -25
  86. data/lib/generators/disco_app/adminify/adminify_generator.rb +0 -35
  87. data/lib/generators/disco_app/reactify/reactify_generator.rb +0 -45
  88. /data/app/assets/javascripts/disco_app/components/{shop_filter_tab.js.jsx → custom/shop_filter_tab.js.jsx} +0 -0
  89. /data/app/assets/javascripts/disco_app/components/{shop_filter_tabs.js.jsx → custom/shop_filter_tabs.js.jsx} +0 -0
  90. /data/app/assets/javascripts/disco_app/components/{shopify_admin_link.js.jsx → custom/shopify_admin_link.js.jsx} +0 -0
@@ -1,31 +0,0 @@
1
- //
2
- // Replicate the styles for Shopify Admin buttons.
3
- // --------------------------------------------------
4
-
5
- .btn {
6
- line-height: 1;
7
- padding: 8.5px 15px;
8
- }
9
-
10
- .btn-default {
11
- &:hover, &:focus, &:active, &.active {
12
- border-color: #d3dbe2;
13
- background-color: #f5f6f7;
14
- }
15
- }
16
-
17
- .btn-primary {
18
- &:hover, &:focus, &:active, &.active {
19
- border-color: #4293c2;
20
- background-color: #4293c2;
21
- }
22
- }
23
-
24
- .btn-disabled {
25
- &, &:hover, &:focus, &:active {
26
- cursor: default;
27
- background: #fafbfc;
28
- color: #c3cfd8;
29
- border: 1px solid #d3dbe2;
30
- }
31
- }
@@ -1,52 +0,0 @@
1
- //
2
- // Replicate the styles for Shopify Admin cards.
3
- // --------------------------------------------------
4
-
5
- .next-card {
6
- background-color: #ffffff;
7
- border-radius: 3px;
8
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
9
- overflow-x: auto;
10
- }
11
-
12
- .next-card ~ .next-card {
13
- margin-top: 20px;
14
- }
15
-
16
- .next-card__header {
17
- padding: 20px 20px 0;
18
-
19
- h1, h2, h3 {
20
- margin-bottom: 0;
21
- font-size: 18px;
22
- line-height: 1.2em;
23
- }
24
- }
25
-
26
- .next-card__footer {
27
- padding: 0 20px 20px;
28
- }
29
-
30
- .next-card__section {
31
- padding: 20px;
32
- }
33
-
34
- .next-card__section ~ .next-card__section {
35
- border-top: 1px solid #ebeef0;
36
- }
37
-
38
- .next-card__section--no-bottom-padding {
39
- padding-bottom: 0;
40
- }
41
-
42
- .next-card--aside,
43
- .next-card--disabled {
44
- background-color: #f5f6f7;
45
- }
46
-
47
- .next-card--disabled {
48
- .next-card__header,
49
- .next-card__section {
50
- color: #777777;
51
- }
52
- }
@@ -1,23 +0,0 @@
1
- //
2
- // Replicate the styles for Shopify Admin forms.
3
- // --------------------------------------------------
4
-
5
- .form-control {
6
- -webkit-box-shadow: none;
7
- box-shadow: none;
8
-
9
- font-size: 15px;
10
- line-height: 20px;
11
-
12
- &:focus {
13
- -webkit-box-shadow: none;
14
- box-shadow: none;
15
- }
16
- }
17
-
18
- .help-block {
19
- font-style: italic;
20
- font-size: 13px;
21
- color: #95a7b7;
22
- margin-top: 5px;
23
- }
@@ -1,58 +0,0 @@
1
- //
2
- // Replicate the styles for Shopify Admin grid.
3
- // --------------------------------------------------
4
-
5
- .next-grid {
6
- display: flex;
7
- width: calc(100% - 20px);
8
- margin: 0 auto;
9
- box-sizing: border-box;
10
- padding-top: 10px;
11
-
12
- &:last-of-type {
13
- padding-bottom: 10px;
14
- }
15
- }
16
-
17
- .next-grid--no-padding {
18
- width: 100%;
19
-
20
- &:first-of-type, &:last-of-type {
21
- padding: 0;
22
- }
23
-
24
- > .next-grid__cell {
25
- padding: 0;
26
- }
27
- }
28
-
29
- .next-grid--center-aligned, .next-grid--center-both {
30
- -webkit-box-pack: center;
31
- -webkit-justify-content: center;
32
- -ms-flex-pack: center;
33
- justify-content: center;
34
- }
35
-
36
- .next-grid--right-aligned {
37
- -webkit-box-pack: end;
38
- -webkit-justify-content: flex-end;
39
- -ms-flex-pack: end;
40
- justify-content: flex-end;
41
- }
42
-
43
- .next-grid__cell {
44
- @include flex(1, 1, 0%);
45
- padding: 10px;
46
- box-sizing: border-box;
47
- max-width: 100%;
48
- min-width: 0;
49
- }
50
-
51
- .next-grid__cell--third {
52
- @include flex(0, 0, 33.333%);
53
- max-width: 33.333%;
54
- }
55
-
56
- .next-grid__cell--no-flex {
57
- @include flex(0 0 auto);
58
- }
@@ -1,61 +0,0 @@
1
- //
2
- // Replicate the styles for Shopify Admin sections
3
- // and flexbox layout.
4
- // --------------------------------------------------
5
-
6
-
7
- //== Layout
8
- //
9
- //## Simple Flexbox layout utilities.
10
-
11
- .layout-content {
12
- display: flex;
13
- }
14
-
15
- .layout-content__sidebar {
16
- padding: 20px;
17
- @include flex(1, 1, 25%);
18
- max-width: 25%
19
- }
20
-
21
- .layout-content__main {
22
- padding: 20px;
23
- @include flex(1, 1, 0%);
24
- }
25
-
26
- .layout-content__first {
27
- padding-right: 0;
28
- }
29
-
30
-
31
- //== Section
32
- //
33
- //## Simple Flexbox layout utilities.
34
-
35
- //** Main section wrapper.
36
- .section {
37
- margin: 0;
38
- padding: 0;
39
- border-bottom: 1px solid #e6e6e6;
40
- }
41
-
42
- //** Section "summary" to the left of the section.
43
- .section-summary {
44
- padding: 20px 20px 20px 30px;
45
-
46
- h1, h2 {
47
- line-height: 1.325;
48
- margin-top: -4px;
49
- font-size: 18px;
50
- margin-bottom: 10px;
51
- }
52
-
53
- p {
54
- color: #798c9c;
55
- margin-bottom: 15px;
56
-
57
- &:last-child {
58
- margin-bottom: 0;
59
- }
60
- }
61
- }
@@ -1,57 +0,0 @@
1
- //
2
- // Replicate the styles for Shopify Admin tables.
3
- // --------------------------------------------------
4
-
5
- table {
6
- width: 100%;
7
- border-collapse: separate;
8
- border-spacing: 0;
9
-
10
- &.expanded td {
11
- padding-top: 8px;
12
- padding-bottom: 8px;
13
- }
14
- }
15
-
16
- th {
17
- font-weight: 400;
18
- text-align: left;
19
- color: #31373d;
20
- padding: 8px 10px;
21
- border-bottom: 1px solid #ebeef0;
22
-
23
- &.is-sortable {
24
- cursor: pointer;
25
-
26
- &:hover {
27
- background: #eff9fd;
28
- color: #479ccf;
29
- }
30
- }
31
- }
32
-
33
- td {
34
- border-bottom: 1px solid #ebeef0;
35
- padding: 6px 10px;
36
- background: transparent;
37
- }
38
-
39
- th, td {
40
- &.right-aligned {
41
- text-align: right;
42
- }
43
-
44
- &.center-aligned {
45
- text-align: center;
46
- }
47
- }
48
-
49
- tr:last-child > td {
50
- border-bottom: none;
51
- }
52
-
53
- .table-hover {
54
- tr:hover td {
55
- background: #eff9fd;
56
- }
57
- }
@@ -1,39 +0,0 @@
1
- //
2
- // Replicate the styles for Shopify Admin typography.
3
- // --------------------------------------------------
4
-
5
-
6
- //== Headings
7
- //
8
- //## Heading styles.
9
-
10
- h1, .h1,
11
- h2, .h2,
12
- h3, .h3,
13
- h4, .h4,
14
- h5, .h5,
15
- h6, .h6 {
16
- margin: 0 0 20px 0;
17
- }
18
-
19
- p {
20
- margin: 0;
21
- }
22
-
23
-
24
- //== Type
25
- //
26
- //## Type modifiers.
27
-
28
- .type--subdued {
29
- color: #798c9c;
30
- }
31
-
32
- a.type--subdued {
33
- color: inherit;
34
- text-decoration: underline;
35
-
36
- &:hover {
37
- color: #272c30;
38
- }
39
- }
@@ -1,25 +0,0 @@
1
- <nav class="navbar navbar-default navbar-static-top">
2
- <div class="container-fluid">
3
-
4
- <!-- Brand & Toggle -->
5
- <div class="navbar-header">
6
- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
7
- <span class="sr-only">Toggle navigation</span>
8
- <span class="icon-bar"></span>
9
- <span class="icon-bar"></span>
10
- <span class="icon-bar"></span>
11
- </button>
12
- <a class="navbar-brand" href="<%= admin_shops_path %>">Credible</a>
13
- </div>
14
-
15
- <!-- Collapsing Navigation Links -->
16
- <div class="collapse navbar-collapse">
17
- <ul class="nav navbar-nav">
18
- <%= active_link_to 'Shops', admin_shops_path, wrap_tag: :li %>
19
- <%= active_link_to 'Plans', admin_plans_path, wrap_tag: :li %>
20
- <%= active_link_to 'Settings', edit_admin_app_settings_path, wrap_tag: :li %>
21
- </ul>
22
- </div>
23
-
24
- </div>
25
- </nav>
@@ -1,35 +0,0 @@
1
- module DiscoApp
2
- module Generators
3
- class AdminifyGenerator < Rails::Generators::Base
4
-
5
- source_root File.expand_path('../templates', __FILE__)
6
-
7
- # Run disco_app:reactfy since the admin section needs react
8
- def reactify_install
9
- generate 'disco_app:reactify'
10
- end
11
-
12
- def configure_gems
13
- gem 'active_link_to', '~> 1.0.2'
14
- end
15
-
16
- def add_env_variables
17
- env_variables = <<-CONFIG.strip_heredoc
18
-
19
- ADMIN_APP_USERNAME=
20
- ADMIN_APP_PASSWORD=
21
- CONFIG
22
- append_to_file '.env', env_variables
23
- append_to_file '.env.local', env_variables
24
- end
25
-
26
- # Run bundle install to add our new gems before running tasks.
27
- def bundle_install
28
- Bundler.with_clean_env do
29
- run 'bundle install'
30
- end
31
- end
32
-
33
- end
34
- end
35
- end
@@ -1,45 +0,0 @@
1
- module DiscoApp
2
- module Generators
3
- class ReactifyGenerator < Rails::Generators::Base
4
-
5
- source_root File.expand_path('../templates', __FILE__)
6
-
7
- # Install the react-rails gem and run its setup.
8
- def install_gem
9
- # Add gem to Gemfile
10
- gem 'react-rails', '~> 1.6.0'
11
-
12
- # Install gem.
13
- Bundler.with_clean_env do
14
- run 'bundle install'
15
- end
16
-
17
- # Run the gem's generator.
18
- generate 'react:install'
19
- end
20
-
21
- # Set application configuration
22
- def configure_application
23
- application "config.react.variant = :development", env: :development
24
- application "# Use development variant of React in development.", env: :development
25
- application "config.react.variant = :production", env: :production
26
- application "# Use production variant of React in production.", env: :production
27
- end
28
-
29
- # Include the DiscoApp component library in the application.js manifest.
30
- def add_to_manifest
31
- inject_into_file manifest, "//= require disco_app/components\n", { before: "//= require components\n" }
32
- end
33
-
34
- private
35
-
36
- # This method of finding the application.js manifest taken from the
37
- # install generator in react-rails.
38
- # See https://github.com/reactjs/react-rails/blob/3f0af13fa755d6e95969c17728d0354c234f3a37/lib/generators/react/install_generator.rb#L53-L55
39
- def manifest
40
- Pathname.new(destination_root).join('app/assets/javascripts', 'application.js')
41
- end
42
-
43
- end
44
- end
45
- end