Spree with deface - Use deface to replace contents of block

Spree with deface - Use deface to replace contents of block

By : user2953950
Date : November 21 2020, 07:31 AM
should help you out I have an erb block: , The error is because of content_for in -
code :
<!-- replace_contents "erb[silent]:contains('content_for :sidebar')" -->
<!-- replace_contents "erb[silent]:contains('if @product.sold?')" -->

Share : facebook icon twitter icon
Spree/Deface - Conditionally set an override

Spree/Deface - Conditionally set an override

By : Zakaria Loulid
Date : March 29 2020, 07:55 AM
wish of those help Is there a way to conditionally set a deface override, for example based on product? , Your best bet will be to conditionally use render_original like so:
code :
Deface::Override.new(:virtual_path => "products", 
                     :name => "example", 
                     :surround => "div#products",
                     :text => "<% if @product == 'x' %><%# do something %><% else %><%= render_original %><% end %>")
Spree: Replace a class attribute using Deface

Spree: Replace a class attribute using Deface

By : China a little boy
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I would like to replace class from "columns four" to "columns three" using Deface. , You were almost there:
code :
  :virtual_path       => 'spree/shared/_sidebar',
  :name               => 'grid',
  :set_attributes     => '.columns.four',
  :attributes         => {:class => 'columns three', :title => 'This is a link'})
  :virtual_path       => 'path/to/view',
  :name               => 'some name',
  :replace => %{[erb-loud]:contains(' !content_for?(:sidebar) ? "sixteen" : "twelve" ')},
  text: '<%= !content_for?(:sidebar) ? "thirteen" : "twelve" %>"'
Deface never find results for rake deface:get_result

Deface never find results for rake deface:get_result

By : user2282317
Date : March 29 2020, 07:55 AM
like below fixes the issue If you use zsh you will need to escape the square brackets or any other special characters like spaces with \, you can try something like
code :
bundle exec rake deface:get_result\['spree/checkout/registration'\]
bundle exec rake deface:test_selector\['spree/checkout/registration','h1'\]
Spree: Deface getting error NameError in Spree::Home#index

Spree: Deface getting error NameError in Spree::Home#index

By : geomat
Date : March 29 2020, 07:55 AM
Hope this helps one small quote issue for url <%= link_to small_image(product, itemprop: "image"), url, itemprop: "url" %> check this code :-
code :
Deface::Override.new(:virtual_path =>"spree/shared/_products",
                     :name => "change site",
                     :replace =>"#products",
                     :text => '

  paginated_products = @searcher.retrieve_products if params.key?(:keywords)
  paginated_products ||= products

<% content_for :head do %>
  <% if paginated_products.respond_to?(:num_pages) %>
    <%= rel_next_prev_link_tags paginated_products %>
  <% end %>
<% end %>

<div data-hook="products_search_results_heading">
  <% if products.empty? %>
    <div data-hook="products_search_results_heading_no_results_found">
      <%= Spree.t(:no_products_found) %>
  <% elsif params.key?(:keywords) %>
    <div data-hook="products_search_results_heading_results_found">
      <h6 class="search-results-title"><%= Spree.t(:search_results, keywords: h(params[:keywords])) %></h6>
  <% end %>

<% if products.any? %>
  <div id="products" class="row" data-hook>
    <% products.each do |product| %>
      <% url = spree.product_url(product, taxon_id: @taxon.try(:id)) %>
      <div id="product_<%= product.id %>" class="col-md-3 col-sm-6 product-list-item" data-hook="products_list_item" itemscope itemtype="https://schema.org/Product">
        <div class="panel panel-default">
          <% cache(@taxon.present? ? [I18n.locale, current_currency, @taxon, product] : [I18n.locale, current_currency, product]) do %>
            <div class="panel-body text-center product-body">
<%= link_to small_image(product, itemprop: "image"), url, itemprop: "url" %>
            <div class="panel-footer text-center">
              <span itemprop="offers" itemscope itemtype="https://schema.org/Offer">
                <span class="price selling lead" itemprop="price"><%= display_price(product) %></span>
          <% end %>
    <% end %>
    <% reset_cycle("classes") %>
<% end %>

<% if paginated_products.respond_to?(:num_pages) %>

<% end %>
Spree Deface, can select anything but a class

Spree Deface, can select anything but a class

By : Jhonatan Aldana
Date : March 29 2020, 07:55 AM
wish of those help Deface acts upon the actual .html.erb template, before it is rendered, not the generated output.
You need to ensure that the selector matches something that is directly in your template specified in your virtual path.
Related Posts Related Posts :
  • In Ruby on Rails, After send_file method delete the file from server
  • An error occurred while installing nokogiri (, and Bundler cannot continue
  • How to setup nested routing for a self referencing controller in Rails 4
  • middleman app it is possible to create a contact form?
  • How to refactor this piece of code
  • How can I know if a user has access to all or just some resources with Cancan?
  • How can I run a ruby class from rake file?
  • Send JSON data as post method from rails controller to a web service
  • How to test Controllers under different namespaces and why this test fails?
  • rspec expect condition OR condition
  • Page loads unnecessary queries Ruby On Rails
  • Why "bundle install" try to install outdated version of gems?
  • Rails - Customize model validation error messages but without a database
  • When to switch from cucumber to rspec in the BDD cycle for a login procedure
  • Multipart response for web service
  • How to hide Add new option in Rails Admin
  • Override CollectionProxy find method
  • Rails 4 simple_form has_many through check boxes not saving
  • ruby on rails authentication using devise gem
  • Rails iteration over arrays and hashes
  • Creating inline date_select dropdowns using simple_form and zurb foundation
  • NameError in SongsController#index uninitialized constant Song::FriendlyId
  • Rails how to improve if record exists?
  • omniauth custom request phase form
  • Rails 5 - Saving the absolute current url via a button to a cookie?
  • How can / should I override the `build` method for a my model?
  • Install Rails Failed on OSX 10.8.4
  • ruby on rails - undefined method valid?
  • Users Registration on POST
  • Rails application variables in carrierwave store_dir
  • How to customize simple_form for json nested hash
  • Couldn't find file 'jquery', Sprockets::FileNotFound in StaticPages#home error
  • How should I use the alias_method_chain for the build method?
  • how to create two custom registration forms in devise?
  • Rails 4 link_to Destroy not working in Getting Started tutorial
  • How does ruby on rails dynamically define `find_by_id`, `find_by_name` methods?
  • JBuilder dynamic keys for model attributes
  • `initialize': No such file or directory - getaddrinfo (Errno::ENOENT) when Rails new app
  • What is the Ruby equivalent of Node.js' socket.io?
  • Where rails store standard helpers?
  • how to check expected result matches any of give values in rspec?
  • Form submission to create multiple objects
  • Simple Twitter Login with Rails and Email confirmation
  • Where should helpful functions for my controller go in Rails?
  • Using session variable in the Model or the other way
  • Why can't I have ruby code and comments in Embedded Ruby?
  • Rails: How can I make an object available in all views?
  • Cannot enter simply form information into SQLite DB (Rails)
  • Rails - Retain form values on failed submission. Getting "First argument in form cannot contain nil or be empty&quo
  • How to handle STI and build related models automatically?
  • Suppress an error when saving a record in Rails
  • Rails AJAX reload the page. Why?
  • How to pass user attributes to action mailer
  • Custom Validator to Prevent an appointment from being scheduled too early in day?
  • Postgres Enable TCP/IP Connection
  • How do I avoid the circular argument reference warning in activesupport
  • Unable to push to heroku master because of rails/spring version error
  • deep nested routes in rails
  • Best approach to Users Profile Images in Rails App
  • RailsInstaller: Can I maintain the gem fold when re-installing a new version?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org