spree-contrib / spree_multi_vendor

Spree marketplace extension. Create your own marketplace on top of Spree Commerce
https://spreecommerce.org/marketplace-ecommerce/
BSD 3-Clause "New" or "Revised" License
142 stars 135 forks source link

Deface Overrides missing End #151

Closed kennybrowne closed 3 years ago

kennybrowne commented 4 years ago

After Installing I would get an error when trying to render Properties#index.

After digging into this I found the issue to be cause by the deface not including the appropriate <% end %> tags.

The change was to use surround instead of insert_after and adding <%= render_original %><% end %> to the text.

I resolved this by updating the deface overrides as described above: Original: https://github.com/spree-contrib/spree_multi_vendor/blob/9cdba236f59d3a20f26ccb1f5bf5e0adf6e008b0/app/overrides/spree/admin/properties/index.rb#L7-L12 Update:

Deface::Override.new(
    virtual_path: 'spree/admin/properties/index',
    name: 'check_first_vendor_name',
    surround: '.row:last-of-type',
    text: '<% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) && params[:vendor_name_not_null] %><%= render_original %><% end %>'
)

Original: https://github.com/spree-contrib/spree_multi_vendor/blob/9cdba236f59d3a20f26ccb1f5bf5e0adf6e008b0/app/overrides/spree/admin/properties/index.rb#L14-L19 Update:

Deface::Override.new(
    virtual_path: 'spree/admin/properties/index',
    name: 'check_second_vendor_name',
    surround: 'tr[data-hook="listing_properties_header"] th:nth-child(3)',
    text: '<% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) && params[:vendor_name_not_null] %><%= render_original %><% end %>'
)

Original: https://github.com/spree-contrib/spree_multi_vendor/blob/9cdba236f59d3a20f26ccb1f5bf5e0adf6e008b0/app/overrides/spree/admin/properties/index.rb#L21-L26 Update:

Deface::Override.new(
    virtual_path: 'spree/admin/properties/index',
    name: 'check_third_vendor_name',
    surround: 'tr[data-hook="listing_properties_row"] td:nth-child(3)',
    text: '<% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) && property.respond_to?(:vendor) %><%= render_original %><% end %>'
)
damianlegawiec commented 3 years ago

Fixed in 2.0