Quantcast

Permission to publish a plugin

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Permission to publish a plugin

lmivan
Hello, 

I have created a plugin to generate unique slugs when saving or updating domain objects. With this plugin you can use this slug to generate "nice" urls instead of accesing with the id. 

For example, you can access the a user profile with www.domain.com/user/ivan-lopez (in case the user name is Iván López) instead of the "ugly" url with the id: www.domain.com/user/25 

My grails.org username is lmivan (starts with a lowercase L) 
The plugin is available at https://github.com/lmivan/grails-slug-generator and the plugin name is slug-generator. 

Thanks and regards, Iván. 
--
El Blog de Iván López - http://lopezivan.blogspot.com
Twitter - http://www.twitter.com/ilopmar

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Permission to publish a plugin

pledbrook
Hi Iván,

> I have created a plugin to generate unique slugs when saving or updating
> domain objects. With this plugin you can use this slug to generate "nice"
> urls instead of accesing with the id.
>
> For example, you can access the a user profile with
> www.domain.com/user/ivan-lopez (in case the user name is Iván López) instead
> of the "ugly" url with the id: www.domain.com/user/25
>
> My grails.org username is lmivan (starts with a lowercase L)
> The plugin is available at https://github.com/lmivan/grails-slug-generator
> and the plugin name is slug-generator.

Looks interesting. One question: why does the generateSlug() method
accept a class and two strings? I don't yet see the value in that.

And a small suggestion: in the README, have 'Check out the tests' link
to the test case on GitHub.

Regards,

Peter

--
Peter Ledbrook
Grails Advocate
SpringSource - A Division of VMware

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Permission to publish a plugin

pledbrook
>> My grails.org username is lmivan (starts with a lowercase L)
>> The plugin is available at https://github.com/lmivan/grails-slug-generator
>> and the plugin name is slug-generator.
>
> Looks interesting. One question: why does the generateSlug() method
> accept a class and two strings? I don't yet see the value in that.
>
> And a small suggestion: in the README, have 'Check out the tests' link
> to the test case on GitHub.

Oh, and please update the 'documentation' and 'scm' properties in
SlugGeneratorGrailsPlugin.groovy.

Thanks,

Peter

--
Peter Ledbrook
Grails Advocate
SpringSource - A Division of VMware

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Permission to publish a plugin

lmivan
Hi Peter,

Looks interesting. One question: why does the generateSlug() method 
accept a class and two strings? I don't yet see the value in that. 

The method accepts a domain class, a property name and a value. 

It generates a slug from the value and looks for it in the property of the domain class. If the value already exists adds a counter an tries again until no value is returned.

As you can see in the Usage section of the documentation (https://github.com/lmivan/grails-slug-generator#usage) I have an User domain class and two properties, the name of the user and the slug used to generate his profile url. When you configure the beforeInsert and beforeUpdate methods to update the slug property and create a new user:

def user = new User(name:"Iván López").save()

The plugin generates an initial slug for the value: Iván López is converted to ivan-lopez and find this value in the property slug (User.findBySlug). If it doesn't exist this will be the slug for this user. If it exists the new slug will be ivan-lopez-1 and again we find the value until the slug doesn't exists.

I need this three parameters: domain class, property and initial value to achieve this behaviour.

Regards, Iván.

P.S: Readme and SlugGeneratorGrailsPlugin.groovy files updated.

 
--
El Blog de Iván López - http://lopezivan.blogspot.com
Twitter - http://www.twitter.com/ilopmar



On Mon, Jul 30, 2012 at 6:45 PM, pledbrook [via Grails] <[hidden email]> wrote:
>> My grails.org username is lmivan (starts with a lowercase L)
>> The plugin is available at https://github.com/lmivan/grails-slug-generator
>> and the plugin name is slug-generator.
>
> Looks interesting. One question: why does the generateSlug() method
> accept a class and two strings? I don't yet see the value in that.
>
> And a small suggestion: in the README, have 'Check out the tests' link
> to the test case on GitHub.

Oh, and please update the 'documentation' and 'scm' properties in
SlugGeneratorGrailsPlugin.groovy.

Thanks,

Peter

--
Peter Ledbrook
Grails Advocate
SpringSource - A Division of VMware

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





If you reply to this email, your message will be added to the discussion below:
http://grails.1312388.n4.nabble.com/Permission-to-publish-a-plugin-tp4632386p4632419.html
To unsubscribe from Grails, click here.
NAML

Loading...