mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
parent
fbb3047195
commit
4d7fd2f5ba
@ -87,10 +87,12 @@
|
||||
$(".terms-editor").each(function () {
|
||||
var selectedTerms = $(this).data("selected-terms");
|
||||
|
||||
var autocompleteUrl = $(this).data("autocomplete-url");
|
||||
|
||||
var $tagit = $("> ul", this).tagit({
|
||||
tagSource: function (request, response) {
|
||||
var termsEditor = $(this.element).parents(".terms-editor");
|
||||
$.getJSON("/api/taxonomies/tags", { taxonomyId: termsEditor.data("taxonomy-id"), leavesOnly: termsEditor.data("leaves-only"), query: request.term }, function (data, status, xhr) {
|
||||
$.getJSON(autocompleteUrl, { taxonomyId: termsEditor.data("taxonomy-id"), leavesOnly: termsEditor.data("leaves-only"), query: request.term }, function (data, status, xhr) {
|
||||
response(data);
|
||||
});
|
||||
},
|
||||
|
@ -33,7 +33,7 @@
|
||||
<fieldset class="taxonomy-wrapper" data-name-prefix="@Html.FieldNameFor(m => m)" data-id-prefix="@Html.FieldIdFor(m => m)">
|
||||
<label @if(Model.Settings.Required) { <text>class="required"</text> }>@Model.DisplayName</label>
|
||||
@if (Model.Settings.Autocomplete) {
|
||||
<div class="terms-editor text text-medium" data-taxonomy-id="@Model.TaxonomyId" data-leaves-only="@Model.Settings.LeavesOnly" data-selected-terms="@selectedTerms" data-allow-new-terms="@Model.Settings.AllowCustomTerms.ToString().ToLower()" data-singlechoice="@Model.Settings.SingleChoice.ToString().ToLower()">
|
||||
<div class="terms-editor text text-medium" data-autocomplete-url="@Url.HttpRouteUrl("", new { area = "Orchard.Taxonomies", controller = "Tags" })" data-taxonomy-id="@Model.TaxonomyId" data-leaves-only="@Model.Settings.LeavesOnly" data-selected-terms="@selectedTerms" data-allow-new-terms="@Model.Settings.AllowCustomTerms.ToString().ToLower()" data-singlechoice="@Model.Settings.SingleChoice.ToString().ToLower()">
|
||||
<ul></ul>
|
||||
@if (Model.Settings.SingleChoice) {
|
||||
<div class="hint">@T("Enter a single term. Hit <i>tab</i> or <i>enter</i> to apply the term.") @if (!Model.Settings.AllowCustomTerms) { <text>@T("This taxonomy does not allow you to create new terms.") </text> }</div>
|
||||
|
Loading…
Reference in New Issue
Block a user