Tag: twitter bootstrap

安装bootstrap gem后,Pages#welcome中的NoMethodError

安装bootstrap gem并再次运行rails server后,我收到此错误: NoMethodError in Pages#welcome undefined method `environment’ for nil:NilClass (in /Users/neilpatel/Desktop/Rails/prospects/app/assets/stylesheets/custom.css.scss) custom.css.scss @import “bootstrap”; 应用程序/视图/布局/ application.html.erb Prospects true %> true %> 日志/ development.log Processing by PagesController#welcome as HTML Rendered pages/welcome.html.erb within layouts/application (0.1ms) Completed 500 Internal Server Error in 15ms ActionView::Template::Error (undefined method `environment’ for nil:NilClass (in /Users/neilpatel/Desktop/Rails/prospects/app/assets/stylesheets/custom.css.scss)): 4: 5: Prospects 6: 7: […]

Rails 5请求运行时间超过5000毫秒

我很难过。 我在docker中运行了一个可以安装Rails 5的vanilla但我经常遇到这个错误: Request ran for longer than 5000ms 到目前为止我所做的就是生成一个带有docker-compose run website rails g controller pages的新控制器。 到目前为止,如果我从layouts/application.html.erb删除(非常重要)行,我可以加载页面: 但是我放弃了所有我的默认样式(bootstrap)以及我希望在以后生活中加载的任何潜在的javascript文件,我不认为这是一个修复。 其他人遇到这个问题并知道如何解决它?

如何使用Modals显示不同的post

我是RoR的新手,我最近遇到了一个问题,因为我试图以不同的模态显示不同的post。 为了上下文化,我有一个主页,每个post都会显示。 每个post都包含作者,内容,类似按钮和评论按钮。 我希望评论按钮打开一个模式,再次包含作者的姓名,内容和评论post的区域。 问题是我点击的每个模态包含相同的作者和相同的内容,即使我点击的评论按钮来自不同的post。 准确地说,模态中显示的内容来自最近发布的post。 告诉我你是否需要特别的东西,我很乐意用你要问我的代码编辑这篇文章。 显示post: Submitted ago Like Comment 这是我的模态: × Write your comment: Like Comment 这是我的JS脚本: $(document).ready(function(){ $(‘[data-toggle=”popover”]’).popover(); $(‘[data-toggle=”popover”]’).popover({ html : true}); }); $(‘#popover’).popover({ html : true, title: function() { return $(“#popover-head”).html(); }, content: function() { return $(“#popover-content”).html(); } });

找不到文件’twitter / bootstrap’(ROR)

这是链接https://github.com/Gtar69/games 我遇到了问题 我已完成采购如下 在Gemfile中: gem “bootstrap-sass” 在终端 bundle install 在app/assets/stylesheets/application.css *= require bootstrap 但是本地服务器仍然无法显示bootstrap形成,因为它说找不到bootstrap … 谢谢你的帮助〜

Rails 4 jQuery与javascript冲突

我试图在Rails 4中制作应用程序。 我正在挣扎。 我正在尝试合并一个bootstrap主题,我遇到了供应商javascripts和其余代码的问题。 我认为问题可能与在我的application.js中使用jQuery然后使用以’$’符号开头的供应商.js文件有关: $.circleProgress = { 我刚看过这个: https : //learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/ 我的问题是虽然我不知道如何进行使代码安全的更改。 我是否需要搜索供应商文件中的每个’$’,或者我如何在jQuery上安装一个安全的包装器 – 特别是在通过gem合并的地方。 有没有人遇到过这些问题并找到了解决方案? 我会喜欢一些帮助。 的application.js //= require jquery //= require bootstrap-sprockets //= require jquery_ujs //= require html.sortable //= require disqus_rails //= require moment //= require bootstrap-datetimepicker //= require pickers //= require main //= require hammer.min //= require jquery.animate-enhanced.min //= require jquery.countTo […]

bootstrap-datepicker-rails将默认世纪视图设置为20世纪

我正在使用bootstrap-datepicker-rails gem并使用以下代码在我的rails应用程序中显示日期选择器: 以下是用户点击日期选择器时显示的内容: 可以看出:通过设置data: {date_start_view: ‘decades’}选项data: {date_start_view: ‘decades’} :日期选择器默认为21世纪(2000年至2100年)。 我希望它默认为20世纪,因为这个日期选择器是为了生日。 我确实查看了bootstrap-datepicker文档,但我不清楚如何设置此行为。

在轨道上的ruby中的Bootstrap模态不起作用

我正在尝试实现一个模式来为我的应用创建一个新用户。 由于某种原因,一个不能使它工作。 这段代码只是淡入淡出,没有模态出现,我无法弄清楚原因。 事实上,我正在使用与此答案完全相同的代码如何使用link_to添加bootstrap模式,以便链接内容以模态打开? “btn”, “data-toggle” => “modal” %> × Modal header One fine body… Close Save changes 我的gem: gem ‘rails’, ‘5.0.2’ # Use mysql as the database for Active Record gem ‘mysql2’, ‘>= 0.3.18’, ‘< 0.5' gem 'faker', '1.6.6' gem 'will_paginate', '3.1.0' gem 'bootstrap-will_paginate', '0.0.10' gem 'bcrypt', '3.1.11' gem 'bootstrap-sass', '3.3.6' gem 'puma', '3.4.0' […]

Bootstrap-sass gem Javascript无法在Rails中工作4

当使用bootstrap-sass gem我已正确加载我的css文件时,但是当我尝试加载javascript文件时收到错误。 我已经按照从https://github.com/twbs/bootstrap-sass加载javascript的过程但是当我在localhost上查看我的网页时 我收到错误“找不到文件’bootstrap’” 这是我的application.js文件的样子 – 任何帮助将不胜感激! 的application.js // This is a manifest file that’ll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // […]

在安装Bootstrap gem之后如何覆盖/更改Ruby on Rails狂欢应用程序的布局?

我有一个Spree Commerce应用程序,通过添加spree_bootstrap gem安装 gem ‘spree_bootstrap’, github: ‘jdutil/spree_bootstrap’ 到Gemfile。 现在在主页面上我将所有熟悉的bootstrap div作为 和 。 我是Rails的新手,我想通过添加自己的自定义导航栏和其他调整来更改布局母版页。 不幸的是,application.html.rb实际上是一个空白的页面,我不认为这是一个进行更改的页面。 我的问题是:如何覆盖或更改标准div值? 我本地没有这些文件。 我听说过使用Deface作为工具,但我不知道如何使用它。 我希望这里有人可以提供更多关于更改标准Bootstrap Spree应用程序的见解。

如何将bootstrap datepicker放在我的表单中并在date参数中包含值?

我正在使用bootstrap-datepicker.js,它工作正常。 我希望以我的forms在这种类型的rails中使用它 true%>Publish Unpublish Trash 在这里,我想把日期选择器放在我的表单中 “ 所以当我提交表单时,我会在参数日期中获得日期值。 当我点击datepicker中的日期时,它应该隐藏,默认日期应该指向当前日期。 我的appication.js包括 $(function(){ $(‘#dp5’).datepicker({ format: ‘mm-dd-yyyy’ }); $(‘#dp3’).datepicker({ format: ‘mm-dd-yyyy’ }); });