狂欢,Rails 3和主题

编程入门 行业动态 更新时间:2024-10-09 02:22:36
本文介绍了狂欢,Rails 3和主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

blog.endpoint/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.

推荐答案

  • 最适合我的解决方案是使用 rails g spree:extension site 创建自己的扩展名为 site,然后我的宝石路径,只是在另一个编辑器项目中打开了整个spree-core宝石,并复制到 app / views / layouts / spree_application.html.erb 。
  • 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没什么不同(我的在 daugpigiau.lt ),您可能只能使用挂钩并覆盖某些部分。我仍然知道钩子名称的唯一方法就是查看那些对我来说很有趣的狂欢核心宝石和模板。知道您感兴趣的钩子之后,您可以执行以下操作:

    If your html is not that different (mine is quite different at 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

    这些只是我自己的

  • 是的,您可以像其他任何一代一样撤消扩展生成部分需要运行 rails destroy spree:extension your_extension_name ,它将还原生成期间执行的所有操作
  • 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和主题

    本文发布于:2023-10-23 02:44:48,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1519513.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:主题   Rails

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!