bug in Taxonomies Module?

Topics: Troubleshooting
Jun 7, 2013 at 3:51 PM
when I add a field to my content type,I choose field type as "Taxonomie Field",and I
input Display Name as "my DisplayName",Technical Name as "TechName". when I save the content type and add the new content type ,I got the Field Name as "Tech Name",not the
Display Name as I input as "my DisplayName“,so, what's wrong ? how to fixed the problem?
Developer
Jun 7, 2013 at 6:31 PM
Make sure that you first enter the Technical name, then the Display name. Entering a Display Name will override anything currently in the Display Name field.
Jun 8, 2013 at 1:51 AM
Edited Jun 8, 2013 at 1:54 AM
sfmskywalker wrote:
Make sure that you first enter the Technical name, then the Display name. Entering a Display Name will override anything currently in the Display Name field.
I try as you said,but it doesn't work. maybe can you try as I said,then you'll understand what my meaning. and the other field like DateTimeField and ImageField doesn't have the same problem.
Developer
Jun 8, 2013 at 7:24 PM
Which Orchard version are you using?
Jun 9, 2013 at 1:28 AM
Edited Jun 9, 2013 at 2:42 AM
I use the source code orchard_976a43e9cb2e,And I tried in orchard1.6,the same problem exists
Jun 13, 2013 at 1:51 AM
the bug in Taxomomies that dispyName not show but the Tech Name show is in admin status, not the view status, and I want in admin status,the same as in the view
status,because the admin dashboard will be show to some user. how to fixed the problem?
Jun 13, 2013 at 8:28 AM
I have resolve the problem by change some code in Orchard.Taxonomies module
first I change the TaxonomyFieldViewModel.cs ,
as:
 public class TaxonomyFieldViewModel {
        public int TaxonomyId { get; set; }
        public string Name { get; set; }
        public TaxonomyFieldSettings Settings { get; set; }
        public IList<TermEntry> Terms { get; set; }
        public int SingleTermId { get; set; }

        //my  added field
        public Fields.TaxonomyField TaxonomyField { get; set; }
       
       
    }
then ,I change the TaxonomyFieldDriver.cs,
    protected override DriverResult Editor(ContentPart part, TaxonomyField field, dynamic shapeHelper) {
            return ContentShape("Fields_TaxonomyField_Edit", GetDifferentiator(field, part), () => {
                var settings = field.PartFieldDefinition.Settings.GetModel<TaxonomyFieldSettings>();
                var appliedTerms = _taxonomyService.GetTermsForContentItem(part.ContentItem.Id, field.Name).Distinct(new TermPartComparer()).ToDictionary(t => t.Id, t => t);
                var taxonomy = _taxonomyService.GetTaxonomyByName(settings.Taxonomy);
                var terms = taxonomy != null
                    ? _taxonomyService.GetTerms(taxonomy.Id).Where(t => !string.IsNullOrWhiteSpace(t.Name)).Select(t => t.CreateTermEntry()).ToList()
                    : new List<TermEntry>(0);

                terms.ForEach(t => t.IsChecked = appliedTerms.ContainsKey(t.Id));

                var viewModel = new TaxonomyFieldViewModel
                {
                    Name = field.Name,
                    Terms = terms,
                    Settings = settings,
                    SingleTermId = terms.Where(t => t.IsChecked).Select(t => t.Id).FirstOrDefault(),
                    TaxonomyId = taxonomy != null ? taxonomy.Id : 0,
                    //my add code
                     TaxonomyField=field
                };
third ,I change the EditorTemplates/TaxonomyField.cshtml,
as :
@* <legend @if(settings.Required) { <text>class="required"</text> }>@Model.Name.CamelFriendly()</legend>*@

      <legend @if(settings.Required) { <text>class="required"</text> }>@Model.TaxonomyField.DisplayName</legend>
then It worked! hope the author can change Orchard.Taxonomies in the next version. thanks!
Coordinator
Jun 15, 2013 at 7:30 AM
Would be even better as a pull request, as it would let us comment on the changes, you would not have to add comments to point changes, and also to merge it in the code.