Patch #9225

Generate project identifier automatically with JavaScript

Added by Jan from Planio www.plan.io about 6 years ago. Updated almost 5 years ago.

Status:ClosedStart date:2011-09-11
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:UI
Target version:2.3.0

Description

At Planio Redmine Hosting, we found that a considerable number of first-time users got stuck while creating their first project. The reason: the project identifier. As it is now, it's not clear what it is for and quite a few of our users tried identifiers starting with a number which yields a validation error that is not specific enough to help them understand that it actually has to start with an a-z character.

This patch attempts to solve the issue by two small improvements:

  1. automatically generate the identifier while the name is typed in
  2. let the user know that the identifier must start with a lower case letter

Appreciate your comments and would love to see this making it into the core - I think it will improve the first time Redmine experience.

changeset_rea7e9f7e100db9e5ffda644296b543802039f503.diff Magnifier (6.54 KB) Jan from Planio www.plan.io, 2011-09-11 18:01

generate_project_identifier_automatically_with_javascript.diff Magnifier (13 KB) Jan from Planio www.plan.io, 2011-09-21 13:01


Related issues

Related to Redmine - Feature #1458: Project identifier generation rule Closed 2008-06-16
Related to Redmine - Defect #15950: Project identifier instructions still too ambiguous Closed
Related to Redmine - Defect #27101: Project identifier model constraint doesn't match with te... New

Associated revisions

Revision 11129
Added by Jean-Philippe Lang almost 5 years ago

Generate project identifier automatically with JavaScript (#9225).

Based on Jan Schulz-Hofen's patch.

Revision 11130
Added by Jean-Philippe Lang almost 5 years ago

More specific message for project identifier (#9225).

Revision 11132
Added by Toshi MARUYAMA almost 5 years ago

More specific message for project identifier in Japanese (#9225)

Revision 11195
Added by Jean-Philippe Lang almost 5 years ago

Underscores are allowed in project identifiers (#9225).

History

#1 Updated by Terence Mill about 6 years ago

+1

#2 Updated by Etienne Massip about 6 years ago

There is already a legend (edit: caption?) under the input box that tells Length between 1 and 100 characters. Only lower case letters (a-z), numbers and dashes are allowed?

Why not add an 'auto-generate' AJAX button?

#3 Updated by Jean-Baptiste Barth about 6 years ago

  • Target version set to Candidate for next major release

I personnaly love the "non-intrusive" approach, it would be a really cool addition in the next major release.

Jan: isn't there any standard function to replace special characters in Prototype ? I don't do much Prototype these days...

#4 Updated by Etienne Massip about 6 years ago

I already have an identifier for my project when I create a project in RM, so I should have to remove the proposed id in order to insert mine. What's the point with proposing a name to beginners when you can just check Generate sequential project identifiers in administration?

Also, if you have 2 projects with same generated id (even if I admit that this is very unlikely), you'll need to check DB to append a serial to the name, like my_project2 or whatsoever, thus the need for an AJAX call.

#5 Updated by Jean-Baptiste Barth about 6 years ago

Etienne Massip wrote:

I already have an identifier for my project when I create a project in RM, so I should have to remove the proposed id in order to insert mine.

Not if you fill the identifier first, but well, maybe it could be just a "fallback" identifier (in a hidden field) if you don't fill any identifier before submitting ?

What's the point with proposing a name to beginners when you can just check Generate sequential project identifiers in administration?

Actually, beginners don't know this option, and they don't understand what to put in the "identifier" field. I also have an internal SaaS Redmine hosting and I can say the same thing as Jan, it's a bit confusing new users...

Also, if you have 2 projects with same generated id (even if I admit that this is very unlikely), you'll need to check DB to append a serial to the name, like my_project2 or whatsoever, thus the need for an AJAX call.

It would be too complicated for something "very unlikely", imho.

Tell me what you think about this :
  1. we don't fill project identifier automatically
  2. on form submission, if no project identifier is set, it's auto-generated with Jan's script
  3. there is not step 3

It has a drawback, it could be confusing too because Redmine would do a bit of magick behind the scenes. If we adopt this approach, the fallback identifier could well be generated server-side, not sure what's the best option.

A third option would be to propose the identifier in an alert box before submitting.

#6 Updated by Jan from Planio www.plan.io about 6 years ago

Jean-Baptiste:

Jan: isn't there any standard function to replace special characters in Prototype ? I don't do much Prototype these days...

Holger over at Chili has proposed this: http://lehelk.com/2011/05/06/script-to-remove-diacritics/

Etienne:

What's the point with proposing a name to beginners when you can just check Generate sequential project identifiers in administration?

I strongly agree with Jean-Baptiste: first timers never find this.

Also, if you have 2 projects with same generated id (even if I admit that this is very unlikely), you'll need to check DB to append a serial to the name, like my_project2 or whatsoever, thus the need for an AJAX call.

Should you chose a name that generates the same identifier it will most likely be the same name as another project. Simply for that reason, validation will jump in. For those rare cases, I'd say we don't need ajax here. If we had Ajax, it would only be used to add a "2" or something at the end which usually looks ugly and would (without explanation) prompt users to remove it yielding the same validation problem.

Jean-Baptiste:

Tell me what you think about this :

  1. we don't fill project identifier automatically
  2. on form submission, if no project identifier is set, it's auto-generated with Jan's script

I think that's even more confusing, especially since the identifier cannot be changed afterwards. As they end up in almost every link to project items, that could be an unfortunate situation for some (I have had this feedback).

Actually, I like my initial approach much better:

  • while you type a name, the identifier gets filled in in real time, so you will definitely notice it
  • if you chose to set/change the identifier yourself, changing the name afterwards will not update the identifier, so it is non-intrusive

After all, our approach was modeled a bit after how Wordpress does it with permalinks. And: If they do it, can it be wrong? :-D

#7 Updated by Etienne Massip about 6 years ago

Jan from Planio www.plan.io wrote:

Etienne:

What's the point with proposing a name to beginners when you can just check Generate sequential project identifiers in administration?

I strongly agree with Jean-Baptiste: first timers never find this.

Of course, since this is an Administration option, but Systems integrator/Administrator knows well this option and he will check it since he also knows that its Project managers are mostly newcomers.

Also, if you have 2 projects with same generated id (even if I admit that this is very unlikely), you'll need to check DB to append a serial to the name, like my_project2 or whatsoever, thus the need for an AJAX call.

What about:
  • changing administration option Generate sequential project identifiers to By default, generate project identifiers
  • adding a checkbox Generate project identifier in the project creation screen which default state is set according to above administration option
  • unchecking the checkbox will enable and empty the Identifier input box, thus allowing you to input your own project id
  • if checked, identifier will be generated (being generated from project name can be another administration option) after validation (as it is now) so we can be sure that it is not a (unlikely but still possible) duplicate.

So, beginners don't have to worry about finding a project identifier and people like me will quickly uncheck the checkbox and input their own?

#8 Updated by Etienne Massip about 6 years ago

I feel like you didn't like this idea :D

#9 Updated by Jan from Planio www.plan.io about 6 years ago

sorry for the delay - I understand the general concern you have about generating sequential identifiers. I have uploaded a new patch which - in my opinion - solves your problem without adding more complexity to the settings. the simple change is:

should the identifier field already be filled (with the auto-generated value e.g.), entering a name will not override it.

on a sidenote, I have also included Holgers hint about diacritics.

#10 Updated by Terence Mill almost 5 years ago

I thinh tjis i overruled by actual implentation and useless so far

#11 Updated by Daniel Felix almost 5 years ago

Terence Mill wrote:

I thinh tjis i overruled by actual implentation and useless so far

Well, I don't think so. As I see, the identifier is still some input field. This patch would be good for newcomer. Maybe this is just my opinion. But each thing, which mades a system more intuitive, is a good thing. ;-)

#12 Updated by Jean-Philippe Lang almost 5 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version changed from Candidate for next major release to 2.3.0
Patch committed in r11129 with a few changes:
  • moved the js code to a separate script
  • ported it to JQuery
  • removed global variables

Thanks.

#13 Updated by Go MAEDA almost 3 years ago

  • Related to Defect #15950: Project identifier instructions still too ambiguous added

#14 Updated by Mischa The Evil about 1 month ago

  • Related to Defect #27101: Project identifier model constraint doesn't match with text_project_identifier_info and JS-generated identifiers added

Also available in: Atom PDF