solidify 0.0.1.alpha

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 (165) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +40 -0
  5. data/.travis.yml +10 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +3 -0
  8. data/Guardfile +51 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +75 -0
  11. data/Rakefile +42 -0
  12. data/app/controllers/concerns/solidify/liquid.rb +26 -0
  13. data/app/controllers/solidify/addresses_controller.rb +15 -0
  14. data/app/controllers/solidify/carts_controller.rb +15 -0
  15. data/app/controllers/solidify/collections_controller.rb +26 -0
  16. data/app/controllers/solidify/customers_controller.rb +16 -0
  17. data/app/controllers/solidify/home_controller.rb +15 -0
  18. data/app/controllers/solidify/liquid_controller.rb +25 -0
  19. data/app/controllers/solidify/orders_controller.rb +19 -0
  20. data/app/controllers/solidify/pages_controller.rb +22 -0
  21. data/app/controllers/solidify/products_controller.rb +34 -0
  22. data/app/controllers/solidify/registrations_controller.rb +25 -0
  23. data/app/controllers/solidify/responders/solidify/liquid_responder.rb +29 -0
  24. data/app/controllers/solidify/search_controller.rb +41 -0
  25. data/app/controllers/solidify/sessions_controller.rb +15 -0
  26. data/app/drops/rails_settings/scoped_settings_drop.rb +11 -0
  27. data/app/drops/solidify/errors_drop.rb +14 -0
  28. data/app/drops/solidify/link_drop.rb +15 -0
  29. data/app/drops/solidify/link_list_drop.rb +7 -0
  30. data/app/drops/solidify/nil_drop.rb +7 -0
  31. data/app/drops/solidify/page_drop.rb +7 -0
  32. data/app/drops/solidify/search_drop.rb +7 -0
  33. data/app/drops/spree/address_drop.rb +28 -0
  34. data/app/drops/spree/image_drop.rb +32 -0
  35. data/app/drops/spree/line_item_drop.rb +98 -0
  36. data/app/drops/spree/option_type_drop.rb +4 -0
  37. data/app/drops/spree/order_drop.rb +64 -0
  38. data/app/drops/spree/product_drop.rb +97 -0
  39. data/app/drops/spree/taxon_drop.rb +53 -0
  40. data/app/drops/spree/user_drop.rb +54 -0
  41. data/app/drops/spree/variant_drop.rb +111 -0
  42. data/app/fields/spree/address_fields.rb +18 -0
  43. data/app/fields/spree/image_fields.rb +12 -0
  44. data/app/fields/spree/line_item_fields.rb +21 -0
  45. data/app/fields/spree/order_fields.rb +22 -0
  46. data/app/fields/spree/product_fields.rb +22 -0
  47. data/app/fields/spree/taxon_fields.rb +18 -0
  48. data/app/fields/spree/user_fields.rb +14 -0
  49. data/app/fields/spree/variant_fields.rb +19 -0
  50. data/app/filters/solidify/additional_filters.rb +22 -0
  51. data/app/filters/solidify/html_filters.rb +16 -0
  52. data/app/filters/solidify/money_filters.rb +39 -0
  53. data/app/filters/solidify/string_filters.rb +47 -0
  54. data/app/filters/solidify/url_filters.rb +59 -0
  55. data/app/helpers/solidify/liquid_helper.rb +111 -0
  56. data/app/helpers/solidify/shop_helper.rb +7 -0
  57. data/app/models/concerns/solidify/address.rb +15 -0
  58. data/app/models/concerns/solidify/full_name.rb +11 -0
  59. data/app/models/concerns/solidify/handle.rb +25 -0
  60. data/app/models/concerns/solidify/inventory_policy.rb +7 -0
  61. data/app/models/concerns/solidify/validation_cancel.rb +33 -0
  62. data/app/models/concerns/spree/order_state.rb +19 -0
  63. data/app/models/solidify/asset.rb +12 -0
  64. data/app/models/solidify/link.rb +10 -0
  65. data/app/models/solidify/link_list.rb +7 -0
  66. data/app/models/solidify/page.rb +5 -0
  67. data/app/models/solidify/setting.rb +8 -0
  68. data/app/models/solidify/theme.rb +19 -0
  69. data/app/models/spree/address_decorator.rb +13 -0
  70. data/app/models/spree/image_decorator.rb +7 -0
  71. data/app/models/spree/line_item_decorator.rb +7 -0
  72. data/app/models/spree/order_decorator.rb +10 -0
  73. data/app/models/spree/product_decorator.rb +8 -0
  74. data/app/models/spree/taxon_decorator.rb +20 -0
  75. data/app/models/spree/user_decorator.rb +9 -0
  76. data/app/models/spree/variant_decorator.rb +11 -0
  77. data/app/poro/solidify/search.rb +14 -0
  78. data/app/services/solidify/app_specific_string_io.rb +15 -0
  79. data/app/services/solidify/asset_compiler.rb +11 -0
  80. data/app/services/solidify/asset_postprocessor.rb +53 -0
  81. data/app/services/solidify/collections_all_builder.rb +12 -0
  82. data/app/services/solidify/link_list_seeder.rb +26 -0
  83. data/app/services/solidify/liquid_asset_compiler.rb +19 -0
  84. data/app/services/solidify/scss_asset_compiler.rb +15 -0
  85. data/app/services/solidify/shop_settings_seeder.rb +26 -0
  86. data/app/services/solidify/theme_mechanic.rb +30 -0
  87. data/app/uploaders/solidify/asset_uploader.rb +10 -0
  88. data/app/views/solidify/global/content_for_header.html.erb +0 -0
  89. data/app/views/solidify/themes/skeleton-theme/README.md +54 -0
  90. data/app/views/solidify/themes/skeleton-theme/assets/arrow-down.svg.liquid +3 -0
  91. data/app/views/solidify/themes/skeleton-theme/assets/cart.svg.liquid +4 -0
  92. data/app/views/solidify/themes/skeleton-theme/assets/shop.js.liquid +75 -0
  93. data/app/views/solidify/themes/skeleton-theme/assets/shopify_common.js +14 -0
  94. data/app/views/solidify/themes/skeleton-theme/assets/style.scss.liquid +768 -0
  95. data/app/views/solidify/themes/skeleton-theme/config/settings.html +217 -0
  96. data/app/views/solidify/themes/skeleton-theme/config/settings_data.json +26 -0
  97. data/app/views/solidify/themes/skeleton-theme/layout/theme.liquid +181 -0
  98. data/app/views/solidify/themes/skeleton-theme/snippets/article-grid-item.liquid +73 -0
  99. data/app/views/solidify/themes/skeleton-theme/snippets/collection-grid-item.liquid +46 -0
  100. data/app/views/solidify/themes/skeleton-theme/snippets/collection-listing.liquid +46 -0
  101. data/app/views/solidify/themes/skeleton-theme/snippets/open-graph-tags.liquid +35 -0
  102. data/app/views/solidify/themes/skeleton-theme/snippets/product-grid-item.liquid +70 -0
  103. data/app/views/solidify/themes/skeleton-theme/snippets/site-nav.liquid +57 -0
  104. data/app/views/solidify/themes/skeleton-theme/snippets/social-links.liquid +42 -0
  105. data/app/views/solidify/themes/skeleton-theme/snippets/twitter-card.liquid +41 -0
  106. data/app/views/solidify/themes/skeleton-theme/templates/404.liquid +2 -0
  107. data/app/views/solidify/themes/skeleton-theme/templates/article.liquid +160 -0
  108. data/app/views/solidify/themes/skeleton-theme/templates/blog.grid.liquid +30 -0
  109. data/app/views/solidify/themes/skeleton-theme/templates/blog.liquid +92 -0
  110. data/app/views/solidify/themes/skeleton-theme/templates/cart.liquid +123 -0
  111. data/app/views/solidify/themes/skeleton-theme/templates/collection.liquid +102 -0
  112. data/app/views/solidify/themes/skeleton-theme/templates/customers/account.liquid +57 -0
  113. data/app/views/solidify/themes/skeleton-theme/templates/customers/activate_account.liquid +26 -0
  114. data/app/views/solidify/themes/skeleton-theme/templates/customers/addresses.liquid +173 -0
  115. data/app/views/solidify/themes/skeleton-theme/templates/customers/login.liquid +90 -0
  116. data/app/views/solidify/themes/skeleton-theme/templates/customers/order.liquid +103 -0
  117. data/app/views/solidify/themes/skeleton-theme/templates/customers/register.liquid +32 -0
  118. data/app/views/solidify/themes/skeleton-theme/templates/customers/reset_password.liquid +27 -0
  119. data/app/views/solidify/themes/skeleton-theme/templates/index.liquid +39 -0
  120. data/app/views/solidify/themes/skeleton-theme/templates/list-collections.liquid +19 -0
  121. data/app/views/solidify/themes/skeleton-theme/templates/page.liquid +16 -0
  122. data/app/views/solidify/themes/skeleton-theme/templates/product.liquid +202 -0
  123. data/app/views/solidify/themes/skeleton-theme/templates/search.liquid +72 -0
  124. data/bin/rails +12 -0
  125. data/config/app.yml +0 -0
  126. data/config/initializers/carrierwave.rb +25 -0
  127. data/config/initializers/devise.rb +286 -0
  128. data/config/initializers/form_tag.rb +43 -0
  129. data/config/initializers/liquid.rb +213 -0
  130. data/config/initializers/sass.rb +15 -0
  131. data/config/initializers/spree.rb +7 -0
  132. data/config/initializers/theme_settings.rb +29 -0
  133. data/config/routes.rb +52 -0
  134. data/config/spring.rb +2 -0
  135. data/db/migrate/20170223064316_create_solidify_assets.solidify.rb +14 -0
  136. data/db/migrate/20170223064317_create_solidify_themes.solidify.rb +10 -0
  137. data/db/migrate/20170223064318_create_solidify_link_lists.solidify.rb +12 -0
  138. data/db/migrate/20170223064319_create_solidify_links.solidify.rb +13 -0
  139. data/db/migrate/20170223064320_create_solidify_settings.solidify.rb +22 -0
  140. data/db/migrate/20170223064321_create_solidify_pages.solidify.rb +16 -0
  141. data/db/migrate/20170223064322_add_attributes_to_spree_users.solidify.rb +7 -0
  142. data/db/migrate/20170223064323_add_handle_to_spree_taxons.solidify.rb +7 -0
  143. data/db/migrate/20170228115149_add_state_and_country_fields_to_spree_addresses.solidify.rb +7 -0
  144. data/lib/generators/solidify/install/install_generator.rb +23 -0
  145. data/lib/solidify.rb +11 -0
  146. data/lib/solidify/configuration.rb +21 -0
  147. data/lib/solidify/engine.rb +24 -0
  148. data/lib/solidify/testing_support/factories.rb +5 -0
  149. data/lib/solidify/testing_support/factories/assets.rb +75 -0
  150. data/lib/solidify/testing_support/factories/solidify_pages.rb +10 -0
  151. data/lib/solidify/testing_support/factories/spree_addresses.rb +9 -0
  152. data/lib/solidify/testing_support/factories/spree_line_items.rb +10 -0
  153. data/lib/solidify/testing_support/factories/spree_orders.rb +9 -0
  154. data/lib/solidify/testing_support/factories/spree_products.rb +8 -0
  155. data/lib/solidify/testing_support/factories/spree_taxons.rb +7 -0
  156. data/lib/solidify/testing_support/factories/spree_variants.rb +7 -0
  157. data/lib/solidify/testing_support/factories/themes.rb +7 -0
  158. data/lib/solidify/version.rb +3 -0
  159. data/lib/tasks/download_theme.rake +18 -0
  160. data/lib/tasks/seed_default_theme.rake +8 -0
  161. data/lib/tasks/seed_everything.rake +12 -0
  162. data/lib/tasks/seed_link_list.rake +8 -0
  163. data/lib/tasks/seed_shop_settings.rake +8 -0
  164. data/solidify.gemspec +61 -0
  165. metadata +668 -0
@@ -0,0 +1,4 @@
1
+ module Spree
2
+ class OptionTypeDrop < ::Liquid::Rails::Drop
3
+ end
4
+ end
@@ -0,0 +1,64 @@
1
+ module Spree
2
+ class OrderDrop < ::Liquid::Rails::Drop
3
+ attributes(*OrderFields::JSON)
4
+
5
+ delegate :billing_address, :shipping_address, :created_at, to: :order
6
+
7
+ delegate :number, to: :order, prefix: true
8
+ alias name order_number
9
+
10
+ def cancelled
11
+ order.canceled?
12
+ end
13
+
14
+ def cancelled_at
15
+ order.canceled_at
16
+ end
17
+
18
+ def customer_url
19
+ "#{view.request.base_url}#{view.customer_order_path(order.number)}"
20
+ end
21
+
22
+ delegate :email, to: :order
23
+
24
+ delegate :item_count, to: :order
25
+
26
+ delegate :line_items, to: :order
27
+ alias items line_items
28
+
29
+ def note
30
+ order.special_instructions
31
+ end
32
+
33
+ def requires_shipping
34
+ true
35
+ end
36
+
37
+ def subtotal_price
38
+ order.item_total - order.adjustment_total
39
+ end
40
+
41
+ def total_discount
42
+ 0
43
+ end
44
+
45
+ def total_price
46
+ order.total.to_money.cents
47
+ end
48
+ alias original_total_price total_price
49
+
50
+ def total_weight
51
+ 0
52
+ end
53
+
54
+ private
55
+
56
+ def order
57
+ @object
58
+ end
59
+
60
+ def view
61
+ @context.registers[:view]
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,97 @@
1
+ module Spree
2
+ class ProductDrop < ::Liquid::Rails::Drop
3
+ attributes(*ProductFields::JSON)
4
+
5
+ has_many :images
6
+
7
+ def available
8
+ !@object.deleted? && @object.variants_including_master.any?(&:available)
9
+ end
10
+
11
+ def collections
12
+ @object.taxons
13
+ end
14
+
15
+ def compare_at_price
16
+ nil
17
+ end
18
+
19
+ def compare_at_price_max
20
+ 0
21
+ end
22
+
23
+ def compare_at_price_min
24
+ 0
25
+ end
26
+
27
+ def compare_at_price_varies
28
+ false
29
+ end
30
+
31
+ alias content description
32
+
33
+ def first_available_variant
34
+ @object.variants.find(&:available) || @object.master
35
+ end
36
+
37
+ def featured_image
38
+ # display_image just shows first image
39
+ # probably producing many queries on the db
40
+ @object.display_image
41
+ end
42
+
43
+ def options
44
+ @object.option_types.map(&:presentation)
45
+ end
46
+
47
+ def price
48
+ @object.price.to_money.cents
49
+ end
50
+
51
+ alias price_max price
52
+ alias price_min price
53
+
54
+ def price_varies
55
+ false
56
+ end
57
+
58
+ def selected_variant
59
+ @object.selected_variant
60
+ end
61
+
62
+ def selected_or_first_available_variant
63
+ selected_variant || first_available_variant
64
+ end
65
+
66
+ def tags
67
+ []
68
+ end
69
+
70
+ def type
71
+ ''
72
+ end
73
+
74
+ def url
75
+ @object.url
76
+ end
77
+
78
+ def variants
79
+ if @object.variants.any?
80
+ @object.variants
81
+ else
82
+ [@object.master]
83
+ end
84
+ end
85
+
86
+ def vendor
87
+ Solidify::Setting['name']
88
+ end
89
+
90
+ # def metafields
91
+ # ::RailsSettings::ScopedSettingsDrop.new(@object.settings)
92
+ # end
93
+
94
+ # shopify json returns datetime in shop's timezone
95
+ alias published_at created_at
96
+ end
97
+ end
@@ -0,0 +1,53 @@
1
+ module Spree
2
+ class TaxonDrop < ::Liquid::Rails::Drop
3
+ attributes(*TaxonFields::JSON)
4
+
5
+ has_many :products
6
+
7
+ def all_products_count
8
+ @object.products.size
9
+ end
10
+
11
+ def all_tags
12
+ []
13
+ end
14
+
15
+ def description
16
+ @object.description
17
+ end
18
+
19
+ alias body_html description
20
+
21
+ def image
22
+ @object.image
23
+ end
24
+
25
+ def products_count
26
+ @object.products.size
27
+ end
28
+
29
+ def published_at
30
+ @object.created_at
31
+ end
32
+
33
+ def published_scope
34
+ 'global'
35
+ end
36
+
37
+ def sort_order
38
+ 'alpha-asc'
39
+ end
40
+
41
+ def template_suffix
42
+ ''
43
+ end
44
+
45
+ def updated_at
46
+ @object.updated_at
47
+ end
48
+
49
+ def url
50
+ @object.url
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,54 @@
1
+ module Spree
2
+ class UserDrop < ::Liquid::Rails::Drop
3
+ include ::Solidify::FullName
4
+
5
+ attributes :id, :default_address, :email, :first_name, :last_name, :name,
6
+ :password
7
+
8
+ has_many :addresses
9
+
10
+ def accepts_marketing
11
+ false
12
+ end
13
+
14
+ def addresses_count
15
+ @object.addresses.size
16
+ end
17
+
18
+ def errors
19
+ Solidify::ErrorsDrop.new(@object.errors)
20
+ end
21
+
22
+ # rubocop:disable Style/PredicateName
23
+ def has_account
24
+ true
25
+ end
26
+ # rubocop:enable Style/PredicateName
27
+
28
+ def last_order
29
+ @object.orders.complete.by_completed_at.last
30
+ end
31
+
32
+ def orders
33
+ @object.orders.complete
34
+ end
35
+
36
+ def orders_count
37
+ @object.orders.complete.size
38
+ end
39
+
40
+ def password_needed
41
+ true
42
+ end
43
+
44
+ def tags; end
45
+
46
+ def total_spent
47
+ 0
48
+ end
49
+
50
+ def to_json(_json)
51
+ { "error": 'json not allowed for this object' }.to_json
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,111 @@
1
+ module Spree
2
+ class VariantDrop < ::Liquid::Rails::Drop
3
+ attributes(*VariantFields::JSON)
4
+
5
+ # For a variant to be available, its variant.inventory_quantity must be
6
+ # greater than zero or variant.inventory_policy must be set to continue. A
7
+ # variant with no variant.inventory_management is also considered available.
8
+ def available
9
+ # inventory_management.blank? ||
10
+ # inventory_policy == INVENTORY_POLICY_ALLOW ||
11
+ # inventory_quantity(??? check VariantDrop) > 0
12
+ # call Variant.available, because ProductDrop calls Variant.available
13
+ # both should always call the same method
14
+ # (either in Variant or in VariantDrop)
15
+ @object.available
16
+ end
17
+
18
+ def barcode
19
+ ''
20
+ end
21
+
22
+ def compare_at_price
23
+ nil
24
+ end
25
+
26
+ def featured_image
27
+ @object.images.first
28
+ end
29
+
30
+ alias image featured_image
31
+
32
+ def incoming
33
+ false
34
+ end
35
+
36
+ def inventory_management
37
+ 'shopify'
38
+ end
39
+
40
+ def inventory_policy
41
+ Solidify::InventoryPolicy::INVENTORY_POLICY_DENY
42
+ end
43
+
44
+ def inventory_quantity
45
+ @object.total_on_hand
46
+ end
47
+
48
+ def name
49
+ "#{@object.name} - #{title}"
50
+ end
51
+
52
+ def next_incoming_date
53
+ nil
54
+ end
55
+
56
+ def option1
57
+ @object.option_values.first.try(:presentation)
58
+ end
59
+
60
+ def option2
61
+ @object.option_values.second.try(:presentation)
62
+ end
63
+
64
+ def option3
65
+ @object.option_values.third.try(:presentation)
66
+ end
67
+
68
+ def options
69
+ @object.option_values.map(&:presentation)
70
+ end
71
+
72
+ def price
73
+ @object.price.to_money.cents
74
+ end
75
+
76
+ def requires_shipping
77
+ true
78
+ end
79
+
80
+ def selected
81
+ @object.product.selected_variant == @object
82
+ end
83
+
84
+ def taxable
85
+ true
86
+ end
87
+
88
+ def title
89
+ @object.option_values.map(&:presentation).join(' / ')
90
+ end
91
+
92
+ alias public_title title
93
+
94
+ def url
95
+ Solidify::Engine.routes.url_helpers
96
+ .variant_path(@object.product, @object)
97
+ end
98
+
99
+ def weight
100
+ @object.weight.to_i
101
+ end
102
+
103
+ def weight_in_unit
104
+ @object.weight.to_i
105
+ end
106
+
107
+ def weight_unit
108
+ 'kg'
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,18 @@
1
+ module Spree
2
+ class AddressFields
3
+ JSON = %w(
4
+ id address1 address2 city company country country_code country_name
5
+ default first_name last_name name phone province province_code zip
6
+ ).freeze
7
+
8
+ METHODS = %w(
9
+ id address1 address2 city company country country_code default first_name
10
+ last_name latitude longitude name phone province province_code street zip
11
+ ).freeze
12
+
13
+ PARAMS = %w(
14
+ id address1 address2 city company country default first_name last_name
15
+ phone province zip
16
+ ).freeze
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ module Spree
2
+ class ImageFields
3
+ JSON = nil
4
+
5
+ METHODS = %w(
6
+ id alt attached_to_variant? product_id position src variants
7
+ ).freeze
8
+
9
+ PARAMS = %w(
10
+ ).freeze
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ module Spree
2
+ class LineItemFields
3
+ JSON = %w(
4
+ id discounted_price discounts gift_card grams handle image key line_price
5
+ original_line_price original_price price product_description product_id
6
+ product_title product_type properties quantity requires_shipping sku title
7
+ total_discount url variant_id variant_options variant_title vendor
8
+ ).freeze
9
+
10
+ METHODS = %w(
11
+ id discounts fulfillment fulfillment_service gift_card grams image key
12
+ line_price message original_line_price original_price price product
13
+ product_id properties quantity requires_shipping sku
14
+ successfully_fulfilled_quantity taxable title total_discount url variant
15
+ variant_id vendor
16
+ ).freeze
17
+
18
+ PARAMS = %w(
19
+ ).freeze
20
+ end
21
+ end