From 82602369c6889a5bfa5e16ed4424782da7a1fde4 Mon Sep 17 00:00:00 2001 From: Lombiq Date: Tue, 19 May 2015 21:46:38 +0200 Subject: [PATCH] Formatting Taxonomies source files --- .../Controllers/AdminController.cs | 19 +-- .../Controllers/TermAdminController.cs | 16 +-- .../Drivers/TaxonomyFieldDriver.cs | 16 +-- .../Drivers/TaxonomyPartDriver.cs | 4 +- .../Drivers/TermPartDriver.cs | 16 +-- .../Handlers/TaxonomyPartHandler.cs | 16 +-- .../Handlers/TermsPartHandler.cs | 2 +- .../Helpers/PathExtensions.cs | 6 +- .../Models/TermContentItem.cs | 2 +- .../Orchard.Taxonomies/Models/TermPart.cs | 10 +- .../Orchard.Taxonomies/Models/TermsPart.cs | 2 +- .../Navigation/TaxonomyNavigationProvider.cs | 2 +- .../Projections/TermsFilter.cs | 8 +- .../Projections/TermsFilterForms.cs | 14 +-- .../Services/ITaxonomyService.cs | 4 +- .../Services/TaxonomyService.cs | 39 ++++--- .../Services/TermCountProcessor.cs | 2 +- .../Modules/Orchard.Taxonomies/Shapes.cs | 2 +- .../StandardQueries/TermFeedQuery.cs | 2 +- .../Views/Admin/Import.cshtml | 82 ++++++------- .../Views/Admin/Index.cshtml | 108 +++++++++--------- .../TaxonomyFieldSettings.cshtml | 12 +- .../Fields/TaxonomyField.Autocomplete.cshtml | 66 +++++------ .../Fields/TaxonomyField.cshtml | 33 +++--- .../Parts/Navigation.Taxonomy.Edit.cshtml | 70 ++++++------ .../Views/Fields/TaxonomyField.cshtml | 8 +- .../Orchard.Taxonomies/Views/Taxonomy.cshtml | 2 +- .../Views/TaxonomyItem.cshtml | 32 +++--- .../Views/TermAdmin/Merge.cshtml | 2 +- .../Views/TermAdmin/MoveTerm.cshtml | 4 +- .../Views/TermAdmin/RenderTermSelect.cshtml | 2 +- .../Views/TermAdmin/SelectTerm.cshtml | 4 +- 32 files changed, 305 insertions(+), 302 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/AdminController.cs index 4c5d65766..63ce5c4ee 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/AdminController.cs @@ -129,12 +129,12 @@ namespace Orchard.Taxonomies.Controllers { var parents = new Stack(); TermPosition parentTerm = null; while (null != (line = reader.ReadLine())) { - + // ignore empty lines - if(String.IsNullOrWhiteSpace(line)) { + if (String.IsNullOrWhiteSpace(line)) { continue; } - + // compute level from tabs var level = 0; while (line[level] == '\t') level++; // number of tabs to know the level @@ -146,20 +146,22 @@ namespace Orchard.Taxonomies.Controllers { if (level == previousLevel + 1) { parentTerm = parents.Peek(); parents.Push(new TermPosition { Term = term }); - } else if (level == previousLevel) { + } + else if (level == previousLevel) { // same parent term if (parents.Any()) parents.Pop(); parents.Push(new TermPosition { Term = term }); - } else if (level < previousLevel) { + } + else if (level < previousLevel) { for (var i = previousLevel; i >= level; i--) parents.Pop(); parentTerm = parents.Any() ? parents.Peek() : null; parents.Push(new TermPosition { Term = term }); } - + // increment number of children if (parentTerm == null) { parentTerm = topTerm; @@ -177,7 +179,8 @@ namespace Orchard.Taxonomies.Controllers { if (scIndex != -1) { term.Name = line.Substring(0, scIndex); term.Slug = line.Substring(scIndex + 1); - } else { + } + else { term.Name = line; } @@ -187,7 +190,7 @@ namespace Orchard.Taxonomies.Controllers { if (existing != null && existing.Container.ContentItem.Record == term.Container.ContentItem.Record) { Services.Notifier.Error(T("The term {0} already exists at this level", term.Name)); Services.TransactionManager.Cancel(); - return View(new ImportViewModel {Taxonomy = taxonomy, Terms = terms}); + return View(new ImportViewModel { Taxonomy = taxonomy, Terms = terms }); } _taxonomyService.ProcessPath(term); diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs index f77559d50..6b7469e40 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs @@ -137,21 +137,21 @@ namespace Orchard.Taxonomies.Controllers { var terms = ResolveTermIds(termIds); - if(!terms.Any()) + if (!terms.Any()) return HttpNotFound(); var model = new MoveTermViewModel { Terms = (from t in _taxonomyService.GetTerms(taxonomyId) - from st in terms - where !(t.FullPath + "/").StartsWith(st.FullPath + "/") - select t).Distinct().ToList(), + from st in terms + where !(t.FullPath + "/").StartsWith(st.FullPath + "/") + select t).Distinct().ToList(), TermIds = terms.Select(x => x.Id), SelectedTermId = -1 }; return View(model); } - + [HttpPost] public ActionResult MoveTerm(int taxonomyId, int selectedTermId, string termIds) { if (!Services.Authorizer.Authorize(Permissions.ManageTerms, T("Not allowed to move terms"))) @@ -162,9 +162,9 @@ namespace Orchard.Taxonomies.Controllers { var terms = ResolveTermIds(termIds); foreach (var term in terms) { - _taxonomyService.MoveTerm(taxonomy, term, parentTerm); + _taxonomyService.MoveTerm(taxonomy, term, parentTerm); } - + return RedirectToAction("Index", new { taxonomyId }); } @@ -175,7 +175,7 @@ namespace Orchard.Taxonomies.Controllers { var taxonomy = _taxonomyService.GetTaxonomy(taxonomyId); var parentTerm = _taxonomyService.GetTerm(parentTermId); var term = _taxonomyService.NewTerm(taxonomy, parentTerm); - + var model = Services.ContentManager.BuildEditor(term); return View(model); } diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs index 3aba95179..1cd5a6d19 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs @@ -22,7 +22,7 @@ namespace Orchard.Taxonomies.Drivers { public IOrchardServices Services { get; set; } public TaxonomyFieldDriver( - IOrchardServices services, + IOrchardServices services, ITaxonomyService taxonomyService, IRepository repository) { _taxonomyService = taxonomyService; @@ -81,9 +81,9 @@ namespace Orchard.Taxonomies.Drivers { } protected override DriverResult Editor(ContentPart part, TaxonomyField field, IUpdateModel updater, dynamic shapeHelper) { - var viewModel = new TaxonomyFieldViewModel { Terms = new List() }; - - if(updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) { + var viewModel = new TaxonomyFieldViewModel { Terms = new List() }; + + if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) { var checkedTerms = viewModel.Terms .Where(t => (t.IsChecked || t.Id == viewModel.SingleTermId)) .Select(t => GetOrCreateTerm(t, viewModel.TaxonomyId, field)) @@ -117,7 +117,7 @@ namespace Orchard.Taxonomies.Drivers { } var terms = termIdentities - .Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries) + .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(context.GetItemFromSession) .Where(contentItem => contentItem != null) .ToList(); @@ -128,9 +128,9 @@ namespace Orchard.Taxonomies.Drivers { private TermPart GetOrCreateTerm(TermEntry entry, int taxonomyId, TaxonomyField field) { var term = default(TermPart); - if (entry.Id > 0) - term = _taxonomyService.GetTerm(entry.Id); - + if (entry.Id > 0) + term = _taxonomyService.GetTerm(entry.Id); + //Prevents creation of existing term if (term == null && !string.IsNullOrEmpty(entry.Name)) term = _taxonomyService.GetTermByName(taxonomyId, entry.Name.Trim()); diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyPartDriver.cs index 3d9c0cf72..017664b74 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyPartDriver.cs @@ -31,7 +31,7 @@ namespace Orchard.Taxonomies.Drivers { taxonomyShape.Items.Add(child.Shape); } else { - + if (parent.Shape == null) { parent.Shape = shapeHelper.TaxonomyItem(Taxonomy: part.ContentItem, ContentPart: parent.TermPart, ContentItem: parent.TermPart.ContentItem); } @@ -51,7 +51,7 @@ namespace Orchard.Taxonomies.Drivers { if (existing != null && existing.Record != part.Record) { updater.AddModelError("Title", T("A taxonomy with the same name already exists")); } - + // nothing to display for this part return null; } diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TermPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TermPartDriver.cs index b52aa6448..10440230b 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TermPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TermPartDriver.cs @@ -42,7 +42,7 @@ namespace Orchard.Taxonomies.Drivers { protected override DriverResult Display(TermPart part, string displayType, dynamic shapeHelper) { return Combined( ContentShape("Parts_TermPart_Feed", () => { - + // generates a link to the RSS feed for this term _feedManager.Register(part.Name, "rss", new RouteValueDictionary { { "term", part.Id } }); return null; @@ -53,7 +53,7 @@ namespace Orchard.Taxonomies.Drivers { if (httpContext != null) { pagerParameters.Page = Convert.ToInt32(httpContext.Request.QueryString["page"]); } - + var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters); var taxonomy = _taxonomyService.GetTaxonomy(part.TaxonomyId); var totalItemCount = _taxonomyService.GetContentItemsCount(part); @@ -113,8 +113,8 @@ namespace Orchard.Taxonomies.Drivers { context.Element(part.PartDefinition.Name).SetAttributeValue("TaxonomyId", identity); var identityPaths = new List(); - foreach(var pathPart in part.Path.Split('/')) { - if(String.IsNullOrEmpty(pathPart)) { + foreach (var pathPart in part.Path.Split('/')) { + if (String.IsNullOrEmpty(pathPart)) { continue; } @@ -132,15 +132,15 @@ namespace Orchard.Taxonomies.Drivers { var identity = context.Attribute(part.PartDefinition.Name, "TaxonomyId"); var contentItem = context.GetItemFromSession(identity); - + if (contentItem == null) { throw new OrchardException(T("Unknown taxonomy: {0}", identity)); - } - + } + part.TaxonomyId = contentItem.Id; part.Path = "/"; - foreach(var identityPath in context.Attribute(part.PartDefinition.Name, "Path").Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries)) { + foreach (var identityPath in context.Attribute(part.PartDefinition.Name, "Path").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { var pathContentItem = context.GetItemFromSession(identityPath); part.Path += pathContentItem.Id + "/"; } diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Handlers/TaxonomyPartHandler.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Handlers/TaxonomyPartHandler.cs index 092ee6d4d..6e8556904 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Handlers/TaxonomyPartHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Handlers/TaxonomyPartHandler.cs @@ -12,16 +12,16 @@ using System; namespace Orchard.Taxonomies.Handlers { public class TaxonomyPartHandler : ContentHandler { public TaxonomyPartHandler( - IRepository repository, + IRepository repository, ITaxonomyService taxonomyService, IContentDefinitionManager contentDefinitionManager) { - + string previousName = null; Filters.Add(StorageFilter.For(repository)); OnPublished((context, part) => { - - if (part.TermTypeName == null) { + + if (part.TermTypeName == null) { // is it a new taxonomy ? taxonomyService.CreateTermContentType(part); } @@ -29,11 +29,11 @@ namespace Orchard.Taxonomies.Handlers { // update existing fields foreach (var partDefinition in contentDefinitionManager.ListPartDefinitions()) { foreach (var field in partDefinition.Fields) { - if (field.FieldDefinition.Name == typeof (TaxonomyField).Name) { + if (field.FieldDefinition.Name == typeof(TaxonomyField).Name) { if (field.Settings.GetModel().Taxonomy == previousName) { - contentDefinitionManager.AlterPartDefinition(partDefinition.Name, - cfg => cfg.WithField(field.Name, + contentDefinitionManager.AlterPartDefinition(partDefinition.Name, + cfg => cfg.WithField(field.Name, builder => builder.WithSetting("TaxonomyFieldSettings.Taxonomy", part.Name))); } } @@ -42,7 +42,7 @@ namespace Orchard.Taxonomies.Handlers { } }); - OnLoading( (context, part) => part.TermsField.Loader(() => taxonomyService.GetTerms(part.Id))); + OnLoading((context, part) => part.TermsField.Loader(() => taxonomyService.GetTerms(part.Id))); OnUpdating((context, part) => { // if altering the title of a taxonomy, save the name diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Handlers/TermsPartHandler.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Handlers/TermsPartHandler.cs index a2cd5aa9e..6d98f3eb8 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Handlers/TermsPartHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Handlers/TermsPartHandler.cs @@ -88,7 +88,7 @@ namespace Orchard.Taxonomies.Handlers { }); } - + // Fires off a processing engine task to run the count processing after the request so it's non-blocking. private void RecalculateCount(IProcessingEngine processingEngine, ShellSettings shellSettings, IShellDescriptorManager shellDescriptorManager, TermsPart part) { var termPartRecordIds = part.Terms.Select(t => t.TermRecord.Id).ToArray(); diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Helpers/PathExtensions.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Helpers/PathExtensions.cs index 05e4229f5..958a8cd4a 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Helpers/PathExtensions.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Helpers/PathExtensions.cs @@ -6,11 +6,11 @@ using System.Linq; namespace Orchard.Taxonomies.Helpers { public static class TermExtensions { public static int GetLevels(this TermPart term) { - return String.IsNullOrEmpty(term.Path) ? 0 : term.Path.Count( c => c == '/') - 1; + return String.IsNullOrEmpty(term.Path) ? 0 : term.Path.Count(c => c == '/') - 1; } public static int GetLevels(this TermEntry term) { - return String.IsNullOrEmpty(term.Path) ? 0 : term.Path.Count( c => c == '/') - 1; + return String.IsNullOrEmpty(term.Path) ? 0 : term.Path.Count(c => c == '/') - 1; } public static TermEntry CreateTermEntry(this TermPart term) { @@ -20,7 +20,7 @@ namespace Orchard.Taxonomies.Helpers { Selectable = term.Selectable, Count = term.Count, Path = term.Path, - Weight= term.Weight, + Weight = term.Weight, IsChecked = false, ContentItem = term.ContentItem }; diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermContentItem.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermContentItem.cs index 7df7330cd..564c1fc04 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermContentItem.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermContentItem.cs @@ -5,7 +5,7 @@ namespace Orchard.Taxonomies.Models { /// Represents a relationship between a Term and a Content Item /// public class TermContentItem { - + public virtual int Id { get; set; } public virtual string Field { get; set; } public virtual TermPartRecord TermRecord { get; set; } diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermPart.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermPart.cs index f7d11662e..21403434f 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermPart.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermPart.cs @@ -79,7 +79,7 @@ namespace Orchard.Taxonomies.Models { // if same parent path and same weight, compare by name return String.Compare(x.Name, y.Name, StringComparison.OrdinalIgnoreCase); - } + } // if two nodes have different parents @@ -98,12 +98,12 @@ namespace Orchard.Taxonomies.Models { // /1/2 vs /1/3 => 2 vs 3 // /2/3 vs /4 => 2 vs 4 - var xPath = x.FullPath.Split(new [] { '/' }, StringSplitOptions.RemoveEmptyEntries); - var yPath = y.FullPath.Split(new [] { '/' }, StringSplitOptions.RemoveEmptyEntries); + var xPath = x.FullPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + var yPath = y.FullPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - string xFullPath = "", yFullPath = ""; + string xFullPath = "", yFullPath = ""; - for(var i=0; i< Math.Min(xPath.Length, yPath.Length); i++) { + for (var i = 0; i < Math.Min(xPath.Length, yPath.Length); i++) { xFullPath += "/" + xPath[i]; yFullPath += "/" + yPath[i]; diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermsPart.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermsPart.cs index 4b9df93bf..cb795bdce 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermsPart.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Models/TermsPart.cs @@ -10,7 +10,7 @@ namespace Orchard.Taxonomies.Models { /// public class TermsPart : ContentPart { public IList Terms { get { return Record.Terms; } } - internal LazyField> _termParts; + internal LazyField> _termParts; public IEnumerable TermParts { get { return _termParts.Value; } } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Navigation/TaxonomyNavigationProvider.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Navigation/TaxonomyNavigationProvider.cs index 6d7a769b5..1dc3c26e5 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Navigation/TaxonomyNavigationProvider.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Navigation/TaxonomyNavigationProvider.cs @@ -46,7 +46,7 @@ namespace Orchard.Taxonomies.Navigation { var rootLevel = rootTerm != null ? rootTerm.GetLevels() : 0; - + var menuPosition = item.Position; var rootPath = rootTerm == null || taxonomyNavigationPart.DisplayRootTerm ? "" : rootTerm.FullPath; diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilter.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilter.cs index 7e1c37381..e6244e16b 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilter.cs @@ -46,7 +46,7 @@ namespace Orchard.Taxonomies.Projections { var terms = ids.Select(_taxonomyService.GetTerm).ToList(); var allChildren = new List(); - foreach(var term in terms) { + foreach (var term in terms) { allChildren.AddRange(_taxonomyService.GetChildren(term)); allChildren.Add(term); } @@ -55,11 +55,11 @@ namespace Orchard.Taxonomies.Projections { var allIds = allChildren.Select(x => x.Id).ToList(); - switch(op) { + switch (op) { case 0: // is one of // Unique alias so we always get a unique join everytime so can have > 1 HasTerms filter on a query. - Action s = alias => alias.ContentPartRecord().Property("Terms", "terms" + _termsFilterId++); - Action f = x => x.InG("TermRecord.Id", allIds); + Action s = alias => alias.ContentPartRecord().Property("Terms", "terms" + _termsFilterId++); + Action f = x => x.InG("TermRecord.Id", allIds); context.Query.Where(s, f); break; case 1: // is all of diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilterForms.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilterForms.cs index 6d1a44557..6266976f3 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilterForms.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Projections/TermsFilterForms.cs @@ -55,8 +55,8 @@ namespace Orchard.Taxonomies.Projections { f._Terms.Add(new SelectListItem { Value = String.Empty, Text = taxonomy.Name }); foreach (var term in _taxonomyService.GetTerms(taxonomy.Id)) { var gap = new string('-', term.GetLevels()); - - if(gap.Length > 0) { + + if (gap.Length > 0) { gap += " "; } @@ -67,10 +67,10 @@ namespace Orchard.Taxonomies.Projections { return f; }; - context.Form("SelectTerms", - form, - (Action) Import, - (Action) Export + context.Form("SelectTerms", + form, + (Action)Import, + (Action)Export ); } @@ -78,7 +78,7 @@ namespace Orchard.Taxonomies.Projections { string termIds = Convert.ToString(state.TermIds); if (!String.IsNullOrEmpty(termIds)) { - var ids = termIds.Split(new[] {','}).Select(Int32.Parse).ToArray(); + var ids = termIds.Split(new[] { ',' }).Select(Int32.Parse).ToArray(); var terms = ids.Select(_taxonomyService.GetTerm).ToList(); var identities = terms.Select(context.ContentManager.GetItemMetadata).Select(x => x.Identity.ToString()).ToArray(); diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/ITaxonomyService.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/ITaxonomyService.cs index 2b6207814..ab31ba19b 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/ITaxonomyService.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/ITaxonomyService.cs @@ -30,7 +30,7 @@ namespace Orchard.Taxonomies.Services { /// /// The taxonomy to create a term content type for. void CreateTermContentType(TaxonomyPart taxonomy); - + /// /// Deletes a content item from the database. /// @@ -38,7 +38,7 @@ namespace Orchard.Taxonomies.Services { /// It will also remove all its terms and delete their content type. void DeleteTaxonomy(TaxonomyPart taxonomy); IContentQuery GetTaxonomiesQuery(); - + IEnumerable GetTerms(int taxonomyId); TermPart GetTerm(int id); diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TaxonomyService.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TaxonomyService.cs index 298c5b43e..cb386a504 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TaxonomyService.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TaxonomyService.cs @@ -37,11 +37,10 @@ namespace Orchard.Taxonomies.Services { INotifier notifier, IContentDefinitionManager contentDefinitionManager, IAuthorizationService authorizationService, - IOrchardServices services, - IProcessingEngine processingEngine, - ShellSettings shellSettings, - IShellDescriptorManager shellDescriptorManager) - { + IOrchardServices services, + IProcessingEngine processingEngine, + ShellSettings shellSettings, + IShellDescriptorManager shellDescriptorManager) { _termContentItemRepository = termContentItemRepository; _contentManager = contentManager; _notifier = notifier; @@ -98,7 +97,7 @@ namespace Orchard.Taxonomies.Services { // create the associated term's content type taxonomy.TermTypeName = GenerateTermTypeName(taxonomy.Name); - _contentDefinitionManager.AlterTypeDefinition(taxonomy.TermTypeName, + _contentDefinitionManager.AlterTypeDefinition(taxonomy.TermTypeName, cfg => cfg .WithSetting("Taxonomy", taxonomy.Name) .WithPart("TermPart") @@ -226,7 +225,7 @@ namespace Orchard.Taxonomies.Services { public void DeleteTerm(TermPart termPart) { _contentManager.Remove(termPart.ContentItem); - foreach(var childTerm in GetChildren(termPart)) { + foreach (var childTerm in GetChildren(termPart)) { _contentManager.Remove(childTerm.ContentItem); } @@ -244,7 +243,7 @@ namespace Orchard.Taxonomies.Services { var termsPart = contentItem.As(); // removing current terms for specific field - var termList = termsPart.Terms.Select((t, i) => new {Term = t, Index = i}) + var termList = termsPart.Terms.Select((t, i) => new { Term = t, Index = i }) .Where(x => x.Term.Field == field) .Select(x => x) .OrderByDescending(i => i.Index) @@ -253,15 +252,16 @@ namespace Orchard.Taxonomies.Services { foreach (var x in termList) { termsPart.Terms.RemoveAt(x.Index); } - + // adding new terms list - foreach(var term in terms) { + foreach (var term in terms) { // Remove the newly added terms because they will get processed by the Published-Event termList.RemoveAll(t => t.Term.Id == term.Id); - termsPart.Terms.Add( + termsPart.Terms.Add( new TermContentItem { - TermsPartRecord = termsPart.Record, - TermRecord = term.Record, Field = field + TermsPartRecord = termsPart.Record, + TermRecord = term.Record, + Field = field }); } @@ -282,7 +282,8 @@ namespace Orchard.Taxonomies.Services { tpr => tpr.Terms.Any(tr => tr.TermRecord.Id == term.Id || tr.TermRecord.Path.StartsWith(rootPath))); - } else { + } + else { query = query.Where( tpr => tpr.Terms.Any(tr => tr.Field == fieldName @@ -291,7 +292,7 @@ namespace Orchard.Taxonomies.Services { return query; } - + public long GetContentItemsCount(TermPart term, string fieldName = null) { return GetContentItemsQuery(term, fieldName).Count(); } @@ -315,14 +316,14 @@ namespace Orchard.Taxonomies.Services { .List(); if (includeParent) { - result = result.Concat(new [] {term}); + result = result.Concat(new[] { term }); } return TermPart.Sort(result); } public IEnumerable GetParents(TermPart term) { - return term.Path.Split(new [] {'/'}, StringSplitOptions.RemoveEmptyEntries).Select(id => GetTerm(int.Parse(id))); + return term.Path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).Select(id => GetTerm(int.Parse(id))); } public IEnumerable GetSlugs() { @@ -357,12 +358,12 @@ namespace Orchard.Taxonomies.Services { public void ProcessPath(TermPart term) { var parentTerm = term.Container.As(); - term.Path = parentTerm != null ? parentTerm.FullPath + "/": "/"; + term.Path = parentTerm != null ? parentTerm.FullPath + "/" : "/"; } public void CreateHierarchy(IEnumerable terms, Action append) { var root = new TermPartNode(); - var stack = new Stack(new [] { root } ); + var stack = new Stack(new[] { root }); foreach (var term in terms) { var current = CreateNode(term); diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TermCountProcessor.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TermCountProcessor.cs index 8b908bc2c..b10459ea8 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TermCountProcessor.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Services/TermCountProcessor.cs @@ -14,7 +14,7 @@ namespace Orchard.Taxonomies.Services { _contentManager = contentManager; _taxonomyService = taxonomyService; } - + public void Process(params int[] termPartRecordIds) { foreach (var id in termPartRecordIds) { diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Shapes.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Shapes.cs index ded57da61..63b11f97c 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Shapes.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Shapes.cs @@ -83,7 +83,7 @@ namespace Orchard.Taxonomies { foreach (var parent in GetHierarchyAlternates(termPart).Reverse()) { var formatted = FormatAlternate(parent); - + metadata.Alternates.Add(String.Concat("Content__", contentItem.ContentType, "__", field, "__", formatted)); metadata.Alternates.Add(String.Concat("Content_", metadata.DisplayType, "__", contentItem.ContentType, "__", field, "__", formatted)); } diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/StandardQueries/TermFeedQuery.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/StandardQueries/TermFeedQuery.cs index 15f32f6b3..0d9e8a55b 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/StandardQueries/TermFeedQuery.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/StandardQueries/TermFeedQuery.cs @@ -41,7 +41,7 @@ namespace Orchard.Taxonomies.StandardQueries { var containerId = (int)termParthId.ConvertTo(typeof(int)); var container = _contentManager.Get(containerId); - if(container == null){ + if (container == null) { return; } diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Import.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Import.cshtml index ce980884b..c420356bb 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Import.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Import.cshtml @@ -5,10 +5,10 @@ Layout.Title = T("Import Terms for {0}", Model.Taxonomy.Name).Text; } -@using(Html.BeginFormAntiForgeryPost()) { +@using (Html.BeginFormAntiForgeryPost()) { @Html.ValidationSummary()
- + @T("One term per line, followed by a semi-colon and the slug") @T("Hierarchies are defined using tabs (handled in this editor zone)") @@ -21,47 +21,47 @@ } -@using(Script.Foot()){ - + //]]> + } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Index.cshtml index d996c26fb..6eaebdffa 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Index.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Index.cshtml @@ -7,59 +7,59 @@ } @using (Html.BeginFormAntiForgeryPost()) { - @Html.ValidationSummary() -
- - - -
-
@Html.ActionLink(T("Add a taxonomy").Text, "Create", new { Area = "Contents", Id = "Taxonomy", ReturnUrl = Request.RawUrl }, new { @class = "button primaryAction" })
-
- - - - - - - - - - - - - - @foreach (var taxonomyEntry in Model.Taxonomies) { - ti = taxonomyIndex; - - - - - - taxonomyIndex++; - } -
@T("Name")
- - @if (!taxonomyEntry.IsInternal || Authorizer.Authorize(Orchard.Security.StandardPermissions.SiteOwner)) { - - } - - @if (!taxonomyEntry.IsInternal || Authorizer.Authorize(Orchard.Security.StandardPermissions.SiteOwner)) { - @Html.ActionLink(taxonomyEntry.Name, "Index", "TermAdmin", new { taxonomyId = taxonomyEntry.Id }, new object { }) - } - else { - @Html.ItemDisplayText(taxonomyEntry.ContentItem) - } - - @if (!taxonomyEntry.IsInternal || Authorizer.Authorize(Orchard.Security.StandardPermissions.SiteOwner)) { - @Html.ItemEditLink(T("Edit").Text, taxonomyEntry.ContentItem) | - @Html.ActionLink(T("Terms").Text, "Index", "TermAdmin", new { taxonomyId = taxonomyEntry.Id }, new object { }) | - @Html.ActionLink(T("Delete").Text, "Delete", new { id = taxonomyEntry.Id }, new object { }) | - @Html.ActionLink(T("Import").Text, "Import", new { id = taxonomyEntry.Id }, new object { }) - } -
+ @Html.ValidationSummary() +
+ + + +
+
@Html.ActionLink(T("Add a taxonomy").Text, "Create", new { Area = "Contents", Id = "Taxonomy", ReturnUrl = Request.RawUrl }, new { @class = "button primaryAction" })
+
+ + + + + + + + + + + + + + @foreach (var taxonomyEntry in Model.Taxonomies) { + ti = taxonomyIndex; + + + + + + taxonomyIndex++; + } +
@T("Name")
+ + @if (!taxonomyEntry.IsInternal || Authorizer.Authorize(Orchard.Security.StandardPermissions.SiteOwner)) { + + } + + @if (!taxonomyEntry.IsInternal || Authorizer.Authorize(Orchard.Security.StandardPermissions.SiteOwner)) { + @Html.ActionLink(taxonomyEntry.Name, "Index", "TermAdmin", new { taxonomyId = taxonomyEntry.Id }, new object { }) + } + else { + @Html.ItemDisplayText(taxonomyEntry.ContentItem) + } + + @if (!taxonomyEntry.IsInternal || Authorizer.Authorize(Orchard.Security.StandardPermissions.SiteOwner)) { + @Html.ItemEditLink(T("Edit").Text, taxonomyEntry.ContentItem) | + @Html.ActionLink(T("Terms").Text, "Index", "TermAdmin", new { taxonomyId = taxonomyEntry.Id }, new object { }) | + @Html.ActionLink(T("Delete").Text, "Delete", new { id = taxonomyEntry.Id }, new object { }) | + @Html.ActionLink(T("Import").Text, "Import", new { id = taxonomyEntry.Id }, new object { }) + } +
@Display(Model.Pager) -
+
} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/DefinitionTemplates/TaxonomyFieldSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/DefinitionTemplates/TaxonomyFieldSettings.cshtml index 33e8d0c8a..bb79ef4f6 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/DefinitionTemplates/TaxonomyFieldSettings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/DefinitionTemplates/TaxonomyFieldSettings.cshtml @@ -3,10 +3,10 @@ Script.Include("admin-taxonomy-field-settings.js").AtFoot(); }
- + @@ -14,10 +14,10 @@
- +
- @Html.CheckBoxFor(m => m.LeavesOnly) + @Html.CheckBoxFor(m => m.LeavesOnly)
@@ -32,7 +32,7 @@
- + @Html.CheckBoxFor(m => m.Autocomplete)
@Html.CheckBoxFor(m => m.AllowCustomTerms) @@ -41,7 +41,7 @@
- @Html.TextAreaFor(m => m.Hint, new { @class = "text medium", rows = "5" } ) + @Html.TextAreaFor(m => m.Hint, new { @class = "text medium", rows = "5" }) @T("The help text is written under the field when authors are editing the content item.") @Html.ValidationMessageFor(m => m.Hint)
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyField.Autocomplete.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyField.Autocomplete.cshtml index 58c11b444..71caa17ad 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyField.Autocomplete.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyField.Autocomplete.cshtml @@ -26,52 +26,52 @@ } } @{ - var allTerms = Newtonsoft.Json.JsonConvert.SerializeObject(Model.Terms.Select(x => new { label = x.Name, value = x.Id, levels = x.GetLevels(), disabled = IsTermDisabled(x)})); + var allTerms = Newtonsoft.Json.JsonConvert.SerializeObject(Model.Terms.Select(x => new { label = x.Name, value = x.Id, levels = x.GetLevels(), disabled = IsTermDisabled(x) })); var selectedTerms = Newtonsoft.Json.JsonConvert.SerializeObject(Model.Terms.Where(x => x.IsChecked).Select(x => new { label = x.Name, value = x.Id, levels = 0, disabled = true })); }
- class="required" }>@Model.DisplayName.CamelFriendly() + class="required" }>@Model.DisplayName.CamelFriendly() @if (Model.Settings.Autocomplete) { -
-
    - @if (Model.Settings.SingleChoice) { -
    @T("Enter a single term. Hit tab or enter to apply the term.") @if (!Model.Settings.AllowCustomTerms) { @T("This taxonomy does not allow you to create new terms.") }
    - } - else { -
    @T("Enter multiple terms. Hit tab, enter or , to add multiple terms.") @if (!Model.Settings.AllowCustomTerms) { @T("This taxonomy does not allow you to create new terms.") }
    - } -
    +
    +
      + @if (Model.Settings.SingleChoice) { +
      @T("Enter a single term. Hit tab or enter to apply the term.") @if (!Model.Settings.AllowCustomTerms) { @T("This taxonomy does not allow you to create new terms.") }
      + } + else { +
      @T("Enter multiple terms. Hit tab, enter or , to add multiple terms.") @if (!Model.Settings.AllowCustomTerms) { @T("This taxonomy does not allow you to create new terms.") }
      + } +
      } @if (!String.IsNullOrWhiteSpace(Model.Settings.Hint)) { - @Model.Settings.Hint + @Model.Settings.Hint }
        - @foreach (var entry in Model.Terms) { - var ti = termIndex; -
      • - @{ - var disabled = IsTermDisabled(entry); - if (Model.Settings.SingleChoice) { - disabled="disabled" } type="radio" value="@Model.Terms[ti].Id" @if (entry.Id == Model.SingleTermId){ checked="checked" } name="@Html.FieldNameFor(m => m.SingleTermId)" id="@Html.FieldIdFor(m => m.Terms[ti].IsChecked)" data-term="@entry.Name" data-term-identity="@entry.Name.ToLower()" /> + @foreach (var entry in Model.Terms) { + var ti = termIndex; +
      • + @{ + var disabled = IsTermDisabled(entry); + if (Model.Settings.SingleChoice) { + disabled="disabled" } type="radio" value="@Model.Terms[ti].Id" @if (entry.Id == Model.SingleTermId) { checked="checked" } name="@Html.FieldNameFor(m => m.SingleTermId)" id="@Html.FieldIdFor(m => m.Terms[ti].IsChecked)" data-term="@entry.Name" data-term-identity="@entry.Name.ToLower()" /> + } + else { + disabled="disabled" } type="checkbox" value="true" @if (entry.IsChecked) { checked="checked" } name="@Html.FieldNameFor(m => m.Terms[ti].IsChecked)" id="@Html.FieldIdFor(m => m.Terms[ti].IsChecked)" data-term="@entry.Name" data-term-identity="@entry.Name.ToLower()" /> + } } - else { - disabled="disabled" } type="checkbox" value="true" @if (entry.IsChecked) { checked="checked" } name="@Html.FieldNameFor(m => m.Terms[ti].IsChecked)" id="@Html.FieldIdFor(m => m.Terms[ti].IsChecked)" data-term="@entry.Name" data-term-identity="@entry.Name.ToLower()" /> - } - } - - @Html.HiddenFor(m => m.Terms[ti].Id) -
      • - termIndex++; - } + + @Html.HiddenFor(m => m.Terms[ti].Id) + + termIndex++; + }
      - + @if (!Model.Terms.Any()) { -
      - @T("There are no terms defined for {0} yet.", Model.DisplayName.CamelFriendly()) - @T("Create some terms") -
      +
      + @T("There are no terms defined for {0} yet.", Model.DisplayName.CamelFriendly()) + @T("Create some terms") +
      } @Html.HiddenFor(m => m.TaxonomyId)
      diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyField.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyField.cshtml index a5e52893a..48461ed28 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyField.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyField.cshtml @@ -5,7 +5,7 @@ @{ Style.Include("admin-taxonomy.css"); - Script.Require("jQuery"); + Script.Require("jQuery"); Script.Include("~/Themes/TheAdmin/scripts/admin.js").AtFoot(); Script.Include("admin-taxonomy-expando.js").AtFoot(); @@ -14,40 +14,39 @@ }
      - class="required" }>@Model.DisplayName.CamelFriendly() - + class="required" }>@Model.DisplayName.CamelFriendly() +
      - @if (!String.IsNullOrWhiteSpace(Model.Settings.Hint)) - { + @if (!String.IsNullOrWhiteSpace(Model.Settings.Hint)) { @Model.Settings.Hint } - +
        @foreach (var entry in Model.Terms) { var ti = termIndex;
      • - @* Tabs for levels *@ @for (var i = 1; i <= entry.GetLevels(); i++){   } + @* Tabs for levels *@ @for (var i = 1; i <= entry.GetLevels(); i++) {   } @{ - var disabled = !entry.Selectable || (Model.Settings.LeavesOnly && Model.Terms.Any(t => t.Path.Contains(entry.Path + entry.Id))); - if (Model.Settings.SingleChoice) { - disabled="disabled" } type="radio" value="@Model.Terms[ti].Id" @if (entry.Id == Model.SingleTermId) { checked="checked" } name="@Html.FieldNameFor(m => m.SingleTermId)" id="@Html.FieldIdFor(m => m.Terms[ti].IsChecked)" data-term="@entry.Name.ToLower()"/> - } - else { - disabled="disabled" } type="checkbox" value="true" @if (entry.IsChecked){ checked="checked" } name="@Html.FieldNameFor(m => m.Terms[ti].IsChecked)" id="@Html.FieldIdFor(m => m.Terms[ti].IsChecked)" data-term="@entry.Name.ToLower()"/> - } + var disabled = !entry.Selectable || (Model.Settings.LeavesOnly && Model.Terms.Any(t => t.Path.Contains(entry.Path + entry.Id))); + if (Model.Settings.SingleChoice) { + disabled="disabled" } type="radio" value="@Model.Terms[ti].Id" @if (entry.Id == Model.SingleTermId) { checked="checked" } name="@Html.FieldNameFor(m => m.SingleTermId)" id="@Html.FieldIdFor(m => m.Terms[ti].IsChecked)" data-term="@entry.Name.ToLower()" /> + } + else { + disabled="disabled" } type="checkbox" value="true" @if (entry.IsChecked) { checked="checked" } name="@Html.FieldNameFor(m => m.Terms[ti].IsChecked)" id="@Html.FieldIdFor(m => m.Terms[ti].IsChecked)" data-term="@entry.Name.ToLower()" /> + } } @Html.HiddenFor(m => m.Terms[ti].Id)
      • - termIndex++; + termIndex++; }
      - + @if (!Model.Terms.Any()) {
      @T("There are no terms defined for {0} yet.", Model.DisplayName.CamelFriendly()) @T("Create some terms") -
      +
      }
      @Html.HiddenFor(m => m.TaxonomyId) diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Parts/Navigation.Taxonomy.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Parts/Navigation.Taxonomy.Edit.cshtml index 790f5be56..01d639263 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Parts/Navigation.Taxonomy.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Parts/Navigation.Taxonomy.Edit.cshtml @@ -2,66 +2,66 @@ @using Orchard.Taxonomies.ViewModels; @{ - Script.Require("jQuery"); + Script.Require("jQuery"); }
      - @Html.LabelFor(m => m.SelectedTaxonomyId, T("Taxonomy")) - @Html.DropDownListFor(m => m.SelectedTaxonomyId, Model.AvailableTaxonomies) + @Html.LabelFor(m => m.SelectedTaxonomyId, T("Taxonomy")) + @Html.DropDownListFor(m => m.SelectedTaxonomyId, Model.AvailableTaxonomies) @T("Select the taxonomy whose terms will be rendered in the menu.")
      - @Html.LabelFor(m => m.SelectedTermId, T("Root Term")) - + @Html.SelectOption(-1, false, T("- Parent Taxonomy -").ToString()) + @{Html.RenderAction("RenderTermSelect", "TermAdmin", new { area = "Orchard.Taxonomies", taxonomyId = Model.SelectedTaxonomyId, selectedTermId = Model.SelectedTermId });} - @T("Select the root term to display") + @T("Select the root term to display")
      - @Html.CheckBoxFor(m => m.DisplayTopMenuItem) - - @T("When checked, the selected term to display will be rendered as a root element in the menu.") + @Html.CheckBoxFor(m => m.DisplayTopMenuItem) + + @T("When checked, the selected term to display will be rendered as a root element in the menu.")
      - @Html.TextBoxFor(m => m.LevelsToDisplay, new { @class = "text small" } ) + @Html.TextBoxFor(m => m.LevelsToDisplay, new { @class = "text small" }) @Html.ValidationMessage("LevelsToDisplay", "*") @T("The number of levels to display in the hierarchy. 0 to display all levels.")
      - @Html.CheckBoxFor(m => m.HideEmptyTerms) - - @T("When checked, any term which has no content item associated to it won't be rendered.") + @Html.CheckBoxFor(m => m.HideEmptyTerms) + + @T("When checked, any term which has no content item associated to it won't be rendered.")
      - @Html.CheckBoxFor(m => m.DisplayContentCount) - - @T("When checked, the number of content items is rendered following the term name.") + @Html.CheckBoxFor(m => m.DisplayContentCount) + + @T("When checked, the number of content items is rendered following the term name.")
      @using (Script.Foot()) { - + $.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); + }); + }); + }) + //]]> + } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Fields/TaxonomyField.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Fields/TaxonomyField.cshtml index 00824b29a..c6f81466a 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Fields/TaxonomyField.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Fields/TaxonomyField.cshtml @@ -4,8 +4,8 @@ string name = @Model.ContentField.DisplayName; } @if (Model.Terms.Count > 0) { -

      - @name.CamelFriendly(): - @(new HtmlString( string.Join(", ", terms.Select(t => Html.ItemDisplayLink(t.Name, t.ContentItem ).ToString()).ToArray()) )) -

      +

      + @name.CamelFriendly(): + @(new HtmlString(string.Join(", ", terms.Select(t => Html.ItemDisplayLink(t.Name, t.ContentItem).ToString()).ToArray()))) +

      } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Taxonomy.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Taxonomy.cshtml index c62354436..5090f9868 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Taxonomy.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Taxonomy.cshtml @@ -11,7 +11,7 @@ if (items.Any()) { items[0].Classes.Add("first"); items[items.Count - 1].Classes.Add("last"); - } + } }
      @tag.StartElement diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TaxonomyItem.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TaxonomyItem.cshtml index 948924868..3be467fcc 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TaxonomyItem.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TaxonomyItem.cshtml @@ -1,4 +1,4 @@ -@* +@* This shape is displayed for a TermPart when in a Taxonomy details page Its children are the element shapes in the list. Alternates: @@ -16,21 +16,21 @@ var tag = Tag(Model, "li"); @tag.StartElement - @* - - morphing the shape to keep Model untouched and - - provide a simple way to customize the shape - *@ - - Model.Metadata.Alternates.Clear(); - Model.Metadata.Type = "TaxonomyItemLink"; - @Display(Model) + @* + - morphing the shape to keep Model untouched and + - provide a simple way to customize the shape + *@ - @* render child elements *@ - - if (items.Any()) { -
        - @DisplayChildren(Model) -
      - } + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "TaxonomyItemLink"; + @Display(Model) + + @* render child elements *@ + + if (items.Any()) { +
        + @DisplayChildren(Model) +
      + } @tag.EndElement } diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/Merge.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/Merge.cshtml index c4791f66f..645ba6ef9 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/Merge.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/Merge.cshtml @@ -11,7 +11,7 @@ diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/MoveTerm.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/MoveTerm.cshtml index e1aefa419..d2c876e59 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/MoveTerm.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/MoveTerm.cshtml @@ -11,9 +11,9 @@ + @T("By selecting a parent term you can create hierarchies")
      diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/RenderTermSelect.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/RenderTermSelect.cshtml index 092edb39d..ca66d82d6 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/RenderTermSelect.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/RenderTermSelect.cshtml @@ -3,5 +3,5 @@ @using Orchard.Taxonomies.Helpers; @foreach (var term in Model.Terms) { - + } diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/SelectTerm.cshtml b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/SelectTerm.cshtml index 644613d5d..30a8a8c9c 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/SelectTerm.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/TermAdmin/SelectTerm.cshtml @@ -9,9 +9,9 @@ + @T("By selecting a parent term you can create hierarchies")