grails assets dependsOn - grails

In the old world of Grails 2.3X with resources, the actual resources could be defined in a specific order i.e. dependsOn
I have been looking around the assets notes:
https://github.com/bertramdev/asset-pipeline/wiki/Why-asset-pipeline-over-grails-resources-plugin
I can not seem to find anything related to dependency since at the moment even though I have defined a specific script below another I am getting error that would be if it were started before it.

got this working in the end
//= require jquery/jquery
//= require bootstrap/bootstrap
//= require angular/angular
//= require angular-route/angular-route
//= require angular-resource/angular-resource.min
//= require angular-table/ng-table
//= require $app/index
//= require $app/services
//= require $app/arrestedDirectives
//= require_tree custom-$app
//= require_tree views
//= require_self
where the $app gets parsed replaced with users app (within a plugin - thanks baxxabit)

Related

How can I use the bootstrap utility functions in my rails app?

In my javascript console it works when I do this$('.collapse').collapse();,
but it does not work when I append it to the bottom of my application.js file.
My application.js file looks like this
//= require rails-ujs
//= require activestorage
//= require turbolinks
//= require jquery3
//= require popper
//= require bootstrap
//= require_tree .
Why doesn't it work when I add it to my application.js???
Thank you

Datepicker not working in rails

I am using jquery datepicker for my active admin. I upgraded my app from rails 4.6 to rails 5 then my app started to fail.
couldn't find file 'jquery-ui/datepicker' with type 'application/javascript'
I added gem 'jquery-ui-rails' gem and added //= require jquery-ui in application.js and *= require jquery-ui but still my problem didn't solved.
application.js
//= require_self
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require jquery-ui/widgets/datepicker
in your application.js
//= require jquery-ui/widgets/datepicker
and restart your server
Update:
Rearrange your js as following and restart your server.
//= require_self
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require jquery-ui/widgets/datepicker
//= require_tree .
You may need to upgrade your 'active_admin_datetimepicker', so try to update your Gemfile with:
gem 'active_admin_datetimepicker', '=0.6.3'

Unable to load Bootstrap.min file

I am trying to load bootstrap in my rails application. But it is not working. I had included the bootstrap and sass gems in my Gemfile. The following is my application.js file:
//= require bootstrap
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
I have also tried using bootstrap-cdn but it did not solve my problem. And I am unable to load bootstrap.min file in the application.
Thanks in advance.
Add .min after bootstrap or rails will search for bootstrap.js instead of bootstrap.min.js
//= require bootstrap.min
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
NOTE: Same applies for bootstrap.min.css

Wrong path for js vendor/assets

application.js requires jquery-ui file from vendor/assets/jquery-ui/jquery-ui.min.js. But result is like that:
<script src="/javascripts/../jquery-ui/jquery-ui.min.js" data-turbolinks-track="true"></script>
All other js plugins works well, asset pipeline finds them. But can't find properly jquery-ui, jquery-block-ui and jquery-slimscroll
And how a regular script tag look like:
<script src="/assets/pace.min-6a1cbb46da15c9d3662ad8b47fd43ee9.js?body=1" data-turbolinks-track="true"></script>
Why Asset Pipeline can't find the right path for these plugins?
Application.js file is like that:
//= require jquery-2.1.4.min
//= require jquery-ui.min
//= require pace.min.js
//= require jquery.blockui
//= require js/bootstrap.min
//= require jquery.slimscroll.min
//= require switchery.min
//= require jquery.uniform.min
//= require js/classie.js
//= require js/main.js
//= require jquery.waypoints.min
//= require toastr.min
//= require jquery.flot.min
//= require jquery.flot.time.min
//= require jquery.flot.symbol.min
//= require jquery.flot.resize.min
//= require jquery.flot.tooltip.min
//= require curvedLines
//= require MetroJs.min
//= require modern
//= require jquery_ujs
//= require turbolinks
//= require_tree .
The asset pipeline can not find your JS file because they simply don't exist i suppose. For this to work you would need a query-2.1.4.min.js file in your javascript folder for instance. I can see you don't have any issue with jquery_ujs so i suppose you are using the gem jquery-rails.
You should replace //= require jquery-2.1.4.min with //= require jquery2 as described in the following link: https://github.com/rails/jquery-rails#installation. On their page it is stated that jquery-ui is no longer included in the jquery-rails gem so you need to use gem "query-ui-rails" in your Gemfile to be able to include query-ui in application.js

Rails Application : Getting Sprockets::FileNotFound

**
Sprockets::FileNotFound at /
couldn't find file 'ckeditor-jquery'
(in /home/jeeva/Projects/Codebases/acu-arogya/app/assets/javascripts/application.js:16)
**
I am Using CKeditor in my rails application but i'm getting error in javascript
My application.js file contains:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require ckeditor-jquery
//= require twitter/bootstrap
//= require_tree .
One simple idea to try:
Swap the position of
//=require_tree .
with the position of
//= require ckeditor-jquery

Resources