How to open a file from Grails app using <a> tag? - grails

This is my first Grails project & I can't seem to do this very simple thing! I am trying to display a list of PDF forms in one page that I have saved under a folder called forms under my_project/grails-app/views/forms and want to open the PDF form in a new window when clicked.
In my .gsp file I am trying to access the forms like this:
Form #1
But that's giving me a 404 error.
I have found couple of solutions like this one or this question (which is very similar to mine)...but first of all, i don't need to upload/download the file. Second, i don't need to render the file either. All I want to do is just click the link and open the PDF file in a new window/tab. Am I saving the PDF files in a wrong place? Please help!! Thank you.

Place your file/directory into grails-app/assets so that you have grails-app/assets/forms/form_one.pdf then you can use the resource tag like this:
Form #1
The grails-app/views directory is used for views rendered by controllers, where as the grails-app/assets directory is used for static and pre-processed assets.

Related

Navigate between pages in Electron app

In an Electron application, what is the standard way to navigate to different pages / locations when a link is clicked?
I tried creating
<a href="/profile.html>profile</a>
and an HTML file named profile.html, but clicking the link just takes my app to a blank page.
What is actually happening when the link is clicked & what is the right way to do basic links?
Just use a relative link - this will work (note no slash at the beginning):
profile
This is because Electron uses local file:// URLs which map to your file system. If you link to /profile.html that will be looking for the file in the root of your drive, and you probably want it to be loading the file from the same directory instead.
Also if you put the profile.html in a directory called pages you could access it like this:
profile
Electron is designed to work best as a single-page application.
Clicking a link shouldn't load a new page but should manipulate the DOM to changes the contents on the same page.
If you use jquery you could use Tabs to swap between content https://jqueryui.com/tabs/
<a href="./profile.html>profile</a>
use ./{filename} to access the file in the same directory

How can I navigate from an html file to another with a spotify uri?

I don't understand how to navigate through an app with multiple .html files. All the examples that I've found have only one html file.
I have two files in my app :
index.html
artist.html
In my index.html, I use a Text, which works but does not add a state in the history.
From what I have read in the documentation, I should use a link like spotify:app:$APPNAME:arg. But I can't manage to make a link like this works to navigate from an html file to another. And because I can only find apps with one html, I'm wondering if all the existing apps only show and hide parts of an html file to simulate the navigation.
You can link internal with:
sp://appname/filename.ext
link to spotify:app:appname:test.
At this point in index.html you can redirect to the page you want (I.e. test.html) using:
location.href=sp.core.getArguments() + '.html'
The initial call to spotify:app:appname:test will be in the history.

How can I find where actually is the theme file?

I am new to Symfony and I need to work to a large project with many themes to modify them. How can I find where actually is the theme file in which module, just looking at the HTML browser output? Or do I need to look somewhere else, routing for example?
What you want to do is use the Web Debug Toolbar.
Once you have that running on the page, using appname_dev.php, simple click the view link and it will show you which templates have been used. If you need to know which layout to use then use logs link, click none the sfPHPView.

Show template in Joomla (parameter)

I know it is possible in Joomla! to set the template temporarily to another template with an URL parameter. What is the parameter? And how should the template be indicated?
I expect something like
index.php?template=mytemplate
If you go to the template manager and click on one and then edit, there is a preview button where you can see it in a form in the browser. There is also a link there that says "Open in new window." When I click that it loads my site with this as the query "?tp=1&template=ja_purity"
Ahh... sorry, found it myself.
Lets share it:
index.php?template=directoryname
I was using the template name as declared in the XML file, instead of using the directory in the template folder (/templates/directoryname)

How to access HTML files from ASP.NET MVC VIEWS Folder

I will like add conventional HTML page under VIEWS folder (in ASp.NET MVC) page.
I have added the route exceptions as mentioned below.
routes.IgnoreRoute("{resource}.htm/{*pathInfo}")
routes.IgnoreRoute("{resource}.html/{*pathInfo}")
Although it does work when I put the html files out of VIEWS folder but I get Page not found 404 when I put those in VIEWS folder. I am also unable to browse the VIEWS folder by setting directory browsing option in IIS.
Please help me on HOW to access HTML file from VIEWS folder.
I think that it's a mistake to mix your HTML content with your views. I'd suggest that you create a separate static folder under Content and put your HTML there. You can create an analogous directory structure to your view structure if necessary for management. Then you don't need to do anything special in order to able to reference the files. You can even, then, open them up to editing with Contribute, etc. by people who are allowed to modify static content.
+-Content
+-Images
+-Static
+-Account
+-privacy.html
+-refunds.html
+-Styles
Usage:
<a href='<%= Url.Content( "~/Content/Static/Account/privacy.html" ) %>'>Privacy Policy</a>
The default Views folder has an Web.config file that explicitly gives 404 errors for all requests. You just need to edit and enable for HTML files (or all files, but then people might snoop).

Resources