Permalink
Browse files

The singular form of group name is now used in the create / edit field

name suggestions. So if we have a group named "Image Assets" and label a
new field "File", MF would suggest "image_asset_file" rather than
"image_assets_file".
  • Loading branch information...
1 parent aca586d commit c950882987433cc9795678bff7b7386f8ce70e5b @traversal traversal committed Oct 1, 2010
Showing with 6 additions and 3 deletions.
  1. +2 −1 RCCWP_CreateCustomFieldPage.php
  2. +2 −1 RCCWP_CustomFieldPage.php
  3. +1 −1 js/options.js
  4. +1 −0 tools/inflect.php
@@ -20,7 +20,8 @@ function Main()
var mf_group_info = {
'name' : '<?php echo stripslashes($group->name) ?>',
- 'safe_name' : '<?php echo sanitize_title_with_dashes($group->name) ?>'
+ 'safe_name' : '<?php echo sanitize_title_with_dashes($group->name) ?>',
+ 'singular_safe_name' : '<?php echo sanitize_title_with_dashes(Inflect::singularize($group->name)) ?>'
};
</script>
@@ -20,7 +20,8 @@ function Edit(){
var mf_group_info = {
'name' : '<?php echo stripslashes($group->name) ?>',
- 'safe_name' : '<?php echo sanitize_title_with_dashes($group->name) ?>'
+ 'safe_name' : '<?php echo sanitize_title_with_dashes($group->name) ?>',
+ 'singular_safe_name' : '<?php echo sanitize_title_with_dashes(Inflect::singularize($group->name)) ?>'
};
</script>
View
@@ -49,7 +49,7 @@ jQuery(document).ready(function(){
var nv = jQuery.slug(desc, { sep: "_" });
if (mf_group_info && mf_group_info.safe_name && mf_group_info.safe_name != "" && mf_group_info.safe_name != "__default") {
- var prefix = jQuery.slug(mf_group_info.safe_name, { sep: "_" });
+ var prefix = jQuery.slug(mf_group_info.singular_safe_name, { sep: "_" });
if (prefix != "" && prefix != "_") {
nv = prefix + "_" + nv;
View
@@ -96,6 +96,7 @@
);
$Inflect_Uncountable = array(
+ 'details',
'people',
'sheep',
'fish',

0 comments on commit c950882

Please sign in to comment.