狂欢,Rails 3和主题 [英] Spree, Rails 3, and theming

查看:79
本文介绍了狂欢,Rails 3和主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我一直在尝试按照本教程更改大礼包的默认主题

Well, I've been trying to change the default theme of spree by following this tutorial

http://blog.endpoint.com/2010/01/rails-ecommerce-spree-hooks-tutorial.html

但是首页完全没有改变,由于本教程是针对Rails 2的,我只是想知道我需要从教程使其与Rails 3兼容?

But the homepage doesn't change at all, well since the tutorial is meant for rails 2, I'm just wondering what do I need to change from the tutorial to make it work with rails 3?

比使用钩子更简单的解决方案受到欢迎。同样,在我使用它的同时,还有一种方法可以撤消您在rails中运行的命令,例如卸载扩展。

Simpler solution than using hooks is welcomed. Also while I'm at it, is there a way to undo the command you run in rails like maybe uninstalling an extension.

推荐答案


  1. 最适合我的解决方案是使用 rails g spree:extension site 创建自己的扩展名为 site,然后我的宝石路径,只是在另一个编辑器项目中打开了整个spree-core宝石,并复制到 app / views / layouts / spree_application.html.erb

  1. The solution that worked for me was to create my own extension say 'site' with rails g spree:extention site then I've look at my gems path and just opened the whole spree-core gem in another editor project and copied over the app/views/layouts/spree_application.html.erb.

如果您的html没什么不同(我的在 http://daugpigiau.lt ),您可能只能使用挂钩并覆盖某些部分。我仍然知道钩子名称的唯一方法就是查看那些对我来说很有趣的狂欢核心宝石和模板。知道您感兴趣的钩子之后,您可以执行以下操作:

If your html is not that different (mine is quite different at http://daugpigiau.lt) from default spree shop you might be able to only use hooks and override some of the parts. Still the only way I've found to know hook names was to look inside those spree core gems and templates that were interesting for me. After you know what hooks are of interest to you you can do something like:

class PigiauHooks < Spree::ThemeSupport::HookListener
  # custom hooks go here
  insert_after :admin_inside_head, 'shared/admin/ckeditor_include'
  insert_before :admin_product_form_meta, 'shared/admin/product_editor'
  insert_before :admin_product_form_additional_fields, 'shared/admin/unavailable_on'
end

这些只是我自己的


  1. 是的,您可以像其他任何一代一样撤消扩展生成部分需要运行 rails destroy spree:extension your_extension_name ,它将还原生成期间执行的所有操作

  1. Yes you can undo the extension generation part as any other generation you just need to run rails destroy spree:extension your_extension_name and it will revert all the operation that were performed during it's generation

起初我一直在努力处理最重要的部分,这是因为该文档上的空白太多,以至于第一次使用的用户都无法掌握。

I've strugled with the overriding part at first cause documentation on this one has a bit too much blank spaces for the first time user to grasp.

这篇关于狂欢,Rails 3和主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆