Couldn't find "fullcalendar" - ruby-on-rails

We're using Rails Assets in our project and we're in the process of updating Ruby from 2.3.7 to 2.4.7, following this guide. I think I've resolved all the gems issues, but when I'm trying to run rspec or navigate to any admin page, I'm greeted with this error:
couldn't find file 'fullcalendar'
This is one of the Rails Assets mentioned above, and I'm not sure why this is happening.
My gemfile:
source 'https://rails-assets.org' do
gem 'rails-assets-jquery'
gem 'rails-assets-jquery-ujs'
gem 'rails-assets-jquery-ui'
gem 'rails-assets-js-cookie'
gem 'rails-assets-lodash'
gem 'rails-assets-highcharts'
# gem 'rails-assets-quill'
gem 'rails-assets-select2'
gem 'rails-assets-select2-bootstrap-css'
gem 'rails-assets-slick.js'
gem 'rails-assets-picturefill'
gem 'rails-assets-scrollmagic'
gem 'rails-assets-gsap'
gem 'rails-assets-fullcalendar'
gem 'rails-assets-moment'
gem 'rails-assets-jstzdetect'
gem 'rails-assets-blueimp-file-upload'
gem 'rails-assets-air-datepicker'
end
/app/views/layouts/admin.haml:
= javascript_include_tag 'admin'
/app/assets/javascripts/admin.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 any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery-ujs
//= require jquery-ui/jquery-ui
//= require lodash
//= require bootstrap
//= require moment
//= require quill
//= require fullcalendar
//= require select2
//= require jstzdetect
//= require cocoon
//= require blueimp-file-upload/jquery.iframe-transport.js
//= require blueimp-file-upload/vendor/jquery.ui.widget.js
//= require blueimp-file-upload/jquery.fileupload.js
//= require_tree ./admin
What have me scratching my head is that the assets above fullcalendar are loading fine, but this one throws an error.
This app is running on Rails 4.2.7.1 and ruby 2.3.7. I'm trying to update Ruby version to ruby 2.4.7.

Try replacing require fullcalendar with
require fullcalendar/core/main.js
require fullcalendar/daygrid/main.js
Just a guess based on the doc
Alternatively, just remove it from assets and put the files directly in vendor folder; or use this gem.

Related

Sprockets cant find asset from rails-assets.org

I try to install react-router and material-ui on my rails 4 app but I get Sprockets::FileNotFound error for react-router and material-ui. I follow instructions from rails-assets.org.
My Gemfile:
source 'https://rails-assets.org' do
gem 'rails-assets-classnames'
gem 'rails-assets-lodash'
gem 'rails-assets-react-router'
gem 'rails-assets-material-ui'
end
application.js
//= require jquery
//= require lodash
//= require jquery_ujs
//= require react
//= require classnames
//= require react_ujs
//= require react-router
//= require turbolinks
//= require_tree .
And after bundle I got this notification on some gems This component doesn't define main assets in bower.json.. Thank you for your time and I hope we work this out.
UPD 1:
I found kind of a solution on stackoverflow but I would like to stick to rails-assets.org way if possible.
ruby '2.2.0'
rails '4.2.3'
Might be easy to forget, but have you restarted your (running) rails server?
Started to use rails-assets yesterday as well and it showed me the exact same problem (Sprockets::FileNotFound).
I restarted the running server in the console and the problem was solved.
Rails 4.2.5
/ Ruby 2.3.

Ruby on Rails 4: Installing GEM

I am trying to install my first gem in Ruby, but am having problems with it working. I am not quite sure where I am going wrong, I am following the directions of the gem step by step. I am using Cloud9 for my ide.
The gem I am trying to install is the: wysiwyg-rails gem
I add the following line to the gem file:
gem 'wysiwyg-rails', '1.2.5'
then I add the following to the application.css file so it looks like:
/*
*= require froala_editor.min.css
*= require froala_style.min.css
*= require font-awesome
*= require_tree .
*= require_self
*/
And finally I add the require .js file to the application.js:
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require froala_editor.min.js
//= require plugins/tables.min.js
//= require_tree .
I run bundle install and then restart the server. When I try to load the page, I get the error: couldn't find file 'font-awesome'
However, i can see that font-awesome is installed
Using font-awesome-rails 4.2.0.0
If I remove the *= require font-awesome from the application.css, it starts up without any errors. When I view the source code, I can see the css and js files ( froala_editor) load up, but font-awesome is not one of them. Is there a step that I am missing?
Thanks!
the problem is very strange,the reason is unknown,but i resloved in my program,just add "font-awesome-rails" gem.
gem "font-awesome-rails"
Have you tried installing with font-awesome-less or font-awesome-sass gems to get them up and running?
It seems you are running without any sprockets (asset-pipeline). Add any of those gems, it probably run fine when serving rails s.
After bundle install, go to application.css and write this code as it follows:
#import "font-awesome-sprockets"
#import "font-awesome"
Hope that helps.

When installing a gem (bootstrap-wysihtml5) do I have to manually move javascript and css files?

I think I am missing a vital step:
When installing a gem (ie. bootstrap-wysihtml5) what steps should I take for it to correctly find and reference the javascript and css files.
I add gem bootstrap-wysihtml5 to my gemfile, and run bundle install.
I place //= require bootstrap-wysithtml5 in application.js and *= require bootstrap-wysithtml5 in application.css.
I get the following error:
Error compiling CSS asset
Sprockets::File not found: couldnt find file 'bootstrap-wysihtml5.css'
Do I have to manually copy the js and css to the relevant app/assets file, or is there a crucial step I'm missing?
As Billy said, the correct gem is bootstrap-wysihtml5-rails. The gem installs the JS/CSS without further effort on your part.
Add this to your Gemfile:
gem 'bootstrap-wysihtml5-rails'
Add this to app/assets/javascripts/application.js:
//= require bootstrap-wysihtml5
Add this to app/assets/stylesheets/application.css:
*= require bootstrap-wysihtml5
Note that bootstrap-wysihtml5-rails requires Bootstrap. If you have not already added Bootstrap to your project, follow these steps from the creator of this gem:
In Gemfile, add the following:
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails',
:github => 'anjlab/bootstrap-rails'
Rename app/assets/stylesheets/application.css to app/assets/stylesheets/application.css.scss
Add the following to app/assets/stylesheets/application.css.scss:
#import "twitter/bootstrap";
Add the following to app/assets/javascripts/application.js:
//= require twitter/bootstrap
Once the gem & Bootstrap are both installed, initialize wysihtml5.
<textarea id="some-textarea" class='wysihtml5' placeholder="Enter text ..."></textarea>
<script type="text/javascript">
$(document).ready(function(){
$('.wysihtml5').each(function(i, elem) {
$(elem).wysihtml5();
});
});
</script>
I found the solution! Thanks for your help guys.
By moving the position of the javascript references to this order, it now seems to work.
//= require jquery
//= require jquery_ujs
//= require bootstrap-wysihtml5/b3
//= require bootstrap/bootstrap
I have no idea why the order would make such a difference. But it works now! Thanks.

Deployment rails app. JQuery-UI error

I just deploy my application on a cloud server and then enconter an error:
ActionView::Template::Error (couldn't find file 'jquery-ui'
(in /home/me/.rvm/gems/ruby-1.9.3-p429/gems/activeadmin-0.6.0/app/assets/javascripts/active_admin/base.js:2)):
I previously deploy the same app on a shared host but i didn't get this error previoulsy. So i guess i miss something in my deployment.
Btw in the base.js:
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require active_admin/application
And in my app/assets/javascripts/application.js.erb:
//= require Player/soundmanager2-nodebug-jsmin.js
//= require jquery
//= require jquery.ui.all
//= require jquery_ujs
//= require best_in_place
//= require best_in_place.purr
//= require jquery-fileupload
//= require contextMenu/jquery.contextMenu.js
//= require contextMenu/jquery.ui.position.js
//= require_tree .
//= require_tree ./Player
EDIT: In my Gemfile:
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'jquery-fileupload-rails'
gem 'jquery-ui-rails'
I've been struggling with this same issue...
I believe you're running into a recently-created headbutt between ActiveAdmin and the jquery-rails gem; there's nothing wrong with your configuration per se.
jquery-rails used to include a copy of the JavaScript for JQuery UI (but not the CSS; not sure why). That's what's pulled in by the line
//= require jquery-ui
in ActiveAdmin's base.js file. Recently, jquery-rails dropped its inclusion of the JQuery UI JavaScript, so the line above now points to nothing and causes an asset build error. Installing jquery-ui-rails doesn't help because that gem renames the files so that the proper require line is
//= require jquery.ui.all
probably to avoid conflict with the previous versions of jquery-rails.
Unfortunately, ActiveAdmin can't simply rebase itself on jquery-ui-rails instead of jquery-rails and maintain backwards compatibility with Rails 3.0, at least according to this issue report. So a solution may be a few days in coming.
In the meantime, just request an older version of jquery-rails that still includes the JavaScript for JQuery UI in your Gemfile:
gem 'jquery-rails', '<3.0.0'
Encountered something similar and found that removing gem jquery-ui out of the group :assets block fixed this for me. Furthermore you will notice in the gemfile it says the following:
# Gems used only for assets and not required
# in production environments by default.
So make sure this is not part of the :assets group
Update
I believe your ordering of your application.js should look like this:
//= require jquery
//= require jquery_ujs
//= require_tree .
//
//= require jquery-ui
//= require jquery.ui.all
//= require active_admin/application
//= require Player/soundmanager2-nodebug-jsmin.js
//= require best_in_place
//= require best_in_place.purr
//= require jquery-fileupload
//= require contextMenu/jquery.contextMenu.js
//= require contextMenu/jquery.ui.position.js
Furthermore just to ensure that your setup is correct in your application.rb you should have:
Application.rb
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
production.rb
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
When you want to do the following command: bundle exec rake assets:precompile:all RAILS_ENV=production

Installing rails-backbone, missing assets?

I just installed the rails-backbone gem and then rails g backbone:install.
I see a list of javascript references to backbone on application.js but it does not copy them to the project and I'm not sure if this is normal.
//= require backbone
//= require backbone_rails_sync
//= require backbone_datalink
//= require backbone/myapp
If this is normal, where is it possible to find backbone_rails_sync and backbone_datalink. I'm afraid that by simple searching will maybe not find the same version tested for this gem?
These files are inside the gem and served through Rails Asset Pipeline.
You could find them in the gem souce.

Resources