问题标签 [locomotivecms]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
985 浏览

ruby-on-rails - 如何设置基本的机车 CMS 插件

这个问题说了 1000 个单词,但我基本上想做的是构建一个 Locomotive CMS 插件,而我只停留在基础知识上。这不是一件好事。

我已按照此 gem 的说明进行操作,因为它是我能找到的唯一参考资料: https ://github.com/colibri-software/locomotive_plugins

我已添加locomotive_plugins到我的 gemfile 中。我制作了一个名为的文件locomotive_test_plugin.rb并将其放在我的lib文件夹中(我发现这是放置此文件的合乎逻辑的地方,因为它在 gem 说明中没有明确说明)。我确实将lib文件夹添加config.autoload_pathsapplication.rb. 我有点希望它会起作用

locomotive_test_plugin.rb 看起来像

事实证明它没有。我还定制了一个gem名为locomotive_test_plugin并安装了 gem 并将该 gem 添加到 Gemfile 中,例如:

根据 gem,我现在可以在 CMS 中编辑任何页面并添加以下液体代码:

我希望输出是“测试”,但它什么也没显示。它也不会显示任何错误,例如“找不到插件”或类似的东西。

如果有人建议,我已经重新启动了本地服务器。

但是在这个过程中我哪里出错了 - 任何人都可以在这个问题上启发我。

0 投票
2 回答
591 浏览

html - 机车cms液体模板逻辑问题

我正在尝试实现以下结果:

我有一个 carousel_images 模型,它有_many“标签”。我只想在满足条件的轮播中显示图像。我尝试了很多不同的方法,最接近的方法是使用下面的代码,但是,它显示了每个标签的图像,而不是每个标签只有 1 个。

我意识到这与内部 for 循环检查标签内显示的实际图像有关,但我真的不知道如何在该循环之外进行检查并使图像只显示一次。

我也不是 100% 确定如何正确设置“活动”类,因为它嵌套在辅助附加循环中。

提前致谢!

编辑----这是工作代码:

我认为无休止的应用程序重启也可能有助于工作。

0 投票
1 回答
1536 浏览

ruby-on-rails - Locomotive CMS with Rails - location for liquid templates

I'm new to both Ruby on Rails and Locomotive CMS, but I'm just starting to create my first site with them.

I've got the engine running in a full Rails app (I'm going to need to deploy it on our own server later on). But it's just spitting out the 'Template' content defined through the admin interface, without any other template/content around it.

admin screen

enter image description here

I can 'fix' it by shoving the html for the whole page in through this input field. But that's not right, surely? The Getting Started guide talks of putting the templates in the filesystem, at something like: Pages/index/first page. "All pages are inherited from index". I have an index.liquid under views/pages but it's not picking that up... (I've tried a couple of other locations too).

I'm sure this is a dumb question, but please could someone tell me where to put my template in the file system? Or how to point Locomotive to pick it up from the right place?

(I did get the file system liquid template working by defining it through the Rails way, with a route, a controller and adding a liquid template initializer I found here. But then it's missing the variables that should come from the CMS content).

I'm loading the site using bundle exec unicorn_rails. And I'm using Rails v3.2.13, Ruby v1.9.3 and Locomotive_cms v2.2.2.

Thanks!

0 投票
1 回答
121 浏览

ruby-on-rails - LocomotiveCMS 中的多选字段?

我需要在 LocomotiveCMS 中设置一个类似于 Select 但允许多项选择的字段。像 HTML 中的东西...... LocomotiveCMS 是否允许这样做,还是我必须做一些 ruby​​ 编码才能让它工作?

任何帮助将不胜感激,谢谢!

0 投票
1 回答
208 浏览

locomotivecms - LocomotiveCMS 2.2.3 问题资产未加载 https

我在 heroku 上托管了一个 locomotiveCMS 引擎。我刚刚将引擎升级到 2.2.3 一切正常,除了现在所有资产都无法加载。查看源代码后,我看到所有资产(如 css、js 等)都通过“https”引用到我的 s3 存储桶,因此无法正常工作。

我正在使用像“{{”main“| stylesheet_tag}}”这样的液体标签,不知道为什么它们会解析为“https”

谢谢尼克

0 投票
1 回答
426 浏览

ruby-on-rails - Locomotive Liquid::SyntaxError at / Tag '{%' 没有被正则表达式正确终止:/\%\}/

我将 HAML 与 Locomotive CMS 的液体模板一起使用。最近,我收到以下错误:

我正在使用块标记li通过从子模板文件覆盖它来向 a 添加类。仅供参考,我正在使用包含在 Locomotive 的 Liquid 前叉中的 Liquid Inheritance。

0 投票
1 回答
815 浏览

ruby-on-rails - Locomotivecms 生产中的资产

我已经在 locomotivecms 谷歌群组中问过这个问题,但还没有得到任何有用的回复。所以,在这里尝试一下。我觉得这个问题不仅仅是一个轨道问题,而是与 locomotivecms 引擎的实现方式有关。

我按照此处的说明安装了 locomotivecms 应用程序 - http://doc.locomotivecms.com/guides/get-started/install-engine

该应用程序在开发模式下运行良好。

然后我预编译了这些资产并在生产模式下启动它(bundle exec unicorn_rails -E production)。现在,当我在浏览器中打开应用程序时,不会呈现样式表。我已经检查了公共/资产,并且浏览器请求的指纹样式表存在于那里。然而它没有正确呈现。这是 chrome 视图资源显示的内容:

在此处输入图像描述

样式表看起来好像包含 html。如果我从 public/assets 文件夹打开它,它包含 css。我认为机车正在拦截请求并且以某种方式不返回 css。Locomotive 是开源的,他们的代码在 github - https://github.com/locomotivecms/engine上。

0 投票
1 回答
139 浏览

ruby-on-rails - 如何查看在 locomotivecms 中创建的页面

我在 locomotivecms 中的 app/views/pages 文件夹下创建了一个页面,并将其命名为 page2.liquid.haml,它包含以下代码。

我可以查看索引页面,但我不确定如何在浏览器中查看 page2 我尝试的所有操作都会导致 404。

有任何想法吗?

0 投票
1 回答
458 浏览

ruby-on-rails - LocomotiveCMS - Wagon 找不到 content_type_template

不能使用事件 content_type_template。重复官方教程(http://doc.locomotivecms.com/guides/content-types/create),并出现错误:找不到页面。请帮忙,我正在尝试解决这个问题 3 小时呢!

/app/content_types/events.yml

/app/views/pages/events/content_type_template.liquid *是手动创建的!*

/app/views/pages/index.liquid

0 投票
1 回答
571 浏览

locomotivecms - 在机车 CMS 中使用 `with_scope`

###我有一个关于with_scope在机车 CMS 中使用的问题。

首先,我有一个具有完整字段的模型,其中movies一个名为film_etatstype: belongs_to

我有另一个模型,film_etats,其中我有一个etat字段是 of type: string,另一个字段moviestype: has_many

这没问题 - 我可以看到我的数据 - 但我想做的是过滤信息。

在机车 CMS 文档中,我发现: https ://doc.locomotivecms.com/docs/tags#with_scope

这里是第一个例子。

所以我这样做了:

但它不起作用,我想要的只是一个类型错误:nil 的未定义方法“条目”:NilClass

我的模特电影

我的模特电影_etats

谢谢