|
2 | 2 |
|
3 | 3 | @{ |
4 | 4 | Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml"; |
5 | | - var rootTopicKey = Model.AttributeDescriptor.RootTopic?.UniqueKey.Replace(":", "/") ?? Model.AttributeDescriptor.RootTopicKey?.Replace(":", "/") ?? "Root"; |
| 5 | + |
| 6 | + var descriptor = Model.AttributeDescriptor; |
| 7 | + var rootTopicKey = descriptor.RootTopic?.UniqueKey.Replace(":", "/")?? descriptor.RootTopicKey?.Replace(":", "/") ?? "Root"; |
| 8 | + |
6 | 9 | } |
7 | 10 |
|
8 | 11 | <div> |
9 | 12 | <input |
10 | | - asp-for ="Value" |
11 | | - class ="@Model.AttributeDescriptor.CssClass" |
12 | | - disabled =@(!Model.AttributeDescriptor.IsEnabled) |
13 | | - required =@Model.AttributeDescriptor.IsRequired |
| 13 | + asp-for ="Value" |
| 14 | + class ="@descriptor.CssClass" |
| 15 | + disabled =@(!descriptor.IsEnabled) |
| 16 | + required =@descriptor.IsRequired |
14 | 17 | /> |
15 | 18 | </div> |
16 | 19 |
|
17 | 20 | <script> |
18 | 21 | $(function() { |
19 | 22 |
|
20 | 23 | //Create new instance of TokenizedTopics and set relevant properties |
21 | | - var tokenizedTopics = new TokenizedTopics(); |
22 | | - tokenizedTopics.selector = '#@Html.IdFor(m => m.Value)'; |
23 | | - tokenizedTopics.scope = '@rootTopicKey'; |
24 | | - tokenizedTopics.attributeName = '@Model.AttributeDescriptor.AttributeKey'; |
25 | | - tokenizedTopics.attributeValue = '@Model.AttributeDescriptor.AttributeValue'; |
26 | | - tokenizedTopics.resultLimit = '@Model.AttributeDescriptor.ResultLimit'; |
27 | | - tokenizedTopics.tokenLimit = @Model.AttributeDescriptor.TokenLimit; |
28 | | - tokenizedTopics.isAutoPostBack = @((Model.AttributeDescriptor.AutoPostBack?? false).ToString().ToLower()); |
29 | | - tokenizedTopics.selectedTopics = @Html.Raw(Model.SelectedTopics); |
| 24 | + var topics = new TokenizedTopics(); |
| 25 | + topics.selector = '#@Html.IdFor(m => m.Value)'; |
| 26 | + topics.scope = '@rootTopicKey'; |
| 27 | + topics.attributeName = '@descriptor.AttributeKey'; |
| 28 | + topics.attributeValue = '@descriptor.AttributeValue'; |
| 29 | + topics.resultLimit = '@descriptor.ResultLimit'; |
| 30 | + topics.tokenLimit = @descriptor.TokenLimit; |
| 31 | + topics.isAutoPostBack = @((descriptor.AutoPostBack?? false).ToString().ToLower()); |
| 32 | + topics.selectedTopics = @Html.Raw(Model.SelectedTopics); |
30 | 33 |
|
31 | 34 | //Fire TokenizedTopics.prototype.getTokenizedTopics() (and $([selector]).tokenInput()) |
32 | | - tokenizedTopics.getTokenizedTopics(); |
| 35 | + topics.getTokenizedTopics(); |
33 | 36 |
|
34 | 37 | }); |
35 | 38 |
|
|
0 commit comments