template not found in grails application - grails

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"

Related

grails 3.1.4 - google-visualization plugin not working

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.

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/';

Layout page and simple mvc razor view in Orchard Module and css, js reference issue

According to the answer provided by REMESQ on this question: Is it possible to use razor layouts with Orchard CMS and bypass the theming
I was able to have separate layout and pages for a module bypassing Orchard's themes and layouts. But having problem referencing the cs,js script files (located in different folders of the module). Getting 404 NotFound error.
I tried referancing in the following way:
#Script.Include("~/Scripts/jquery-1.9.1.js")
But cant get the correct reference path rendered attached picture
Your URL is wrong - it should be either:
jquery-1.9.1.js. Without leading tilde and Scripts/. Orchard will make sure the final URL will lead to /Scripts folder in your current module, or
~/Modules/Your.Module/Scripts/jquery-1.9.1.js
it works if written in this way:
<link href="~/Modules/ModuleName/Styles/site.css" rel="stylesheet" type="text/css" />
For the image tags in html we can write like this:
<img alt="" src="~/Modules/ModuleName/Styles/images/for-rent.jpg" />

Cannot import the CSS in JSF pages

I'm learning to use ADF on Oracle jDeveloper 11g.
I created an ADF Fusion Web Application (with the WebLogic webserver) and I created a JSF page under \ViewController\public_html. Then I created a CSS skin file (for JSF) and I put it under \ViewController\WebContent\resources\css\
I want to apply such style rules to the JSF page. To do this I put it into such page the line
<h:outputStylesheet library="css" name="prova.css" id="CASD"/>
where prova.css is the name of the CSS file I've created.
It doesn't work, neither using /css instead of css or /resources/css, etc.
Try using <af:resource type="css" source="your source path here" /> instead.
You shoud make a skin and add your page. When you make a skin
the name of skin is set in trinidad-config.xml in your project:
<skin-family>skin2(name of skin)</skin-family>

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.

Resources