I cannot find the searchableController or the view for the Searchable plugin in Grails - grails

I installed the searchable plugin on Grails and when I run my application I can browse to it and the searchable function works fine.
The only problem is that I cannot find the searchableController or even the view of it in my project. So I'm not able to edit anything or rewire the code to fit in another controller or view.
Any help would be much appreciated.
Kind regards.

The SearchableController and its views are located inside the searchable plugin, see $HOME/.grails/<version>/projects/<projectname>/plugins/searchable.
Be warned: it's a really bad idea to modify anything in $HOME/.grails manually unless you're sure what you're doing.
Instead you could either:
download the plugin from svn/git and reference it as 'inplace' plugin. If you don't know about inplace plugins, just google for it.
copy the SearchableController from $HOME/.grails to your project and modify it.

Related

Where is the default login page for the spring security core plugin?

I have installed the spring security core plugin. I need to modify the login page to look like my existing website. I have searched the entire project and cannot find it. I am running grails 2.4 and spring-security-core:2.0-RC5. Where can this pesky little file be? Can someone who is not a complete greenhorn help a fellow out?
As #Abs points out, the file is at target/work/plugins/spring-security-core-2.0-RC5/grails-app/views/login/auth.gsp but you shouldn't edit plugin files. Other developers on your team won't have access to the modified files and if you delete the target directory you'll lose your changes since the target directory is only a temporary work location.
Instead, copy the file to the same relative location in your application and make changes there. Create grails-app/views/login and copy the file there and make whatever changes you want.
This technique works for most plugin files, not just GSPs. The compilation order and classpath are configured such that application files and classes override plugin files if they're in the same location/package.
You can find the default login page here
targt->work->plugins->spring-security-core-2.0-RC5->grails-app->views->login>auth.gsp

Changes in server view is not working in Grails

I am working with Grails 2.4.2 and Tomcat 7 in Debian server.
Suppose I need to change a label of a field. If I change the label in server's view directory it is not working.
All I have to do is creating war again and deploy. But so far as I know, if any changes made in views no need to create war and deploy again.
In my opinion, the best way to deal with any dynamic content is to externalize it. Save the dynamic content into an external file where you can modify it. Grails' reloadable configuration could be of a great help. See http://www.tothenew.com/blog/externalize-and-reload-grails-configuration-dynamically/ to get an idea how this could be done.

How to inject custom js files with grunt-wiredep?

Is it possible to inject my own js folder by grunt-wiredep task? Is there solution for it?
EDIT
I found grunt-inject, but I'm using jade view engine(that solution is only for HTML)
Doesn't look like it from first glance. Looks like it is exclusively dependent on wiredep which only scans bower.json.
The closest thing you can do is manage other JS dependencies through bower as well.
https://github.com/stephenplusplus/grunt-wiredep/issues/107
I am also looking for an alternative. I am also looking into grunt-inject, but no longer use jade on my projects.
https://github.com/ChrisWren/grunt-inject
https://github.com/klei/grunt-injector
https://github.com/scott-laursen/grunt-scriptlinker
If I figure out a jade alternative, and which one I chose, I'll update my post.

redmine-my-widgets-plugin not working on redmine 2.3.0

The following is the repository for redmine.
https://github.com/redmine/redmine
And the following is the repository for redmine-my-widgets-plugin
if we look at the file structure app/views/my
https://github.com/redmine/redmine/tree/master/app/views/my
there is a folder blocks which contains the partial which are widgets and displayed when added from select list.
similarly for redmine-my-widgets-plugin there is similar file directory structure
https://github.com/bradbeattie/redmine-my-widgets-plugin/tree/master/app/views/my
when i install this plugin the partials mentioned in this /my/block gets added in the my page -> select list so as to be added
When we add one of the plugins select list value then it displays 404 error
By looking at the structure the plugin, it looks like the plugin is overrided.
Also there are no others config files, or lib files present in the plugin(except en.yml)
So, what can be done that the plugin will be able to atleast find those partials.
Basically, redmine is able to find the partial files as the names are displayed in the my page -> select list but when added it throws 404 error
I know, I'm rather late to the party, but maybe this answer helps somebody else in the future.
The underlying problem was already covered at this question on SO. The plugin directory needs to have the exact same name as the symbol that is passed to Redmine::Plugin.register. In the case of this plugin: redmine_my_widgets. Changing the directory name will fix the 404.
On the other hand, the plugin was not updated for a long time and it is very likely, that most, if not all of the widgets, will no longer work because of changes to Redmine's internals.

Grails using a package to hold domain classes

Grails question: Confused about using a package to hold domain classes.
I'm using Netbeans on Mac to check out Grails.
When I create domain classes without using a package holding it, I can just go to localhost:8080/gTunes and the expected .gsp page is rendered properly.
However when I use a package (com.g2one.gtunes) to hold a domain class (Song), I don't see the .gsp page when I go to localhost:8080/gTunes. Instead I see a Directory view of folders/files such as META-INF, WEB-INF, etc. In order to see the expected .gsp page, I have to type in the specific URL localhost:8080/gTunes/index.gsp
In my research I've seen people talk about adding the following line but I can't figure out where to add it.
<%#page import="path.to.domains.*"%>
Any help is appreciated.
Thank you.
You need to add that import to the top of your GSP pages that use the domain class that you put in a package. Don't forget you'll also need an import in your controllers unless that are in the same package.
Add the specified line as the very first line in the GSP you are trying to render (show).
Figured out why I way I was having this issue. I'm going through Definitive Guide to Grails 2nd Edt on mac with NetBeans. I ran into this problem when I
created 'gtunes' project at /Users/name/NetBeans/gtunes
deleted 'gtunes' project and /Users/name/NetBeans/gtunes
created another project with same name at /Users/name/NetBeans/gtunes. I type in some code and run it and I run into the error I posted.
To get around this error,
I create 'gtunes' project located at /Users/name/NetBeans/gtunes
I right click on 'gtunes' project in NetBeans, issue 'Clean' command. Than I see some files are removed from ~/.grails/... in Output window
I right click on Album.groovy (possibly Song.groovy also) and issue 'Generate Views', NOT 'Generate All'
Run the project and it works!
Thanks all for comments and hopefully my mistake will help others avoid same mistake.

Resources