1

我正在使用 Spree 1.3.0,我已经安装了 spree_products_tags 用于向产品添加标签,

srikanth@srikanth-laptop:~/projects/mystore$ rake spree_products_tags:install:migrations
rake aborted!
uninitialized constant Spree::ThemeSupport
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/bundler/gems/spree_products_tags-b90636c337ff/lib/spree_products_tags_hooks.rb:1:in `<top (required)>'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/bundler/gems/spree_products_tags-b90636c337ff/lib/spree_products_tags.rb:2:in `<top (required)>'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
/home/srikanth/projects/mystore/config/application.rb:7:in `<top (required)>'
/home/srikanth/projects/mystore/Rakefile:5:in `require'
/home/srikanth/projects/mystore/Rakefile:5:in `<top (required)>'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `eval'
/home/srikanth/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)

我检查了 spree_products_tags 的代码,

class SpreeProductsTagsHooks < Spree::ThemeSupport::HookListener
  insert_after :admin_configurations_menu do
    "<%= configurations_menu_item(I18n.t('product_tags'), admin_product_tags_path, I18n.t('product_tags_desc')) %>"
  end

  insert_after :admin_configurations_sidebar_menu do
    %(<li<%== ' class="active"' if controller.controller_name == 'product_tags' %>><%= link_to t('product_tags'), admin_product_tags_path %></li>)
  end

  insert_after :admin_product_form_right, "admin/products/tag_fields"

  insert_after :products_list_item, "products/tag"
end

一个。如何摆脱Spree::ThemeSupport并执行上述操作?
湾。是否有任何其他替代方法可以为狂欢添加标签?

4

1 回答 1

2

一个。问题是他们实际上确实摆脱了 ThemeSupport (我认为在 1.1 或 1.2 中),您需要使用Deface,问题是您使用的 gem 还没有升级到那个,您需要替换它SpreeProductsTagsHooks并且使用污损

编辑,这是我不久前更改的一个,由于某种原因,我在底部留下了旧的 ThemeSupport 注释,这对这个https://github.com/romul/spree_user_groups/blob/ec2a169d96acf6cbcf731d24d518134e55598d29/app/overrides/add_user_groups_to_configuration_menu非常有用.rb

于 2013-01-02T23:57:24.193 回答