solidus_frontend 2.10.0.beta1 → 2.10.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.
Potentially problematic release.
This version of solidus_frontend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/spree/frontend/screen.css.scss +3 -3
- data/app/controllers/spree/checkout_controller.rb +4 -0
- data/app/controllers/spree/orders_controller.rb +6 -2
- data/lib/generators/solidus/views/override_generator.rb +3 -2
- data/lib/spree/frontend/middleware/seo_assist.rb +4 -4
- data/solidus_frontend.gemspec +1 -1
- data/spec/controllers/spree/orders_controller_spec.rb +25 -0
- data/spec/features/checkout_spec.rb +51 -0
- metadata +8 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cf4a33ae63ea7b75b77ef676f7e2faf8af4785b3206d7f91749f454de16690e2
         | 
| 4 | 
            +
              data.tar.gz: a67e00d14d14999acd5e4c6a89a050e4bff7a5086bad4f76fe345634d8a64cbe
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6474eb4097721563dd08ea496e8c05dea9300ebe54f5fe3e0f7c747c5880f07ce1f59585222e0bb74b1fe175d9ce09f7c5825faf3b89dd69699189d2fb2ca493
         | 
| 7 | 
            +
              data.tar.gz: c02d5826a5a8b24dec3f415b38d3ddc428e12e400ac13502218e230514ebefb1748053b8b4395b0ba5384edd021d0f1abf4a7130ca5ca1bfda1533fe37d07c5c
         | 
| @@ -963,8 +963,8 @@ p[data-hook="use_billing"] { | |
| 963 963 | 
             
              }
         | 
| 964 964 |  | 
| 965 965 | 
             
              input[type="text"] {
         | 
| 966 | 
            -
                flex:  | 
| 967 | 
            -
                width:  | 
| 966 | 
            +
                flex: 1 auto;
         | 
| 967 | 
            +
                width: 50%;
         | 
| 968 968 | 
             
                margin-right: 5px;
         | 
| 969 969 | 
             
              }
         | 
| 970 970 |  | 
| @@ -1268,7 +1268,7 @@ table.order-summary { | |
| 1268 1268 | 
             
            // # Logo
         | 
| 1269 1269 | 
             
            #logo {
         | 
| 1270 1270 | 
             
              padding: 20px 0;
         | 
| 1271 | 
            -
             | 
| 1271 | 
            +
             | 
| 1272 1272 | 
             
              > a {
         | 
| 1273 1273 | 
             
                display: inline-block;
         | 
| 1274 1274 | 
             
              }
         | 
| @@ -137,6 +137,10 @@ module Spree | |
| 137 137 | 
             
                  redirect_to(spree.cart_path) && return unless @order
         | 
| 138 138 | 
             
                end
         | 
| 139 139 |  | 
| 140 | 
            +
                # Allow the customer to only go back or stay on the current state
         | 
| 141 | 
            +
                # when trying to change it via params[:state]. It's not allowed to
         | 
| 142 | 
            +
                # jump forward and skip states (unless #skip_state_validation? is
         | 
| 143 | 
            +
                # truthy).
         | 
| 140 144 | 
             
                def set_state_if_present
         | 
| 141 145 | 
             
                  if params[:state]
         | 
| 142 146 | 
             
                    redirect_to checkout_state_path(@order.state) if @order.can_go_to_state?(params[:state]) && !skip_state_validation?
         | 
| @@ -42,6 +42,10 @@ module Spree | |
| 42 42 | 
             
                  @order = current_order || Spree::Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])
         | 
| 43 43 | 
             
                  authorize! :read, @order, cookies.signed[:guest_token]
         | 
| 44 44 | 
             
                  associate_user
         | 
| 45 | 
            +
                  if params[:id] && @order.number != params[:id]
         | 
| 46 | 
            +
                    flash[:error] = t('spree.cannot_edit_orders')
         | 
| 47 | 
            +
                    redirect_to cart_path
         | 
| 48 | 
            +
                  end
         | 
| 45 49 | 
             
                end
         | 
| 46 50 |  | 
| 47 51 | 
             
                # Adds a new item to the order (creating a new order if none already exists)
         | 
| @@ -59,8 +63,8 @@ module Spree | |
| 59 63 |  | 
| 60 64 | 
             
                  begin
         | 
| 61 65 | 
             
                    @line_item = @order.contents.add(variant, quantity)
         | 
| 62 | 
            -
                  rescue ActiveRecord::RecordInvalid =>  | 
| 63 | 
            -
                    @order.errors.add(:base,  | 
| 66 | 
            +
                  rescue ActiveRecord::RecordInvalid => error
         | 
| 67 | 
            +
                    @order.errors.add(:base, error.record.errors.full_messages.join(", "))
         | 
| 64 68 | 
             
                  end
         | 
| 65 69 |  | 
| 66 70 | 
             
                  respond_with(@order) do |format|
         | 
| @@ -24,6 +24,7 @@ module Solidus | |
| 24 24 | 
             
                  def copy_views
         | 
| 25 25 | 
             
                    views_to_copy.each do |file|
         | 
| 26 26 | 
             
                      next if File.directory?(file)
         | 
| 27 | 
            +
             | 
| 27 28 | 
             
                      dest_file = Pathname.new(file).relative_path_from(source_dir)
         | 
| 28 29 | 
             
                      copy_file file, Rails.root.join('app', 'views', 'spree', dest_file)
         | 
| 29 30 | 
             
                    end
         | 
| @@ -33,8 +34,8 @@ module Solidus | |
| 33 34 |  | 
| 34 35 | 
             
                  def views_to_copy
         | 
| 35 36 | 
             
                    if @options['only']
         | 
| 36 | 
            -
                      VIEWS.select do | | 
| 37 | 
            -
                        Pathname.new( | 
| 37 | 
            +
                      VIEWS.select do |view|
         | 
| 38 | 
            +
                        Pathname.new(view).relative_path_from(source_dir).to_s.include?(@options['only'])
         | 
| 38 39 | 
             
                      end
         | 
| 39 40 | 
             
                    else
         | 
| 40 41 | 
             
                      VIEWS
         | 
| @@ -38,11 +38,11 @@ module Spree | |
| 38 38 | 
             
                    end
         | 
| 39 39 |  | 
| 40 40 | 
             
                    def build_query(params)
         | 
| 41 | 
            -
                      params.map { | | 
| 42 | 
            -
                        if  | 
| 43 | 
            -
                          build_query( | 
| 41 | 
            +
                      params.map { |key, value|
         | 
| 42 | 
            +
                        if value.class == Array
         | 
| 43 | 
            +
                          build_query(value.map { |parameter| ["#{key}[]", parameter] })
         | 
| 44 44 | 
             
                        else
         | 
| 45 | 
            -
                           | 
| 45 | 
            +
                          key + "=" + Rack::Utils.escape(value)
         | 
| 46 46 | 
             
                        end
         | 
| 47 47 | 
             
                      }.join("&")
         | 
| 48 48 | 
             
                    end
         | 
    
        data/solidus_frontend.gemspec
    CHANGED
    
    
| @@ -102,6 +102,31 @@ describe Spree::OrdersController, type: :controller do | |
| 102 102 | 
             
                  end
         | 
| 103 103 | 
             
                end
         | 
| 104 104 |  | 
| 105 | 
            +
                context '#edit' do
         | 
| 106 | 
            +
                  before do
         | 
| 107 | 
            +
                    allow(controller).to receive :authorize!
         | 
| 108 | 
            +
                    allow(controller).to receive_messages current_order: order
         | 
| 109 | 
            +
                  end
         | 
| 110 | 
            +
             | 
| 111 | 
            +
                  it 'should render cart' do
         | 
| 112 | 
            +
                    get :edit, params: { id: order.number }
         | 
| 113 | 
            +
             | 
| 114 | 
            +
                    expect(flash[:error]).to be_nil
         | 
| 115 | 
            +
                    expect(response).to be_ok
         | 
| 116 | 
            +
                  end
         | 
| 117 | 
            +
             | 
| 118 | 
            +
                  context 'with another order number than the current_order' do
         | 
| 119 | 
            +
                    let(:other_order) { create(:completed_order_with_totals) }
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                    it 'should display error message' do
         | 
| 122 | 
            +
                      get :edit, params: { id: other_order.number }
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                      expect(flash[:error]).to eq "You may only edit your current shopping cart."
         | 
| 125 | 
            +
                      expect(response).to redirect_to cart_path
         | 
| 126 | 
            +
                    end
         | 
| 127 | 
            +
                  end
         | 
| 128 | 
            +
                end
         | 
| 129 | 
            +
             | 
| 105 130 | 
             
                context "#update" do
         | 
| 106 131 | 
             
                  context "with authorization" do
         | 
| 107 132 | 
             
                    before do
         | 
| @@ -672,6 +672,57 @@ describe "Checkout", type: :feature, inaccessible: true do | |
| 672 672 | 
             
                end
         | 
| 673 673 | 
             
              end
         | 
| 674 674 |  | 
| 675 | 
            +
              # Regression test for: https://github.com/solidusio/solidus/issues/2998
         | 
| 676 | 
            +
              context 'when two shipping categories are available' do
         | 
| 677 | 
            +
                let!(:first_category) { create(:shipping_category) }
         | 
| 678 | 
            +
                let!(:second_category) { create(:shipping_category) }
         | 
| 679 | 
            +
             | 
| 680 | 
            +
                let!(:first_shipping_method) do
         | 
| 681 | 
            +
                  create(:shipping_method,
         | 
| 682 | 
            +
                         shipping_categories: [first_category],
         | 
| 683 | 
            +
                         stores: [store])
         | 
| 684 | 
            +
                end
         | 
| 685 | 
            +
             | 
| 686 | 
            +
                let!(:second_shipping_method) do
         | 
| 687 | 
            +
                  create(:shipping_method,
         | 
| 688 | 
            +
                         shipping_categories: [second_category],
         | 
| 689 | 
            +
                         stores: [store])
         | 
| 690 | 
            +
                end
         | 
| 691 | 
            +
             | 
| 692 | 
            +
                context 'assigned to two different products' do
         | 
| 693 | 
            +
                  let!(:first_product) do
         | 
| 694 | 
            +
                    create(:product,
         | 
| 695 | 
            +
                           name: 'First product',
         | 
| 696 | 
            +
                           shipping_category: first_category)
         | 
| 697 | 
            +
                  end
         | 
| 698 | 
            +
             | 
| 699 | 
            +
                  let!(:second_product) do
         | 
| 700 | 
            +
                    create(:product,
         | 
| 701 | 
            +
                           name: 'Second product',
         | 
| 702 | 
            +
                           shipping_category: second_category)
         | 
| 703 | 
            +
                  end
         | 
| 704 | 
            +
             | 
| 705 | 
            +
                  before do
         | 
| 706 | 
            +
                    stock_location.stock_items.update_all(count_on_hand: 10)
         | 
| 707 | 
            +
                  end
         | 
| 708 | 
            +
             | 
| 709 | 
            +
                  it 'transitions successfully to the delivery step', js: true do
         | 
| 710 | 
            +
                    visit spree.product_path(first_product)
         | 
| 711 | 
            +
                    click_button 'add-to-cart-button'
         | 
| 712 | 
            +
                    visit spree.product_path(second_product)
         | 
| 713 | 
            +
                    click_button 'add-to-cart-button'
         | 
| 714 | 
            +
             | 
| 715 | 
            +
                    click_button 'Checkout'
         | 
| 716 | 
            +
             | 
| 717 | 
            +
                    fill_in_address
         | 
| 718 | 
            +
                    fill_in 'order_email', with: 'test@example.com'
         | 
| 719 | 
            +
                    click_button 'Save and Continue'
         | 
| 720 | 
            +
             | 
| 721 | 
            +
                    expect(Spree::Order.last.state).to eq('delivery')
         | 
| 722 | 
            +
                  end
         | 
| 723 | 
            +
                end
         | 
| 724 | 
            +
              end
         | 
| 725 | 
            +
             | 
| 675 726 | 
             
              def fill_in_credit_card(number: "4111 1111 1111 1111")
         | 
| 676 727 | 
             
                fill_in "Name on card", with: 'Mary Doe'
         | 
| 677 728 | 
             
                fill_in_with_force "Card Number", with: number
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: solidus_frontend
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.10.0 | 
| 4 | 
            +
              version: 2.10.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Solidus Team
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2020-01-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: solidus_api
         | 
| @@ -16,28 +16,28 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - '='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 2.10.0 | 
| 19 | 
            +
                    version: 2.10.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - '='
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 2.10.0 | 
| 26 | 
            +
                    version: 2.10.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: solidus_core
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - '='
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: 2.10.0 | 
| 33 | 
            +
                    version: 2.10.0
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - '='
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: 2.10.0 | 
| 40 | 
            +
                    version: 2.10.0
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: canonical-rails
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -339,7 +339,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 339 339 | 
             
              requirements:
         | 
| 340 340 | 
             
              - - ">="
         | 
| 341 341 | 
             
                - !ruby/object:Gem::Version
         | 
| 342 | 
            -
                  version: 2. | 
| 342 | 
            +
                  version: 2.4.0
         | 
| 343 343 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 344 344 | 
             
              requirements:
         | 
| 345 345 | 
             
              - - ">="
         | 
| @@ -347,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 347 347 | 
             
                  version: 1.8.23
         | 
| 348 348 | 
             
            requirements:
         | 
| 349 349 | 
             
            - none
         | 
| 350 | 
            -
            rubygems_version: 3.0. | 
| 350 | 
            +
            rubygems_version: 3.0.3
         | 
| 351 351 | 
             
            signing_key: 
         | 
| 352 352 | 
             
            specification_version: 4
         | 
| 353 353 | 
             
            summary: Cart and storefront for the Solidus e-commerce project.
         |