I'm trying to use the elRTE widget in my Grails 2.0.3 app.
I've put the images in the web-app/images
The problem is some of the images display, and some don't, and I have no idea why
So for example:
<r:img uri="/images/smileys/evilgrin.png"/>
<r:img uri="/images/smileys/unhappy.png"/>
<img src="/block/static/images/smileys/evilgrin.png" />
<img src="/block/static/images/smileys/unhappy.png" />
evilgrin.png shows up just fine with either the <r:img /> tag or the <img /> tag, but unhappy.png, which is in the same directory does not.
For that matter, evilgrin.png wasn't showing up but while trying to figure out why, it suddenly appeared. Again, I have no idea why.
The elRTE toolbar shows up fine, but the drop-down menu with the smileys to insert doesn't, except for evilgrin.
Can anyone shed any light?
I'm using Grails 2.0.3 from within SpringSource Tool Suite 2.9.1 (eclipse) on Windows 7.
This behavior is likely due to some of the confusion surrounding the current use of ad-hoc, legacy, and undeclared resources in the Resources plugin. The 1.2 release (out soon) will contain further documentation of these behaviors.
The safest bet is to declare the images folder in the ad-hoc filter settings like:
grails.resources.adhoc.patterns = ["/images/*", "*.css", "*.js"]
(which is the default setting).
Then access the images using the <r:img> tag. Do not use the <img> tag with a src such as that given above.
You can test which actual URIs are being served from the application by using a curl command. The first attempt to access a URI like /images/smiles/evilgrin.png should produce a redirect to /static/images/smilies/evilgrin.png. The image should be served from this latter URI.
Related
I want to include external webpage into my JSF 2.2 application using Server Side Includes. I wrote following code inside ui:define but nothing seems to be happening.
<!--#include virtual="https://example.com/path/to/page.php"-->
does anyone know how can I do this?
What you are looking for is not Server Side Include, as you want to embed a remote HTML rendering into your page.
You may consider that this remote page will need resources (CSS, Images, etc), which may conflict with your own embedding page.
The best way to achieve that is to use JSoup in a Backing Bean and to display the result with h:outputText escape="false". But be careful with what you will display. You can offer a big security hole for your site or your users (XSS, CSRF, etc.). And you will still need to deal with remote resources ...
The real solution would be to use an iframe instead which will "solve" your problem pretty fast.
Migrating from an MVC-pre-Core project to a Core 2 version I'm shocked to find #Scripts & #Styles are removed. I had relied on being able to use #Scripts.Render("~/bundles/myApp") as a short cut that imported a half dozen files on any page that needed them. Now I have to spell all those files on each page that needs them?
Any way to replicate the behavior. Have glanced at Gulp but seems more like exclusively a processor for deployments.
The Scripts.Render and Styles.Render methods don't actually do anything other than add a simple tag to the generated HTML. The meat of what you're talking about - having a bunch of script/styles rolled up in one call - is the bundling provided by MVC. In ASP.NET Core, the method of creating those bundles has simply changed; that is all.
Now, you have bundleconfig.json, instead of BundleConfig.cs. Instead of calling Scripts.Render to include the bundle, you simply reference the bundled script directly. Likewise with your style.
By default, there is a single bundle for each site.js and site.css that are "bundled" (and minified) into site.min.js and site.min.css, respectively. So, you'd just do:
<environment names="Staging,Production">
<script src="~/js/site.min.js" asp-append-version="true"></script>
</environment>
The environment tags simply determine when this HTML will be included in the output. Here, that's only when the enviroment is Staging or Production. The script tag is a hard-reference to the "bundle". This is functionality equivalent to what you would have achieved with something like:
#Scripts.Render("~/bundles/site")
Which, itself, would only have rendered the following script tag:
<script src="~/bundles/site?v=abc123"></script>
In other words, you don't need the Scripts.Render and Styles.Render methods, since they're pretty useless actually. Even in previous versions of MVC, you could have avoided them and just created tags directly pointing to your bundles.
For more information on how bundling and minification works in ASP.NET Core, see the documentation.
I have an annoying problem with my new grails app. I'm trying to mock up a design for a site that I will be making but whenever I do changes in my css it won't affect the running application. No matter how big changes I do I have to stop the application and then run it again.
This is very frustrating, I've turned of cache in Chrome and even if I go to the specific document the resource is still the old. What can I do to solve this problem? I can make changes in my gsp files and the changes will appear but not in my css.
I am currently loading the resource within a layout file like this:
<link rel="stylesheet" href="${resource(dir: 'css', file: 'app.css')}" type="text/css">
If you need me to provide any more information, please just ask. I am using grails 2.2.0.
Add this to your Config.groovy (probably just for development)
grails.resources.debug = true
Read the docs for more info.
It looks like Gregg's answer doesn't work for 1.3.7 (maybe that is something added in 2.x?). A method I found that makes quick CSS updates possible is to include a separate GSP as a template in the page header.
That is, create a file called "_css.gsp" (underscore prefix is required) in the same directory as your view files, fill it with standard css surrounded by html style tags, and then include the following in your layout header or page:
<g:render template="css" />
With that in place, the content of _css.gsp is injected into the page. And I can make changes to _css.gsp and they are immediately reflected after page refresh without having to restart Grails. Hope this helps someone in Grails pre-2.x!
Working with gollum I am unable to get headers to render. The file is name _Header.md following the specifications, and contains the following content
Hello Header!
however, it is not rendered when the site is accessed running gollum in the root of the repository and accessing the page at http://localhost:3000/.
This is particularly puzzling because I am able to get sidebars and footers to render properly but not headers, what may be causing this issue?
Version 2.0 does not support _Header.ext along with '[[_TOC_]] which was a lot more obvious that something just isn't right here and this probably isn't me doing something stupid.
Version 2.1 should be released soon.
When using FB/sharer/sharer.php Im running into problems with my TYPO3 installations as no picture are found. Or better, pictures are found but safe_image.php does not use the correct URL when trying to download them.
In Firebug I noticed FB does following:
safe_image.php?d=XYZ&url=http%3A%2F%2Fwww.my-domain.com%2Fen%2Ffileadmin%2FmyPicture.jpg
which fails because the real path is
safe_image.php?d=XYZ&url=http%3A%2F%2Fwww.my-domain.com%2Ffileadmin%2FmyPicture.jpg
Any idea why there is an /en added? The website has multiple languages (changed by domain.com/en or domain.com/de) but all images could be found under domain.com/fileadmin/...
When using og meta tags it works nice, but we want the user to choose the picture he would like to share.
Facebooks is not able to use relative links with base tag. Which is bad.
Solution is to use absolute URLs (config.absRefPrefix).
Related bug tracker issue: http://bugs.typo3.org/view.php?id=18121