How to link a js file when editing a plugin in Grails - grails

I am using Grails 2.5.6. I am editing spring-security-plugin.
My spring-security-plugin version is 2.0-RC5. I need to link a
javascript file in my view. But it shows file not found. Here are my attepmts below:
in my view >>>
<head>
<title>Royal Page</title>
<link href="${resource(dir: 'css', file: 'common.css')}" type="text/css" rel="stylesheet">
my directory structure >>>

Related

D3/Nivo is unable to render in rails application

I am working on a feature to replace a Flash dashboard with Nivo/D3. I successfully built the dashboard and have it as a React component to be imported. The react component even loads into the browser, but does not render on the page.
I have verified that my component is built correctly, and I am able to run it in an html page by itself. The page I am trying to put it in is of file type .html.erb. I did try changing the ruby tags to HTML and that did not work. One theory is that I need to remove the JS prototype duplicate line here.
<script type="text/javascript"> </script>
<script src="/javascripts/prototype.js?1557137208" type="text/javascript"></script>
<script src="/javascripts/prototype.js?1557137208" type="text/javascript"></script>
<script src="/javascripts/effects.js?1557137208" type="text/javascript"></script>
<script src="/javascripts/dragdrop.js?1557137208" type="text/javascript"></script>
<script src="/javascripts/controls.js?1557137208" type="text/javascript"></script>
<script src="/javascripts/application.js?1557137208" type="text/javascript"></script>
<script src="/javascripts/active_scaffold/default/active_scaffold.js?1565285086" type="text/javascript"></script>
<script src="/javascripts/active_scaffold/default/dhtml_history.js?1565285086" type="text/javascript"></script>
<script src="/javascripts/active_scaffold/default/form_enhancements.js?1565285086" type="text/javascript"></script>
<script src="/javascripts/active_scaffold/default/rico_corner.js?1565285086" type="text/javascript"></script>
<link href="/stylesheets/active_scaffold/default/stylesheet.css?1565285086" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/active_scaffold/default/export-stylesheet.css?1565285086" media="screen" rel="stylesheet" type="text/css" />
<!--[if IE]><link href="/stylesheets/active_scaffold/default/stylesheet-ie.css?1565285086" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/active_scaffold/default/export-stylesheet-ie.css?1565285086" media="screen" rel="stylesheet" type="text/css" /><![endif]-->
However, I don't know where or how that code is being generated. I think it is related to active scaffolding. Does anyone have any input on that?
Presently, the error message I have been troubleshooting is this:
index.esm.js:214 Uncaught TypeError: h(...) is not a function
at Object.<anonymous> (index.esm.js:214)
at n (ResizeObserver.es.js:928)
at Object.<anonymous> (index.esm.js:214)
at n (ResizeObserver.es.js:928)
at Object.<anonymous> (index.esm.js:214)
at n (ResizeObserver.es.js:928)
at Object.<anonymous> (index.esm.js:214)
at n (ResizeObserver.es.js:928)
at Module.<anonymous> (index.esm.js:214)
at n (ResizeObserver.es.js:928)
but I don't think that is relevant as I have dug into it quite a bit.
Tech stack notes (I realize I am on an old version of Ruby but upgrading is unfortunately not an option):
* XML Version 1.0
* Ruby version: 1.8.6
* Ruby gems
cgi_multipart_eof_fix (2)
gem_plugin (0.2.3)
* json_pure (1.7.6)
* mongrel (1.1.5)
* rake (0.8.7)
* ruby-net-ldap (0.0.5)
* Apache version: Not used yet. Eventually Odin and Sonitor will be replaced with nifi.
* .NET version 4.0 (or 4.7)
Does anyone have advice on how to get my React component to render?

Missing files (404) in Ionic App only in iOS

I have an app I developed in Android. I installed a VM with Mac, and I'm testing it in iOS. The app worked perfectly in Android, but in iOS it is not. When I use 'ionic serve' or 'ionic serve --lab' the browser show a white screen, and in the console I get this errors (link of image below):
Console
Here is some code from the index.html:
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="lib/ionic/css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/bluebird.min.js"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic.cloud.min.js"></script>
<script src="lib/ionic/js/ionic-modal-select.min.js"></script>
<script src="lib/ionic/js/ionic-toast.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
I'm really lost here because the exact same files works OK for Android.
Which error you are posted, not library error.Error coming from app.js file.If you dont mind create a new ionic app and replace your file in new app.it will works.

Ionic not loading cordova.js file

I am having a problem with my ionic project, it is not loading cordova.js file or ngCordova.js file.
Here is my index.html file
<!DOCTYPE html>
<html>
<head>
<script src="lib/ngCordova/dist/ng-cordova.js"/>
<script src="cordova.js"></script>
<script type='text/javascript' src="lib/cryptojslib/rollups/aes.js"></script>
...
</head>
When I deploy the app on my iphone, aes.js and cordova.js file is loaded, the problem is ng-cordova.js is not loaded because when I invoke that code I get:
Error: Can't find variable: cordova
scan#file:///var/containers/Bundle/Application/6888FB51-F164-46EC-89AC-B8960C93FC7A/Nastic.app/www/lib/ngCordova/dist/ng-cordova.js:596:16\
....
If I switch lines:
<!DOCTYPE html>
<html>
<head>
<script src="cordova.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.js"/>
<script type='text/javascript' src="lib/cryptojslib/rollups/aes.js"></script>
...
</head>
Then ng-cordova.js is loaded, but aes.js is not loaded.
I was looking for a fix to this problem but couldn't find anything that solved the issue, however lot of similar issues.
Thanks
You should always include the file cordova.js after loading ng-cordova.js
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
<script src="lib/cryptojslib/rollups/aes.js"></script>
Reference: http://ngcordova.com/docs/install/

dart2js Polymer Dart Sample ClickCounter App is OK in Firefox, fails in Chrome

I am trying out a Polymer Dart App under Cordova. So I started with the Dart Editor Sample App.
I use a recent version of Polymer so I had to edit the sample code. Here is my pubspec.yaml
name: cortst
description: Cordova Test Application
dependencies:
polymer: '>=0.15.1+3 <0.16.0'
transformers:
- polymer:
entry_points:
- web/cortst.html
And here is the combined HTML and Dart. I think the initialization uses the new/approved technique:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample App</title>
<link rel="import" href="clickcounter.html">
<link rel="stylesheet" href="cortst.css">
<script type="application/dart">
import 'dart:async';
import 'package:polymer/polymer.dart';
void main() {
initPolymer().run( () {
Polymer.onReady.then( (_) {
new Future( () {
// stuff goes here!
});
});
});
}
</script>
</head>
<body>
<h1>A Test</h1>
<div id="sample_container_id">
<click-counter count="5"></click-counter>
</div>
</body>
</html>
To generate stand-alone JavaScript I run dart2js via the command line:
pub build --mode=debug
And these are the results:
Dartium (37.0.2062.120 (292122) via Dart Editor 1.7.2) - OK
Run as JavaScript on Chrome (38.0.2125.111 m) - OK
Run as JavaScript on Firefox (33.0.3) - OK
dart2js and run on Chrome - no shadow DOM.
dart2js and run on Firefox - OK
When it fails the click counter is rendered (invisibly) as
<click-counter count="5"></click-counter>
This Chrome problem matters because the standard web host on Android is Chrome.
For brevity, I have embedded the Dart script in the HTML. I get the same results when I use a separate .dart file.
Perhaps I have overlooked something - it wouldn't be the first time...

How to precompile individual css/js files in assets?

I am trying to setup GitLab on my local machine in development env from source.
Please note that I am completely new to Ruby on rails development as my field is PHP.
I followed instructions from
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md where I replaced RAILS_ENV=production with RAILS_ENV=development where appropriate and also tweaked some config files.
All installations steps went smooth, however when I open the gitlab page, it tries to load css and js files that are not present:
...
<link href="/assets/jquery.ui.core.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/jquery.ui.theme.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/jquery.ui.datepicker.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/jquery.ui.menu.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/jquery.ui.autocomplete.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/jquery.atwho.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/select2.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/highlightjs.min.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/dropzone/basic.css?body=1" media="all" rel="stylesheet" />
<link href="/assets/print.css?body=1" media="print" rel="stylesheet" />
<script src="/assets/jquery.js?body=1"></script>
<script src="/assets/jquery.ui.core.js?body=1"></script>
<script src="/assets/jquery.ui.widget.js?body=1"></script>
...
I noticed that after I do
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=development
the only css files that are put into public/assets/ folder are
application-4979ead805bf0eb7d853f1e0104f87ef.css
application-4979ead805bf0eb7d853f1e0104f87ef.css.gz
According to css assets not precompiling in production I added this line
config.assets.precompile += ['*.css', '*.js']
in config/environments/development.rb. However now when I try to precompile assets, I get an error
...
rake aborted!
Sass::SyntaxError: Undefined mixin 'border-radius'.
(in /home/git/gitlab/app/assets/stylesheets/generic/avatar.scss:6)
/home/git/gitlab/app/assets/stylesheets/generic/avatar.scss:6:in `border-radius'
...
Does anyone know how to fix it?
Thanks!
Error
The error can be fixed by including the #border-radius mixin in your avatar.css.scss stylesheet. We typically use a variables.css.scss stylesheet, where our mixins are defined:
#app/assets/stylesheets/variables.css.scss
#mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
-o-border-radius: $radius;
border-radius: $radius;
}
#app/assets/stylesheets/avatar.css.scss
#import 'variables';
This should give you the ability to call the mixin in your avatar stylesheet, which should fix the error you're receiving
--
Precompilation
Typically, if you wanted to add a specific CSS file to your pre-compilation path, you'll have to do this:
#config/environments/production.rb
config.assets.precompile += ['avatar.css']
Precompilation is only recommended for production environments, as if you precompile in development, how are you going to track / manage changes? Bottom line is you won't.
Here's what the Rails docs say about it:
In the production environment Sprockets uses the fingerprinting scheme
outlined above. By default Rails assumes assets have been precompiled
and will be served as static assets by your web server.

Resources