grails 3.1.4 - google-visualization plugin not working - grails

I just followed the instructions on https://github.com/bmuschko/grails-google-visualization/wiki/usage ... However, I now get the following error:
org.grails.taglib.GrailsTagException: [views/participant/results.gsp:57] Template not found for name [/visualization_javascript] and path [/_visualization_javascript.gsp]
I wonder how I could verify that the google-visualization plugin has been installed correctly. Obviously, it finds the corresponding taglib but not the required template, or am I mistaken?
In my view I have simply put the line <gvisualization:pieCoreChart elementId="piechart" title="My Daily Activities" columns="${columns}" data="${rows}" />. And in the head of the gsp I put <gvisualization:apiImport/>.
Would be grateful for ideas or suggestions?

You should put the files _visualization_javascript.gsp and _formatter.gsp
in your views folder, seems like actually they were omitted in the build of the latest plugin.

Related

Grails 2.4.4 SCSS support?

I added sass-grails-asset-pipeline, and in main.gsp I have this:
<asset:stylesheet src="application.css"/>
If I change stylesheets/application.css to stylesheets/application.scss, the GSP produced creates no <link> to request the css. If I do a manual request for http://localhost:8080/my-app/assets/application.css I get a 404.
What's going on? Is there some special undocumented setup to get SCSS working properly?
Make sure you're using a sass-assets plugin that exactly matches your assets-plugin. Mismatching will cause issues.

template not found in grails application

I just upgraded to grails 2.2.4 from 2.1.2. Everything works fine on my local but, however, when I packaged the WAR onto the test environment I am seeing a weird error. On a form that uses a template I am getting an error:
template not found for name [form] and path [/base/_form.gsp].
However, this template (using from create.gsp) is not under the base folder. It is under a folder called color (under views), which is where both create.gsp and _form.gsp reside
This is the tag I'm using from create.gsp:
<g:render template="form" bean="${mybean}"/>
It seems that grails is assume that the template lives in base but it really lives in color.
You are getting this error,
template not found for name [form] and path [/base/_form.gsp]
because Grails is looking for _form.gsp in a path relative by convention to a folder with the same name as the controller that is rendering the parent gsp. This will always be the case if you don't supply an absolute path (starting from views folder) in the render tag.
Where is your _form.gsp page? Here are some example paths
grails-app/views/_form.gsp
-> <g:render template="/form" ..
grails-app/views/base/_form.gsp
-> <g:render template="/base/form" ...
or -> <g:render template="form" .. //if calling from baseController
So if _form.gsp lives in color and color is at grails-app/views/color, you would need the following path in your render tag:
<g:render template="/color/form"

CKEditor - move skins folder somewhere else

I'm using CKEditor for the first time and trying to do something that I thought would be very simple to do but so far I've had no success.
Essentially I want to place the editor.js, config.js and styles.js in a scripts folder but want the "Skins" folder that contains the css and images to appear within a separate "Styles" folder.
The application consists of a simple view that displays the editor on load.
The code to display the editor is a follows:
angular.element(document).ready(function () {
CKEDITOR.config.contentsCss = '/Styles/CKEditor/';
CKEDITOR.replace('editor');
});
The HTML within my view is as follows:
#section scripts
{
<script src="~/Scripts/ckeditor.js" type="text/javascript"></script>
<script src="~/Scripts/angular.js"></script>
<script src="~/Scripts/Main.js" type="text/javascript"></script>
}
<h2>Index</h2>
<textarea id="editor" name="editor"></textarea>
This is an MVC application and the scripts are rendered at the end of the body within the layout view.
The editor will not display in any browser. As I understand it setting the contentsCss property should do the trick.
If I place the skins beneath my script folder it works fine. I can see in the generated source that it is adding a link to the header pointing to /Scripts/Skins/moono..., but I want it to add a reference to /Styles/Skins/moono...
Is what I am trying to do feasable and if so what am I missing here? I was expecting this to be simple.
As a work around I could just add some routing rules that redirects the relevant request to a different location, but I'd rather get to the bottom of the issue before I do this.
Further information:
My application is an ASP.net 4.5/MVC 4 app.
I'm referencing angular because I'll be using that once I've sorted this issue. I have tried removing all references to angular but the problem still persists.
I've tried setting the contentsCss property in the following ways:
Directly using CKEDITOR.config.contentsCss
Within the config.js file. The sample assigns an anonymous function to CKEDITOR.editorConfig and in there you can manipulate congif entries.
Passing a config parameter when calling the "replace" method on the CKEditor object.
I've tried manipulating the contentsCss property both before and after the call to replace.
I'm using the latest version of CKEditor (4.2)
Thanks to #Richard Deeming, I've found the answer.
I'm using the default moono style, so I needed to set the CKEDITOR.config.skin property as follows:
CKEDITOR.config.skin = 'moono,/Styles/CKEditor/Skins/moono/'
My final code now looks like this:
angular.element(document).ready(function () {
CKEDITOR.config.skin = 'moono,/Styles/CKEditor/Skins/moono/';
CKEDITOR.replace('editor');
});
You have to set the url to the actual folder containing the skin itself (I thought CKEditor might append skins/mooono itself but it doesn't).
I also found that you must include the final '/' from the URL.
Looking at the documentation, you need to specify the path as part of the skin name:
CKEDITOR.skinName = 'CKeditor,/Styles/CKeditor/';

In Grails template namespace how do you use a template that is in another directory

Say I have a template called /sample/_mytemplate.gsp.
If I want to call this template from the same directory I can use
However, what if I am in another directory. Then what do I do?
Say I'm in the view /sample2/mypage.gsp how do I call it?
In Grails 1.3.7 the following syntax
<tmpl:/sample/mytemplate />
works.
<g:render template="/sample/mytemplate" />
should do it.

jQuery and url re-write

I am having a wierd error and jQuery not working depending on how the url is written.
if the url is
/index.cfm?show=about-us
all is good. BUT if the url is
/index.cfm/show_about-us
jQuery doesn't seem to load correctly and I get a "$ is not defined" error in fireBug
I can't use the standard ?= query string I need to be able to use the re-write method.
Any ideas are appriciated
Lance
What does your <script src="..."> say? I have a feeling it's looking for /index.cfm/jquery.js which doesn't exist.
Sorry this was a reference issue to the files. Evendently in that re-write sytle the dom is still trying to navigate the file system starting in the /show_about-us/ directory which isn't truely a directory.
That's it. #recursive got it in one.
Consider using the absolute path from the root of your domain in src attributes. For example: <script src="/jquery.js">

Resources