I'm currently working on a project which has ROR in backend, I need to add a noscript tag to every page in the system to show a banner to the user.
我目前正在开发一个在后端有ROR的项目,我需要在系统的每个页面添加一个noscript标签,以向用户显示一个横幅。
Does ROR provide an easy way to add a piece of html to every page?
ROR是否提供了向每个页面添加一段html的简单方法?
1 个解决方案
#1
3
Add it to the application layout file /app/views/layouts/application.html.erb
. That file gets loaded for every view unless you have disabled this layout or have used a different layout.
将其添加到应用程序布局文件/app/views/layouts/application.html.erb。除非您已禁用此布局或使用了不同的布局,否则将为每个视图加载该文件。
If you have multiple layouts then place the <noscript>...</noscript>
in a partial and render the partial in all the layouts.
如果您有多个布局,则将
#1
3
Add it to the application layout file /app/views/layouts/application.html.erb
. That file gets loaded for every view unless you have disabled this layout or have used a different layout.
将其添加到应用程序布局文件/app/views/layouts/application.html.erb。除非您已禁用此布局或使用了不同的布局,否则将为每个视图加载该文件。
If you have multiple layouts then place the <noscript>...</noscript>
in a partial and render the partial in all the layouts.
如果您有多个布局,则将