本文介绍了安装Bootstrap gem后,如何覆盖/更改Ruby on Rails Spree应用程序的布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过添加安装了spree_bootstrap gem的Spree Commerce应用程序

I have a Spree Commerce application with the spree_bootstrap gem installed by adding

gem 'spree_bootstrap', github: 'jdutil/spree_bootstrap'

到Gemfile.

现在在主页上,我所有熟悉的引导div都为<div class="container row"><ul id="main-nav-bar" class="inline">.

Now on the main page I have all the familiar bootstrap divs as <div class="container row"> and <ul id="main-nav-bar" class="inline">.

我是Rails的新手,我想通过添加自己的自定义导航栏和其他调整来更改布局母版页.不幸的是,application.html.rb几乎是一个空白页面,我认为那不是进行更改的页面.

I am new to Rails and I want to change the lay-out masterpage by adding my own custom navbar and other tweaks. Unfortunately application.html.rb is a virtually empty page and I don't think that is the one to make changes.

我的问题是:如何覆盖或更改标准div值?我没有本地文件.我听说过将Deface用作工具,但我不知道如何使用它.

My question is: how do I override or change the standard div values? I do not have the files locally. I've heard about using Deface as a tool, but I don't know how to use it.

我希望这里的人可以提供更多有关更改标准Bootstrap Spree应用程序的见识.

I hope someone here can provide some more insight on changing the standard bootstrap Spree application.

推荐答案

创建文件app/views/spree/layouts/spree_application.html.erb.复制并粘贴内容然后根据需要进行)

Create the file app/views/spree/layouts/spree_application.html.erb. Copy and paste this content then edit as you wish :)

重复其他可能要重新设置样式的Spree视图和局部视图.如果您想知道创建&所需的路径,某个视图或部分视图的内容,请查看其app/views/spree文件夹> GitHub存储库.

Repeat for any other Spree views and partials that you might want to restyle. If you'd like to know the paths you need to create & the content for a certain view or partial, check out the app/views/spree folder of their GitHub repo.

在看到任何更改之前,您可能需要重新启动服务器.

You might need to restart your server before seeing any changes.

这篇关于安装Bootstrap gem后,如何覆盖/更改Ruby on Rails Spree应用程序的布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 08:36