#20039, 20040: When adding a Taxonomy Field to a Content Type, the DisplayName is not used in the Editor Templates.

Taxonomy field does not show as mandatory in edit mode

Work Items: 20039, 20040
This commit is contained in:
Jimasp 2013-08-30 11:30:08 +02:00 committed by agriffard
parent e9e5d1f49e
commit 83653814c4
6 changed files with 10 additions and 8 deletions

View File

@ -66,8 +66,8 @@ namespace Orchard.Taxonomies.Drivers {
terms.ForEach(t => t.IsChecked = appliedTerms.ContainsKey(t.Id));
var viewModel = new TaxonomyFieldViewModel
{
var viewModel = new TaxonomyFieldViewModel {
DisplayName = field.DisplayName,
Name = field.Name,
Terms = terms,
Settings = settings,

View File

@ -1,6 +1,6 @@
<Placement>
<!-- Location of field edition -->
<Place Fields_TaxonomyField_Edit="Content:19"/>
<Place Fields_TaxonomyField_Edit="Content:9"/>
<!-- Display terms in front-end summaries -->
<Match DisplayType="Summary">

View File

@ -5,6 +5,7 @@ namespace Orchard.Taxonomies.ViewModels {
public class TaxonomyFieldViewModel {
public int TaxonomyId { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public TaxonomyFieldSettings Settings { get; set; }
public IList<TermEntry> Terms { get; set; }
public int SingleTermId { get; set; }

View File

@ -28,7 +28,7 @@
var selectedTerms = string.Join(",", Model.Terms.Where(x => x.IsChecked).Select(x => string.Format("{0}\t{1}", x.Name, x.Id)));
}
<fieldset class="taxonomy-wrapper" data-name-prefix="@Html.FieldNameFor(m => m)" data-id-prefix="@Html.FieldIdFor(m => m)">
<legend>@Model.Name.CamelFriendly()</legend>
<legend @if(Model.Settings.Required) { <text>class="required"</text> }>@Model.DisplayName.CamelFriendly()</legend>
@if (Model.Settings.Autocomplete) {
<div class="terms-editor" data-all-terms="@allTerms" data-selected-terms="@selectedTerms" data-allow-new-terms="@Model.Settings.AllowCustomTerms.ToString().ToLower()" data-singlechoice="@Model.Settings.SingleChoice.ToString().ToLower()">
<ul></ul>
@ -67,7 +67,7 @@
@if (!Model.Terms.Any()) {
<div class="no-terms">
@T("There are no terms defined for {0} yet.", Model.Name.CamelFriendly())
@T("There are no terms defined for {0} yet.", Model.DisplayName.CamelFriendly())
<a href="@Url.Action("Index", "TermAdmin", new { taxonomyId = Model.TaxonomyId, area = "Orchard.Taxonomies" })">@T("Create some terms")</a>
</div>
}

View File

@ -12,7 +12,7 @@
}
<fieldset class="taxonomy-wrapper" data-name-prefix="@Html.FieldNameFor(m => m)" data-id-prefix="@Html.FieldIdFor(m => m)">
<legend @if(settings.Required) { <text>class="required"</text> }>@Model.Name.CamelFriendly()</legend>
<legend @if(settings.Required) { <text>class="required"</text> }>@Model.DisplayName.CamelFriendly()</legend>
<div class="expando">
@if (!String.IsNullOrWhiteSpace(Model.Settings.Hint))
@ -43,7 +43,7 @@
@if (!Model.Terms.Any()) {
<div class="no-terms">
@T("There are no terms defined for {0} yet.", Model.Name.CamelFriendly())
@T("There are no terms defined for {0} yet.", Model.DisplayName.CamelFriendly())
<a href="@Url.Action("Index", "TermAdmin", new { taxonomyId = Model.TaxonomyId, area = "Orchard.Taxonomies" })">@T("Create some terms")</a>
</div>
}

View File

@ -562,7 +562,8 @@ legend { font-size: 1.231em; font-weight: normal; border:none;}
fieldset { padding:6px 0 0; margin:0 0 12px 0; border: 0px solid #dbdbdb; }
label { font-weight:normal; display:block; padding: 0 0 0.3em 0; }
label.forcheckbox { margin:0 0 0 .4em; display:inline; }
label.required:after {margin-left: 1ex; content: "*"; color: red; }
label.required:after {margin-left: 1ex; content: "*"; color: red; }
legend.required:after {margin-left: 1ex; content: "*"; color: red; }
form.inline, form.inline fieldset { /* todo: (heskew) need something other than .inline ... */
display:inline;