mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19845: Removing obsoleted Term Widget from taxonomies
Work Item: 19845 --HG-- branch : 1.x
This commit is contained in:
@@ -1,166 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
using Orchard.Taxonomies.Models;
|
|
||||||
using Orchard.Taxonomies.Services;
|
|
||||||
using Orchard.Taxonomies.ViewModels;
|
|
||||||
using Orchard.ContentManagement;
|
|
||||||
using Orchard.ContentManagement.Drivers;
|
|
||||||
using Orchard.ContentManagement.Handlers;
|
|
||||||
using Orchard.ContentManagement.MetaData;
|
|
||||||
using Orchard.Core.Common.Models;
|
|
||||||
using Orchard.Localization;
|
|
||||||
|
|
||||||
namespace Orchard.Taxonomies.Drivers {
|
|
||||||
public class TermWidgetPartDriver : ContentPartDriver<TermWidgetPart> {
|
|
||||||
private readonly IContentManager _contentManager;
|
|
||||||
private readonly ITaxonomyService _taxonomyService;
|
|
||||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
|
||||||
|
|
||||||
public TermWidgetPartDriver(
|
|
||||||
IContentManager contentManager,
|
|
||||||
ITaxonomyService taxonomyService,
|
|
||||||
IContentDefinitionManager contentDefinitionManager) {
|
|
||||||
_contentManager = contentManager;
|
|
||||||
_taxonomyService = taxonomyService;
|
|
||||||
_contentDefinitionManager = contentDefinitionManager;
|
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Localizer T { get; set; }
|
|
||||||
|
|
||||||
protected override DriverResult Display(TermWidgetPart part, string displayType, dynamic shapeHelper) {
|
|
||||||
return ContentShape("Parts_TermWidget_List",
|
|
||||||
() => {
|
|
||||||
var termPart = _taxonomyService.GetTerm(part.TermPartRecord.Id);
|
|
||||||
var query = _taxonomyService.GetContentItemsQuery(termPart, part.FieldName);
|
|
||||||
|
|
||||||
Expression<Func<CommonPartRecord, DateTime?>> orderBy = d => d.CreatedUtc;
|
|
||||||
switch(part.OrderBy) {
|
|
||||||
case "Created": orderBy = d => d.CreatedUtc; break;
|
|
||||||
case "Published": orderBy = d => d.PublishedUtc; break;
|
|
||||||
case "Modified": orderBy = d => d.ModifiedUtc; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var results = query.Join<CommonPartRecord>().OrderByDescending(orderBy);
|
|
||||||
|
|
||||||
if(!String.IsNullOrWhiteSpace(part.ContentType)) {
|
|
||||||
results = results.ForType(part.ContentType).Join<CommonPartRecord>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// build the Summary display for each content item
|
|
||||||
var list = shapeHelper.List();
|
|
||||||
list.AddRange(
|
|
||||||
results
|
|
||||||
.Slice(0, part.Count)
|
|
||||||
.ToList()
|
|
||||||
.Select( tp => _contentManager.BuildDisplay(tp.ContentItem, "Summary"))
|
|
||||||
);
|
|
||||||
|
|
||||||
return shapeHelper.Parts_TermWidget_List(ContentPart: part, ContentItems: list);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DriverResult Editor(TermWidgetPart part, dynamic shapeHelper) {
|
|
||||||
return Editor(part, null, shapeHelper);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DriverResult Editor(TermWidgetPart part, IUpdateModel updater, dynamic shapeHelper) {
|
|
||||||
var viewModel = new TermWidgetViewModel {
|
|
||||||
Part = part,
|
|
||||||
ContentTypeNames = GetContentTypes(),
|
|
||||||
Count = part.Count,
|
|
||||||
FieldName = part.FieldName,
|
|
||||||
OrderBy = part.OrderBy,
|
|
||||||
SelectedTaxonomyId = part.TaxonomyPartRecord != null ? part.TaxonomyPartRecord.Id : -1,
|
|
||||||
SelectedTermId = part.TermPartRecord != null ? part.TermPartRecord.Id : -1
|
|
||||||
};
|
|
||||||
|
|
||||||
if(updater != null) {
|
|
||||||
if (updater.TryUpdateModel(viewModel, Prefix, null, null)) {
|
|
||||||
var selectedTerm = _taxonomyService.GetTerm(viewModel.SelectedTermId);
|
|
||||||
|
|
||||||
// taxonomy to render
|
|
||||||
part.TaxonomyPartRecord = _taxonomyService.GetTaxonomy(viewModel.SelectedTaxonomyId).Record;
|
|
||||||
// root term (can be null)
|
|
||||||
part.TermPartRecord = selectedTerm == null ? null : selectedTerm.Record;
|
|
||||||
part.FieldName = viewModel.FieldName;
|
|
||||||
part.Count = viewModel.Count;
|
|
||||||
part.OrderBy = viewModel.OrderBy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var taxonomies = _taxonomyService.GetTaxonomies().ToList();
|
|
||||||
|
|
||||||
var listItems = taxonomies.Select(taxonomy => new SelectListItem {
|
|
||||||
Value = Convert.ToString(taxonomy.Id),
|
|
||||||
Text = taxonomy.Name,
|
|
||||||
Selected = taxonomy.Record == part.TaxonomyPartRecord,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
viewModel.AvailableTaxonomies = new SelectList(listItems, "Value", "Text", viewModel.SelectedTaxonomyId);
|
|
||||||
|
|
||||||
// if no taxonomy is selected, take the first available one as
|
|
||||||
// the terms drop down needs one by default
|
|
||||||
if (viewModel.SelectedTaxonomyId == -1) {
|
|
||||||
var firstTaxonomy = taxonomies.FirstOrDefault();
|
|
||||||
if (firstTaxonomy != null) {
|
|
||||||
viewModel.SelectedTaxonomyId = firstTaxonomy.Id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ContentShape("Parts_Taxonomy_TermWidget_Edit", () => shapeHelper.EditorTemplate(TemplateName: "Parts/Taxonomies.TermWidget", Model: viewModel, Prefix: Prefix));
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<string> GetContentTypes() {
|
|
||||||
return _contentDefinitionManager
|
|
||||||
.ListTypeDefinitions()
|
|
||||||
.Select(t => t.Name)
|
|
||||||
.OrderBy(x => x);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Importing(TermWidgetPart part, ImportContentContext context) {
|
|
||||||
// importing taxonomy
|
|
||||||
var taxonomyIdentity = context.Attribute(part.PartDefinition.Name, "TaxonomyId");
|
|
||||||
var taxonomy = context.GetItemFromSession(taxonomyIdentity);
|
|
||||||
|
|
||||||
if (taxonomy == null) {
|
|
||||||
throw new OrchardException(T("Unknown taxonomy: {0}", taxonomyIdentity));
|
|
||||||
}
|
|
||||||
|
|
||||||
part.TaxonomyPartRecord = taxonomy.As<TaxonomyPart>().Record;
|
|
||||||
|
|
||||||
//importing term
|
|
||||||
var termIdentity = context.Attribute(part.PartDefinition.Name, "TermId");
|
|
||||||
var term = context.GetItemFromSession(termIdentity);
|
|
||||||
|
|
||||||
part.TermPartRecord = term.As<TermPart>().Record;
|
|
||||||
|
|
||||||
if (term == null) {
|
|
||||||
throw new OrchardException(T("Unknown term: {0}", termIdentity));
|
|
||||||
}
|
|
||||||
|
|
||||||
// importing properties
|
|
||||||
part.FieldName = context.Attribute(part.PartDefinition.Name, "FieldName");
|
|
||||||
part.Count = Int32.Parse(context.Attribute(part.PartDefinition.Name, "Count"));
|
|
||||||
part.OrderBy = context.Attribute(part.PartDefinition.Name, "OrderBy");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Exporting(TermWidgetPart part, ExportContentContext context) {
|
|
||||||
context.Element(part.PartDefinition.Name).SetAttributeValue("FieldName", part.FieldName);
|
|
||||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Count", part.Count);
|
|
||||||
context.Element(part.PartDefinition.Name).SetAttributeValue("OrderBy", part.OrderBy);
|
|
||||||
|
|
||||||
var taxonomy = _contentManager.Get(part.TaxonomyPartRecord.Id);
|
|
||||||
var taxonomyIdentity = _contentManager.GetItemMetadata(taxonomy).Identity.ToString();
|
|
||||||
context.Element(part.PartDefinition.Name).SetAttributeValue("TaxonomyId", taxonomyIdentity);
|
|
||||||
|
|
||||||
var term = _contentManager.Get(part.TermPartRecord.Id);
|
|
||||||
var termIdentity = _contentManager.GetItemMetadata(term).Identity.ToString();
|
|
||||||
context.Element(part.PartDefinition.Name).SetAttributeValue("TermId", termIdentity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
using Orchard.Taxonomies.Models;
|
|
||||||
using Orchard.ContentManagement.Handlers;
|
|
||||||
using Orchard.Data;
|
|
||||||
|
|
||||||
namespace Orchard.Taxonomies.Handlers {
|
|
||||||
public class TermWidgetPartHandler : ContentHandler {
|
|
||||||
public TermWidgetPartHandler(IRepository<TermWidgetPartRecord> repository) {
|
|
||||||
Filters.Add(StorageFilter.For(repository));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -42,23 +42,6 @@ namespace Orchard.Taxonomies {
|
|||||||
.ContentPartRecord()
|
.ContentPartRecord()
|
||||||
);
|
);
|
||||||
|
|
||||||
SchemaBuilder.CreateTable("TermWidgetPartRecord", table => table
|
|
||||||
.ContentPartRecord()
|
|
||||||
.Column<int>("TaxonomyPartRecord_id")
|
|
||||||
.Column<int>("TermPartRecord_id")
|
|
||||||
.Column<int>("Count")
|
|
||||||
.Column<string>("OrderBy")
|
|
||||||
.Column<string>("FieldName")
|
|
||||||
.Column<string>("ContentType", c => c.Nullable())
|
|
||||||
);
|
|
||||||
|
|
||||||
ContentDefinitionManager.AlterTypeDefinition("TermWidget", cfg => cfg
|
|
||||||
.WithPart("TermWidgetPart")
|
|
||||||
.WithPart("CommonPart")
|
|
||||||
.WithPart("WidgetPart")
|
|
||||||
.WithSetting("Stereotype", "Widget")
|
|
||||||
);
|
|
||||||
|
|
||||||
ContentDefinitionManager.AlterTypeDefinition("TaxonomyNavigationMenuItem",
|
ContentDefinitionManager.AlterTypeDefinition("TaxonomyNavigationMenuItem",
|
||||||
cfg => cfg
|
cfg => cfg
|
||||||
.WithPart("TaxonomyNavigationPart")
|
.WithPart("TaxonomyNavigationPart")
|
||||||
|
@@ -1,41 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using Orchard.ContentManagement;
|
|
||||||
|
|
||||||
namespace Orchard.Taxonomies.Models {
|
|
||||||
public class TermWidgetPart : ContentPart<TermWidgetPartRecord> {
|
|
||||||
/// <summary>
|
|
||||||
/// The taxonomy to display
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
public TaxonomyPartRecord TaxonomyPartRecord {
|
|
||||||
get { return Record.TaxonomyPartRecord; }
|
|
||||||
set { Record.TaxonomyPartRecord = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public TermPartRecord TermPartRecord {
|
|
||||||
get { return Record.TermPartRecord; }
|
|
||||||
set { Record.TermPartRecord = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[Range(1, int.MaxValue)]
|
|
||||||
public int Count {
|
|
||||||
get { return Record.Count; }
|
|
||||||
set { Record.Count = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string OrderBy {
|
|
||||||
get { return Record.OrderBy; }
|
|
||||||
set { Record.OrderBy = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string FieldName {
|
|
||||||
get { return Record.FieldName; }
|
|
||||||
set { Record.FieldName = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ContentType {
|
|
||||||
get { return Record.ContentType; }
|
|
||||||
set { Record.ContentType = value; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
using Orchard.ContentManagement.Records;
|
|
||||||
|
|
||||||
namespace Orchard.Taxonomies.Models {
|
|
||||||
public class TermWidgetPartRecord : ContentPartRecord {
|
|
||||||
public TermWidgetPartRecord() {
|
|
||||||
Count = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual TaxonomyPartRecord TaxonomyPartRecord { get; set; }
|
|
||||||
public virtual TermPartRecord TermPartRecord { get; set; }
|
|
||||||
|
|
||||||
public virtual int Count { get; set; }
|
|
||||||
public virtual string OrderBy { get; set; }
|
|
||||||
|
|
||||||
public virtual string FieldName { get; set; }
|
|
||||||
public virtual string ContentType { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -71,10 +71,8 @@
|
|||||||
<Compile Include="Drivers\TaxonomyNavigationPartDriver.cs" />
|
<Compile Include="Drivers\TaxonomyNavigationPartDriver.cs" />
|
||||||
<Compile Include="Drivers\TermsPartDriver.cs" />
|
<Compile Include="Drivers\TermsPartDriver.cs" />
|
||||||
<Compile Include="Drivers\TaxonomyPartDriver.cs" />
|
<Compile Include="Drivers\TaxonomyPartDriver.cs" />
|
||||||
<Compile Include="Drivers\TermWidgetPartDriver.cs" />
|
|
||||||
<Compile Include="Handlers\TaxonomyPartHandler.cs" />
|
<Compile Include="Handlers\TaxonomyPartHandler.cs" />
|
||||||
<Compile Include="Handlers\TermsPartHandler.cs" />
|
<Compile Include="Handlers\TermsPartHandler.cs" />
|
||||||
<Compile Include="Handlers\TermWidgetPartHandler.cs" />
|
|
||||||
<Compile Include="Helpers\PathExtensions.cs" />
|
<Compile Include="Helpers\PathExtensions.cs" />
|
||||||
<Compile Include="Migrations.cs" />
|
<Compile Include="Migrations.cs" />
|
||||||
<Compile Include="Drivers\TermPartDriver.cs" />
|
<Compile Include="Drivers\TermPartDriver.cs" />
|
||||||
@@ -91,8 +89,6 @@
|
|||||||
<Compile Include="Models\TermContentItem.cs" />
|
<Compile Include="Models\TermContentItem.cs" />
|
||||||
<Compile Include="Models\TermsPart.cs" />
|
<Compile Include="Models\TermsPart.cs" />
|
||||||
<Compile Include="Models\TermsPartRecord.cs" />
|
<Compile Include="Models\TermsPartRecord.cs" />
|
||||||
<Compile Include="Models\TermWidgetPart.cs" />
|
|
||||||
<Compile Include="Models\TermWidgetPartRecord.cs" />
|
|
||||||
<Compile Include="Navigation\TaxonomyNavigationProvider.cs" />
|
<Compile Include="Navigation\TaxonomyNavigationProvider.cs" />
|
||||||
<Compile Include="Permissions.cs" />
|
<Compile Include="Permissions.cs" />
|
||||||
<Compile Include="Projections\TermsFilter.cs" />
|
<Compile Include="Projections\TermsFilter.cs" />
|
||||||
@@ -108,7 +104,6 @@
|
|||||||
<Compile Include="Tokens\TaxonomyTokens.cs" />
|
<Compile Include="Tokens\TaxonomyTokens.cs" />
|
||||||
<Compile Include="ViewModels\ImportViewModel.cs" />
|
<Compile Include="ViewModels\ImportViewModel.cs" />
|
||||||
<Compile Include="ViewModels\MergeTermViewModel.cs" />
|
<Compile Include="ViewModels\MergeTermViewModel.cs" />
|
||||||
<Compile Include="ViewModels\TermWidgetViewModel.cs" />
|
|
||||||
<Compile Include="ViewModels\MoveTermViewModel.cs" />
|
<Compile Include="ViewModels\MoveTermViewModel.cs" />
|
||||||
<Compile Include="ViewModels\SelectTermViewModel.cs" />
|
<Compile Include="ViewModels\SelectTermViewModel.cs" />
|
||||||
<Compile Include="ViewModels\TaxonomyFieldViewModel.cs" />
|
<Compile Include="ViewModels\TaxonomyFieldViewModel.cs" />
|
||||||
@@ -165,12 +160,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\TermAdmin\SelectTerm.cshtml" />
|
<Content Include="Views\TermAdmin\SelectTerm.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Views\EditorTemplates\Parts\Taxonomies.TermWidget.cshtml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Views\Parts\TermWidget.List.cshtml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="web.config" />
|
<Content Include="web.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -215,6 +204,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\EditorTemplates\Parts\Navigation.Taxonomy.Edit.cshtml" />
|
<Content Include="Views\EditorTemplates\Parts\Navigation.Taxonomy.Edit.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Views\Parts\" />
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
@@ -20,10 +20,6 @@
|
|||||||
<!-- Display in admin -->
|
<!-- Display in admin -->
|
||||||
<Place Parts_Taxonomies_Term_Fields="Content:2"/>
|
<Place Parts_Taxonomies_Term_Fields="Content:2"/>
|
||||||
|
|
||||||
<!-- Widget -->
|
|
||||||
<Place Parts_TermWidget_List="Content"/>
|
|
||||||
<Place Parts_Taxonomy_TermWidget_Edit ="Content:5" />
|
|
||||||
|
|
||||||
<!-- New Shapes -->
|
<!-- New Shapes -->
|
||||||
<Place Parts_TaxonomyPart="Content:5" />
|
<Place Parts_TaxonomyPart="Content:5" />
|
||||||
<Place Parts_TermPart="Content:5" />
|
<Place Parts_TermPart="Content:5" />
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
using Orchard.Taxonomies.Models;
|
|
||||||
|
|
||||||
namespace Orchard.Taxonomies.ViewModels {
|
|
||||||
public class TermWidgetViewModel {
|
|
||||||
public SelectList AvailableTaxonomies { get; set; }
|
|
||||||
|
|
||||||
[Required, Range(0, int.MaxValue, ErrorMessage = "You must select a taxonomy")]
|
|
||||||
public int SelectedTaxonomyId { get; set; }
|
|
||||||
|
|
||||||
[Required, Range(0, int.MaxValue, ErrorMessage = "You must select a term")]
|
|
||||||
public int SelectedTermId { get; set; }
|
|
||||||
|
|
||||||
public bool Ascending { get; set; }
|
|
||||||
[Required, Range(0, int.MaxValue)]
|
|
||||||
public int Count { get; set; }
|
|
||||||
public string FieldName { get; set; }
|
|
||||||
public string OrderBy { get; set; }
|
|
||||||
|
|
||||||
public TermWidgetPart Part { get; set; }
|
|
||||||
public IEnumerable<string> ContentTypeNames { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,75 +0,0 @@
|
|||||||
@model TermWidgetViewModel
|
|
||||||
@{
|
|
||||||
Script.Require("jQuery");
|
|
||||||
}
|
|
||||||
<fieldset>
|
|
||||||
@Html.LabelFor(m => m.SelectedTaxonomyId, T("Taxonomy"))
|
|
||||||
@Html.DropDownListFor(m => m.SelectedTaxonomyId, Model.AvailableTaxonomies)
|
|
||||||
<span class="hint">@T("Select a taxonomy.")</span>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
@Html.LabelFor(m => m.SelectedTermId, T("Term"))
|
|
||||||
<select id="@Html.FieldIdFor(m => m.SelectedTermId)" name="@Html.FieldNameFor(m => m.SelectedTermId)">
|
|
||||||
@Html.SelectOption(-1, false, T("- None -").ToString())
|
|
||||||
@{Html.RenderAction("RenderTermSelect", "TermAdmin", new { area = "Orchard.Taxonomies", taxonomyId = Model.SelectedTaxonomyId, selectedTermId = Model.SelectedTermId });}
|
|
||||||
</select>
|
|
||||||
<span class="hint">@T("Select the term whose content items will be displayed.")</span>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
@Html.LabelFor(m => m.FieldName, T("Field"))
|
|
||||||
@Html.TextBoxFor(m => m.FieldName, new { @class = "text" })
|
|
||||||
<span class="hint">@T("Optional. You can specify which field name to use if several terms references are defined on the same content type.")</span>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
@Html.LabelFor(m => m.Count, T("Number of items to display"))
|
|
||||||
@Html.TextBoxFor(m => m.Count, new { @class = "text-small"})
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<div>
|
|
||||||
@Html.LabelFor(m => m.OrderBy, T("Order By"))
|
|
||||||
<select id="@Html.FieldIdFor(m => m.OrderBy)" name="@Html.FieldNameFor(m => m.OrderBy)">
|
|
||||||
@Html.SelectOption(Model.OrderBy, "CreatedUtc", T("Recently created").ToString())
|
|
||||||
@Html.SelectOption(Model.OrderBy, "PublishedUtc", T("Recently published").ToString())
|
|
||||||
@Html.SelectOption(Model.OrderBy, "ModifiedUtc", T("Recently modified").ToString())
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<div>
|
|
||||||
@Html.LabelFor(m => m.Part.ContentType, T("Content Type"))
|
|
||||||
<select id="@Html.FieldIdFor(m => m.Part.ContentType)" name="@Html.FieldNameFor(m => m.Part.ContentType)">
|
|
||||||
@Html.SelectOption(Model.Part.ContentType, String.Empty, T("- Any -").Text)
|
|
||||||
@foreach(var contentType in Model.ContentTypeNames) {
|
|
||||||
@Html.SelectOption(Model.Part.ContentType, contentType, contentType)
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
<span class="hint">@T("Select which Content Type you want to display")</span>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
|
|
||||||
@using (Script.Foot()) {
|
|
||||||
<script type="text/javascript">
|
|
||||||
//<![CDATA[
|
|
||||||
$(function () {
|
|
||||||
$('#@Html.FieldIdFor(m => m.SelectedTaxonomyId)').change(function () {
|
|
||||||
var self = $(this);
|
|
||||||
var id = self.find("option:selected").attr("value");
|
|
||||||
// do nothing if no term
|
|
||||||
if(!id) return;
|
|
||||||
|
|
||||||
$.get(
|
|
||||||
"@Url.Action("RenderTermSelect", "TermAdmin", new { area = "Orchard.Taxonomies" })", { taxonomyId : id }, function (data) {
|
|
||||||
$('#@Html.FieldIdFor(m => m.SelectedTermId) option[value != -1]').remove();
|
|
||||||
$('#@Html.FieldIdFor(m => m.SelectedTermId)').append(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
@*
|
|
||||||
ContentPart: TermWidgetPart
|
|
||||||
ContentItems: List
|
|
||||||
*@
|
|
||||||
@{
|
|
||||||
IEnumerable<object> contentItems = Model.ContentItems;
|
|
||||||
Model.ContentItems.Classes.Add("content-items");
|
|
||||||
Model.ContentItems.Classes.Add("term-widget");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Display(Model.ContentItems)
|
|
||||||
@if (contentItems == null || !contentItems.Any()) {
|
|
||||||
<p>@T("There are no items for this term.")</p>
|
|
||||||
}
|
|
@@ -61,7 +61,6 @@ namespace Upgrade.Controllers {
|
|||||||
_upgradeService.CopyTable("Contrib_Taxonomies_TermContentItem", "Orchard_Taxonomies_TermContentItem", new[] {"Id"});
|
_upgradeService.CopyTable("Contrib_Taxonomies_TermContentItem", "Orchard_Taxonomies_TermContentItem", new[] {"Id"});
|
||||||
_upgradeService.CopyTable("Contrib_Taxonomies_TermPartRecord", "Orchard_Taxonomies_TermPartRecord", new string[0]);
|
_upgradeService.CopyTable("Contrib_Taxonomies_TermPartRecord", "Orchard_Taxonomies_TermPartRecord", new string[0]);
|
||||||
_upgradeService.CopyTable("Contrib_Taxonomies_TermsPartRecord", "Orchard_Taxonomies_TermsPartRecord", new string[0]);
|
_upgradeService.CopyTable("Contrib_Taxonomies_TermsPartRecord", "Orchard_Taxonomies_TermsPartRecord", new string[0]);
|
||||||
_upgradeService.CopyTable("Contrib_Taxonomies_TermWidgetPartRecord", "Orchard_Taxonomies_TermWidgetPartRecord", new string[0]);
|
|
||||||
|
|
||||||
_orchardServices.Notifier.Information(T("Taxonomies were migrated successfully."));
|
_orchardServices.Notifier.Information(T("Taxonomies were migrated successfully."));
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>@T("Migrating Taxonomies:")</legend>
|
<legend>@T("Migrating Taxonomies:")</legend>
|
||||||
<span class="hint">@T("This migration step will convert the Contrib.Taxonomies content items to Orchard.Taxonomies.")</span>
|
<span class="hint">@T("This migration step will convert the Contrib.Taxonomies content items to Orchard.Taxonomies.")</span>
|
||||||
|
<span class="hint">@T("If you had any Term Widget instance, you will have to replace them with Projection Queries.")</span>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@if (ViewBag.CanMigrate) {
|
@if (ViewBag.CanMigrate) {
|
||||||
|
Reference in New Issue
Block a user