From a25c1200488894f15a58b46346e68a14db368ae7 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 5 Dec 2026 23:55:08 +0000 Subject: [PATCH] Alphabetize named choices across PlotDirector --- .../Context/ContextCharacterEditing.cs | 2 + .../Context/ContextRelationshipEditing.cs | 2 +- PlotLine/Services/Context/ContextThreads.cs | 2 +- PlotLine/Services/CoreServices.cs | 66 +++++++++++-------- PlotLine/Views/FloorPlans/Edit.cshtml | 6 +- PlotLine/Views/Maps/Index.cshtml | 4 +- PlotLine/Views/PlotLineWorkspace/Index.cshtml | 6 +- PlotLine/Views/Timeline/Index.cshtml | 5 +- PlotLine/Views/Writing/Context.cshtml | 2 +- .../Views/Writing/_WritingContextMap.cshtml | 2 +- PlotLine/wwwroot/js/location-picker.js | 63 +++++++++++++++++- PlotLine/wwwroot/js/maps-story.js | 3 +- 12 files changed, 122 insertions(+), 41 deletions(-) diff --git a/PlotLine/Services/Context/ContextCharacterEditing.cs b/PlotLine/Services/Context/ContextCharacterEditing.cs index 1e40f407..862bba17 100644 --- a/PlotLine/Services/Context/ContextCharacterEditing.cs +++ b/PlotLine/Services/Context/ContextCharacterEditing.cs @@ -55,6 +55,8 @@ public sealed class ContextCharacterEditing(ICharacterService characters,IStoryC if(field=="location"){ var library=await locations.ListByProjectAsync(book.ProjectID); options=[new("No recorded location",""),..library.Where(l=>l.ProjectID==book.ProjectID&&!l.IsArchived) + .OrderBy(l => l.LocationName, StringComparer.CurrentCultureIgnoreCase) + .ThenBy(l => l.LocationPath, StringComparer.CurrentCultureIgnoreCase) .Select(l=>new SelectListItem(string.IsNullOrWhiteSpace(l.LocationPath)?l.LocationName:l.LocationPath,l.LocationID.ToString()))]; } var hash=appearance!=null?Hash(new{appearance.SceneCharacterID,appearance.SceneID,appearance.CharacterID,appearance.RoleInSceneTypeID,appearance.PresenceTypeID,appearance.LocationID,appearance.EntryLocationID,appearance.ExitLocationID,appearance.AppearanceNotes,appearance.OutfitDescription,appearance.EmotionalState,appearance.PhysicalCondition,appearance.KnowledgeNotes}):Hash(new{character.CharacterID,character.CharacterName,character.Aliases,character.CharacterImportance,character.DefaultDescription,character.SexValueID,character.Sex,character.BirthDate,character.IsDeceased,character.AgeAtSeriesStart,character.Height,character.EyeColour,character.ShowInQuickAddBar,character.ImagePath,character.ThumbnailPath,AliasRecords=aliases}); diff --git a/PlotLine/Services/Context/ContextRelationshipEditing.cs b/PlotLine/Services/Context/ContextRelationshipEditing.cs index 55ec1b66..eeea0143 100644 --- a/PlotLine/Services/Context/ContextRelationshipEditing.cs +++ b/PlotLine/Services/Context/ContextRelationshipEditing.cs @@ -42,7 +42,7 @@ public sealed class ContextRelationshipEditing(ICharacterRepository repository,I var form=new ContextRelationshipForm{BookID=bookId,SceneID=sceneId,RelationshipID=relationshipId,Mode=mode,ReferenceLens=referenceLens,SourceID=relation?.CharacterAID??0,TargetID=relation?.CharacterBID??0,TypeID=relation?.RelationshipTypeID??0,StateID=state??0, Intensity=mode=="initial"?relation?.InitialIntensity:change?.Intensity??projected?.CurrentIntensity,Mutual=relation?.IsReciprocal??false,Known=mode=="initial"?relation?.ReaderInitiallyKnows??false:change?.IsKnownToOtherCharacter??false, Notes=mode=="initial"?relation?.Notes:change?.Description,Label=mode=="initial"?(referenceLens=="family"?"Author-established initial family connection":"Initial relationship (before scene developments)"):"Relationship development at "+(data.Scenes.FirstOrDefault(s=>s.SceneID==sceneId)?.SceneTitle??"the selected scene"), - Characters=data.Characters.Where(c=>!c.IsArchived).OrderBy(c=>c.CharacterName).Select(c=>new SelectListItem(c.CharacterName,c.CharacterID.ToString())).ToList(), + Characters=data.Characters.Where(c=>!c.IsArchived).OrderBy(c => c.CharacterName, StringComparer.CurrentCultureIgnoreCase).Select(c=>new SelectListItem(c.CharacterName,c.CharacterID.ToString())).ToList(), Types=lookups.RelationshipTypes.Where(t=>(t.IsActive||t.RelationshipTypeID==relation?.RelationshipTypeID)&&(referenceLens!="family"||ContextRelationshipLenses.Family(t.RelationshipCategoryName,t.TypeName))).Select(t=>new SelectListItem(t.RelationshipCategoryName+" · "+t.TypeName,t.RelationshipTypeID.ToString())).ToList(), States=lookups.RelationshipStates.Where(s=>s.IsActive||s.RelationshipStateID==state).Select(s=>new SelectListItem(s.StateName,s.RelationshipStateID.ToString())).ToList()}; form.Fingerprint=Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(JsonSerializer.Serialize(new{relation,Events=data.RelationshipEvents.Where(e=>e.CharacterRelationshipID==relationshipId).ToList(),Matches=data.Relationships.Select(r=>new{r.CharacterRelationshipID,r.CharacterAID,r.CharacterBID,r.RelationshipTypeID,r.IsReciprocal,r.IsArchived})})))); diff --git a/PlotLine/Services/Context/ContextThreads.cs b/PlotLine/Services/Context/ContextThreads.cs index 559581a3..27ccea51 100644 --- a/PlotLine/Services/Context/ContextThreads.cs +++ b/PlotLine/Services/Context/ContextThreads.cs @@ -45,7 +45,7 @@ public sealed class ContextThreads(ContextSpatial spatial, IPlotLineWorkspaceRep associations.Contains((t.PlotThreadID, scope.SceneID)), scope.CanEdit && directLinks.Contains((t.PlotThreadID, scope.SceneID)), scenes.Values.Where(s => s.NarrativeOrder < current.NarrativeOrder && associations.Contains((t.PlotThreadID, s.SceneID))) - .OrderBy(s => s.NarrativeOrder).ToArray())).OrderBy(t => t.PlotLineName).ThenBy(t => t.Title).ToArray(); + .OrderBy(s => s.NarrativeOrder).ToArray())).OrderBy(t => t.PlotLineName, StringComparer.CurrentCultureIgnoreCase).ThenBy(t => t.Title, StringComparer.CurrentCultureIgnoreCase).ToArray(); return new(scope, rows); } diff --git a/PlotLine/Services/CoreServices.cs b/PlotLine/Services/CoreServices.cs index 3791d7cc..0105f4d7 100644 --- a/PlotLine/Services/CoreServices.cs +++ b/PlotLine/Services/CoreServices.cs @@ -1745,7 +1745,7 @@ public sealed class ChapterService( PendingCharacterSuggestionCount = sceneRows.Sum(x => x.PendingCharacterSuggestionCount), PendingAssetSuggestionCount = sceneRows.Sum(x => x.PendingAssetSuggestionCount), PendingLocationSuggestionCount = sceneRows.Sum(x => x.PendingLocationSuggestionCount), - CharacterOptions = ToOptionalSelectList(await characters.ListCharactersAsync(project.ProjectID), x => x.CharacterID, x => x.CharacterName), + CharacterOptions = ToOptionalSelectList((await characters.ListCharactersAsync(project.ProjectID)).OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase), x => x.CharacterID, x => x.CharacterName), PovDisplayLabel = BuildChapterPovDisplay(chapter, sceneRows) }; } @@ -1770,7 +1770,7 @@ public sealed class ChapterService( RevisionStatusID = DefaultRevisionStatusId(lookupData), RevisionStatuses = ToSelectList(lookupData.RevisionStatuses, x => x.RevisionStatusID, x => x.StatusName), ChapterPurposes = ToOptionalSelectList(lookupData.ChapterPurposeTypes, x => x.ChapterPurposeID, x => x.PurposeName), - CharacterOptions = ToOptionalSelectList(await characters.ListCharactersAsync(project.ProjectID), x => x.CharacterID, x => x.CharacterName) + CharacterOptions = ToOptionalSelectList((await characters.ListCharactersAsync(project.ProjectID)).OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase), x => x.CharacterID, x => x.CharacterName) }; } @@ -1810,7 +1810,7 @@ public sealed class ChapterService( Project = project, RevisionStatuses = ToSelectList(lookupData.RevisionStatuses, x => x.RevisionStatusID, x => x.StatusName), ChapterPurposes = ToOptionalSelectList(lookupData.ChapterPurposeTypes, x => x.ChapterPurposeID, x => x.PurposeName), - CharacterOptions = ToOptionalSelectList(await characters.ListCharactersAsync(project.ProjectID), x => x.CharacterID, x => x.CharacterName) + CharacterOptions = ToOptionalSelectList((await characters.ListCharactersAsync(project.ProjectID)).OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase), x => x.CharacterID, x => x.CharacterName) }; } @@ -2158,8 +2158,10 @@ public sealed class SceneService( model.ReturnBookID ??= model.Book?.BookID; var plotLookups = await plots.GetLookupsAsync(); - var plotLines = await plots.ListPlotLinesAsync(model.Project.ProjectID); - var plotThreads = await plots.ListPlotThreadsByProjectAsync(model.Project.ProjectID); + var plotLines = (await plots.ListPlotLinesAsync(model.Project.ProjectID)) + .OrderBy(x => x.PlotLineName, StringComparer.CurrentCultureIgnoreCase).ToList(); + var plotThreads = (await plots.ListPlotThreadsByProjectAsync(model.Project.ProjectID)) + .OrderBy(x => x.PlotLineName, StringComparer.CurrentCultureIgnoreCase).ThenBy(x => x.PlotLineID).ThenBy(x => x.ThreadTitle, StringComparer.CurrentCultureIgnoreCase).ToList(); var assetLookups = await assets.GetLookupsAsync(); var projectAssets = await assets.ListAssetsAsync(model.Project.ProjectID); var characterLookups = await characters.GetLookupsAsync(); @@ -2202,13 +2204,13 @@ public sealed class SceneService( model.ThreadTypeOptions = ToOptionalSelectList(plotLookups.ThreadTypes, x => x.ThreadTypeID, x => x.TypeName); model.ThreadEventTypeOptions = ChapterService.ToSelectList(plotLookups.ThreadEventTypes, x => x.ThreadEventTypeID, x => x.TypeName); model.PlotEventTypeOptions = ChapterService.ToSelectList(plotLookups.PlotEventTypes, x => x.PlotEventTypeID, x => x.TypeName); - model.AssetOptions = ToOptionalSelectList(projectAssets, x => x.StoryAssetID, x => x.AssetName); + model.AssetOptions = ToOptionalSelectList(projectAssets.OrderBy(x => x.AssetName, StringComparer.CurrentCultureIgnoreCase), x => x.StoryAssetID, x => x.AssetName); model.AssetKindOptions = ChapterService.ToSelectList(assetLookups.AssetKinds, x => x.AssetKindID, x => x.KindName); model.AssetStateOptions = ToOptionalSelectList(assetLookups.AssetStates, x => x.AssetStateID, x => x.StateName); model.AssetEventTypeOptions = ChapterService.ToSelectList(assetLookups.AssetEventTypes, x => x.AssetEventTypeID, x => x.TypeName); model.AssetCustodyEventTypeOptions = ChapterService.ToSelectList(assetLookups.AssetCustodyEventTypes, x => x.AssetCustodyEventTypeID, x => x.TypeName); model.CustodyRoleOptions = ChapterService.ToSelectList(assetLookups.CustodyRoles, x => x.CustodyRoleID, x => x.RoleName); - model.CharacterOptions = ToOptionalSelectList(projectCharacters, x => x.CharacterID, x => x.CharacterName); + model.CharacterOptions = ToOptionalSelectList(projectCharacters.OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase), x => x.CharacterID, x => x.CharacterName); model.CharacterRoleOptions = ToOptionalSelectList(characterLookups.RoleTypes, x => x.CharacterRoleInSceneTypeID, x => x.TypeName); model.PresenceTypeOptions = ToOptionalSelectList(characterLookups.PresenceTypes, x => x.PresenceTypeID, x => x.TypeName); model.CharacterAttributeTypeOptions = ChapterService.ToSelectList(characterLookups.AttributeTypes, x => x.CharacterAttributeTypeID, x => x.AttributeName); @@ -2216,7 +2218,8 @@ public sealed class SceneService( model.RelationshipOptions = ToOptionalSelectList(projectRelationships, x => x.CharacterRelationshipID, x => $"{x.CharacterAName} -> {x.CharacterBName} ({x.RelationshipTypeName})"); model.RelationshipTypeOptions = ToRelationshipTypeSelectList(characterLookups.RelationshipTypes); model.RelationshipStateOptions = ChapterService.ToSelectList(characterLookups.RelationshipStates, x => x.RelationshipStateID, x => x.StateName); - model.LocationOptions = ToOptionalSelectList(projectLocations, x => x.LocationID, x => new string(' ', x.Depth * 2) + x.LocationName); + model.LocationOptions = ToOptionalSelectList(projectLocations.OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase).ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase), + x => x.LocationID, x => string.IsNullOrWhiteSpace(x.LocationPath) ? x.LocationName : x.LocationPath); model.SceneOptions = ToOptionalSelectList(allSceneOptions.Where(x => x.SceneID != model.SceneID), x => x.SceneID, x => $"{x.BookDisplayTitle} / Ch {x.ChapterNumber} / Scene {x.SceneNumber}: {x.SceneTitle}"); model.ChapterOptions = ChapterService.ToSelectList(chapterOptions, x => x.ChapterID, x => $"{x.BookDisplayTitle} / Chapter {x.ChapterNumber}: {x.ChapterTitle}"); model.SceneDependencyTypeOptions = ChapterService.ToSelectList(dependencyLookups.DependencyTypes, x => x.SceneDependencyTypeID, x => x.TypeName); @@ -2715,9 +2718,10 @@ public sealed class TimelineService( SceneOptions = orderedScenes.Select(x => new SelectListItem($"Scene {x.SceneNumber}: {x.SceneTitle}", x.SceneID.ToString())).ToList(), SceneFromOptions = orderedScenes.Select(x => new SelectListItem($"Scene {x.SceneNumber}: {x.SceneTitle}", x.SceneID.ToString(), x.SceneID == filter.SceneFromID)).ToList(), SceneToOptions = orderedScenes.Select(x => new SelectListItem($"Scene {x.SceneNumber}: {x.SceneTitle}", x.SceneID.ToString(), x.SceneID == filter.SceneToID)).ToList(), - PlotLineOptions = plotLines.Select(x => new SelectListItem(x.PlotLineName, x.PlotLineID.ToString(), x.PlotLineID == filter.PlotLineID)).ToList(), - PlotThreadOptions = plotThreads.Select(x => new SelectListItem(x.ThreadTitle, x.PlotThreadID.ToString(), x.PlotThreadID == filter.PlotThreadID)).ToList(), - AssetOptions = allAssets.Select(x => new SelectListItem(x.AssetName, x.StoryAssetID.ToString(), x.StoryAssetID == filter.StoryAssetID)).ToList(), + PlotLineOptions = plotLines.OrderBy(x => x.PlotLineName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.PlotLineName, x.PlotLineID.ToString(), x.PlotLineID == filter.PlotLineID)).ToList(), + PlotThreadOptions = plotThreads.OrderBy(x => x.PlotLineName, StringComparer.CurrentCultureIgnoreCase).ThenBy(x => x.PlotLineID).ThenBy(x => x.ThreadTitle, StringComparer.CurrentCultureIgnoreCase) + .Select(x => new SelectListItem($"{x.PlotLineName}: {x.ThreadTitle}", x.PlotThreadID.ToString(), x.PlotThreadID == filter.PlotThreadID)).ToList(), + AssetOptions = allAssets.OrderBy(x => x.AssetName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.AssetName, x.StoryAssetID.ToString(), x.StoryAssetID == filter.StoryAssetID)).ToList(), QuickAddAssets = allAssets .Where(x => x.ShowInQuickAddBar) .OrderByDescending(x => x.Importance) @@ -2726,7 +2730,7 @@ public sealed class TimelineService( AssetEventTypeOptions = ChapterService.ToSelectList(assetLookupData.AssetEventTypes, x => x.AssetEventTypeID, x => x.TypeName), AssetStateOptions = assetLookupData.AssetStates.Select(x => new SelectListItem(x.StateName, x.AssetStateID.ToString())).ToList(), AssetDependencyTypeOptions = ChapterService.ToSelectList(assetLookupData.AssetDependencyTypes, x => x.AssetDependencyTypeID, x => x.TypeName), - CharacterOptions = allCharacters.Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString(), x.CharacterID == filter.CharacterID)).ToList(), + CharacterOptions = allCharacters.OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString(), x.CharacterID == filter.CharacterID)).ToList(), QuickAddCharacters = allCharacters .Where(x => x.ShowInQuickAddBar) .OrderByDescending(x => x.CharacterImportance ?? 0) @@ -2734,8 +2738,9 @@ public sealed class TimelineService( .ToList(), CharacterRoleOptions = characterLookupData.RoleTypes.Select(x => new SelectListItem(x.TypeName, x.CharacterRoleInSceneTypeID.ToString())).ToList(), PresenceTypeOptions = characterLookupData.PresenceTypes.Select(x => new SelectListItem(x.TypeName, x.PresenceTypeID.ToString())).ToList(), - PovCharacterOptions = allCharacters.Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString(), x.CharacterID == filter.POVCharacterID)).ToList(), - LocationOptions = allLocations.Select(x => new SelectListItem(x.LocationPath, x.LocationID.ToString(), x.LocationID == filter.LocationID)).ToList(), + PovCharacterOptions = allCharacters.OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString(), x.CharacterID == filter.POVCharacterID)).ToList(), + LocationOptions = allLocations.OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase).ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase) + .Select(x => new SelectListItem(string.IsNullOrWhiteSpace(x.LocationPath) ? x.LocationName : x.LocationPath, x.LocationID.ToString(), x.LocationID == filter.LocationID)).ToList(), QuickAddLocations = allLocations .Where(x => x.ShowInQuickAddBar) .OrderBy(x => x.LocationPath) @@ -3495,9 +3500,10 @@ public sealed partial class StoryStateService( BookOptions = timeline.Books.Select(x => new SelectListItem($"Book {x.BookNumber}: {x.BookDisplayTitle}", x.BookID.ToString(), x.BookID == filter.BookID)).ToList(), ChapterOptions = timeline.Chapters.Select(x => new SelectListItem($"Ch {x.ChapterNumber}: {x.ChapterTitle}", x.ChapterID.ToString(), x.ChapterID == filter.ChapterID)).ToList(), SceneOptions = orderedScenes.Select(x => new SelectListItem($"Scene {x.SceneNumber:g}: {x.SceneTitle}", x.SceneID.ToString(), x.SceneID == filter.SelectedSceneID)).ToList(), - CharacterOptions = allCharacters.Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString(), filter.CharacterIDs.Contains(x.CharacterID))).ToList(), - AssetOptions = allAssets.Select(x => new SelectListItem(x.AssetName, x.StoryAssetID.ToString(), filter.AssetIDs.Contains(x.StoryAssetID))).ToList(), - LocationOptions = allLocations.Select(x => new SelectListItem(x.LocationPath, x.LocationID.ToString(), filter.LocationIDs.Contains(x.LocationID))).ToList() + CharacterOptions = allCharacters.OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString(), filter.CharacterIDs.Contains(x.CharacterID))).ToList(), + AssetOptions = allAssets.OrderBy(x => x.AssetName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.AssetName, x.StoryAssetID.ToString(), filter.AssetIDs.Contains(x.StoryAssetID))).ToList(), + LocationOptions = allLocations.OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase).ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase) + .Select(x => new SelectListItem(string.IsNullOrWhiteSpace(x.LocationPath) ? x.LocationName : x.LocationPath, x.LocationID.ToString(), filter.LocationIDs.Contains(x.LocationID))).ToList() }; if (string.Equals(filter.DisplayMode, "StoryState", StringComparison.OrdinalIgnoreCase) && filter.SelectedSceneID.HasValue) @@ -5183,7 +5189,7 @@ public sealed class PlotService(IProjectRepository projects, IBookRepository boo model.BookOptions = (await books.ListByProjectAsync(model.ProjectID)) .Select(x => new SelectListItem($"Book {x.BookNumber}: {x.BookDisplayTitle}", x.BookID.ToString())) .ToList(); - model.ParentPlotLineOptions = parentCandidates + model.ParentPlotLineOptions = parentCandidates.OrderBy(x => x.PlotLineName, StringComparer.CurrentCultureIgnoreCase) .Select(x => new SelectListItem(x.PlotLineName, x.PlotLineID.ToString())) .ToList(); return model; @@ -5192,7 +5198,7 @@ public sealed class PlotService(IProjectRepository projects, IBookRepository boo private async Task PopulatePlotThreadListsAsync(PlotThreadEditViewModel model, PlotLookupData lookupData) { var plotLines = await plots.ListPlotLinesAsync(model.ProjectID); - model.PlotLineOptions = ChapterService.ToSelectList(plotLines, x => x.PlotLineID, x => x.PlotLineName); + model.PlotLineOptions = ChapterService.ToSelectList(plotLines.OrderBy(x => x.PlotLineName, StringComparer.CurrentCultureIgnoreCase), x => x.PlotLineID, x => x.PlotLineName); model.ThreadTypeOptions = ChapterService.ToSelectList(lookupData.ThreadTypes, x => x.ThreadTypeID, x => x.TypeName); model.ThreadStatusOptions = ChapterService.ToSelectList(lookupData.ThreadStatuses, x => x.ThreadStatusID, x => x.StatusName); model.SceneOptions = (await plots.ListSceneOptionsAsync(model.ProjectID)) @@ -6008,7 +6014,7 @@ public sealed class RelationshipMapService(IProjectRepository projects, ICharact BookOptions = data.Books.OrderBy(x => x.SortOrder).ThenBy(x => x.BookNumber).Select(x => new SelectListItem($"Book {x.BookNumber}: {x.BookDisplayTitle}", x.BookID.ToString(), x.BookID == point.BookID)).ToList(), ChapterOptions = data.Chapters.OrderBy(x => BookSort(data, x.BookID)).ThenBy(x => x.SortOrder).Select(x => new SelectListItem($"Ch {x.ChapterNumber}: {x.ChapterTitle}", x.ChapterID.ToString(), x.ChapterID == point.ChapterID)).ToList(), SceneOptions = data.Scenes.OrderBy(x => SceneIndex(sceneOrder, x.SceneID)).Select(x => new SelectListItem($"Ch {ChapterNumber(data, x.ChapterID)} / Scene {x.SceneNumber}: {x.SceneTitle}", x.SceneID.ToString(), x.SceneID == point.SceneID)).ToList(), - CharacterOptions = data.Characters.OrderBy(x => x.CharacterName).Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString(), x.CharacterID == focusCharacterId)).ToList(), + CharacterOptions = data.Characters.OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString(), x.CharacterID == focusCharacterId)).ToList(), Categories = data.RelationshipCategories.OrderBy(x => x.SortOrder).Select(x => new RelationshipMapCategoryViewModel { RelationshipCategoryID = x.RelationshipCategoryID, @@ -6192,7 +6198,7 @@ public sealed class WriterWorkspaceService( return new WriterDashboardViewModel { ProjectID = projectId, - ProjectOptions = projectRows.Select(x => new SelectListItem(x.ProjectName, x.ProjectID.ToString(), x.ProjectID == projectId)).ToList(), + ProjectOptions = projectRows.OrderBy(x => x.ProjectName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.ProjectName, x.ProjectID.ToString(), x.ProjectID == projectId)).ToList(), WriteNext = await GetDashboardScenesAsync(projectIds, "WriteNext", bookId), ContinueWriting = await GetDashboardScenesAsync(projectIds, "ContinueWriting", bookId), RevisionQueue = await GetDashboardScenesAsync(projectIds, "RevisionQueue", bookId), @@ -6615,7 +6621,7 @@ public sealed class WritingScheduleService( ? [] : await books.ListByProjectAsync(selectedProject.ProjectID); - model.ProjectOptions = projectRows + model.ProjectOptions = projectRows.OrderBy(x => x.ProjectName, StringComparer.CurrentCultureIgnoreCase) .Select(x => new SelectListItem(x.ProjectName, x.ProjectID.ToString(), x.ProjectID == model.ProjectID)) .ToList(); model.BookOptions = bookRows @@ -8282,7 +8288,8 @@ public sealed class AssetService( => states.Select(x => new SelectListItem(x.StateName, x.AssetStateID.ToString())).ToList(); private static IReadOnlyList ToOptionalLocationList(IEnumerable items) - => items.Select(x => new SelectListItem(new string(' ', x.Depth * 2) + x.LocationName, x.LocationID.ToString())).ToList(); + => items.OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase).ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase) + .Select(x => new SelectListItem(string.IsNullOrWhiteSpace(x.LocationPath) ? x.LocationName : x.LocationPath, x.LocationID.ToString())).ToList(); } public sealed class LocationService( @@ -8308,8 +8315,9 @@ public sealed class LocationService( Form = new EntityMergeForm { SourceID = sourceId }, TargetOptions = (await locations.ListByProjectAsync(source.ProjectID)) .Where(x => x.LocationID != sourceId && !x.IsArchived) - .OrderBy(x => x.LocationName, StringComparer.OrdinalIgnoreCase) - .Select(x => new SelectListItem(x.LocationName, x.LocationID.ToString())).ToList() + .OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase) + .ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase) + .Select(x => new SelectListItem(string.IsNullOrWhiteSpace(x.LocationPath) ? x.LocationName : x.LocationPath, x.LocationID.ToString())).ToList() }; } @@ -8717,7 +8725,8 @@ public sealed class FloorPlanService( PositionWithinLocation = FloorPlanTransitionPositions.Centre }, LocationOptions = ToOptionalLocationOptions(projectLocations, "Create/link automatically"), - Locations = projectLocations, + Locations = projectLocations.OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase) + .ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase).ToList(), BlockTypeOptions = FloorPlanBlockTypes.All.Select(x => new SelectListItem(BlockTypeLabel(x), x)).ToList(), TransitionTypeOptions = FloorPlanTransitionTypes.All.Select(x => new SelectListItem(x, x)).ToList(), OccupancyScenes = occupancyScenes @@ -9652,7 +9661,8 @@ public sealed class FloorPlanService( private static IReadOnlyList ToOptionalLocationOptions(IEnumerable projectLocations, string emptyLabel) { var items = new List { new(emptyLabel, string.Empty) }; - items.AddRange(projectLocations.Select(x => new SelectListItem(string.IsNullOrWhiteSpace(x.LocationPath) ? x.LocationName : x.LocationPath, x.LocationID.ToString()))); + items.AddRange(projectLocations.OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase).ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase) + .Select(x => new SelectListItem(string.IsNullOrWhiteSpace(x.LocationPath) ? x.LocationName : x.LocationPath, x.LocationID.ToString()))); return items; } } @@ -9799,7 +9809,7 @@ public sealed class CharacterService( ReaderInitiallyKnows = true, IsReciprocal = true }, - CharacterOptions = projectCharacters.Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString())).ToList(), + CharacterOptions = projectCharacters.OrderBy(x => x.CharacterName, StringComparer.CurrentCultureIgnoreCase).Select(x => new SelectListItem(x.CharacterName, x.CharacterID.ToString())).ToList(), RelationshipTypeOptions = ToRelationshipTypeSelectList(relationshipLookups.RelationshipTypes), RelationshipStateOptions = relationshipLookups.RelationshipStates.Select(x => new SelectListItem(x.StateName, x.RelationshipStateID.ToString())).ToList(), BookOptions = projectBooks.Select(x => new SelectListItem($"Book {x.BookNumber}: {x.BookDisplayTitle}", x.BookID.ToString())).ToList(), diff --git a/PlotLine/Views/FloorPlans/Edit.cshtml b/PlotLine/Views/FloorPlans/Edit.cshtml index 42045044..b78d921d 100644 --- a/PlotLine/Views/FloorPlans/Edit.cshtml +++ b/PlotLine/Views/FloorPlans/Edit.cshtml @@ -257,7 +257,8 @@ .Where(x => x.LocationID.HasValue) .GroupBy(x => x.LocationID!.Value) .Select(x => x.First()) - .OrderBy(x => x.LocationName) + .OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase) + .ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase) .ToList(); var floorTransitions = transitionsByFloor.GetValueOrDefault(floor.FloorPlanFloorID) ?? [];
@@ -731,7 +732,8 @@ .Where(x => x.LocationID.HasValue) .GroupBy(x => x.LocationID!.Value) .Select(x => x.First()) - .OrderBy(x => x.LocationName) + .OrderBy(x => x.LocationName, StringComparer.CurrentCultureIgnoreCase) + .ThenBy(x => x.LocationPath, StringComparer.CurrentCultureIgnoreCase) .ToList(); -

New map

Starter layouts contain editable shapes only. You name and define your world.

+

New map

Starter layouts contain editable shapes only. You name and define your world.

Arrange from relationships

Preview an arrangement using directions and relative distances. Known distances never control spacing.

Position geographically

diff --git a/PlotLine/Views/PlotLineWorkspace/Index.cshtml b/PlotLine/Views/PlotLineWorkspace/Index.cshtml index 4e1da9fb..077b0c4e 100644 --- a/PlotLine/Views/PlotLineWorkspace/Index.cshtml +++ b/PlotLine/Views/PlotLineWorkspace/Index.cshtml @@ -3,7 +3,9 @@ ViewData["ShellClass"] = "plotline-shell-wide"; ViewData["Title"] = "Plot Lines"; ViewData["ProjectSection"] = "Plot Lines"; - var selectedThreads = Model.PlotLines.Where(x => x.IsSelected).SelectMany(x => x.Threads).ToList(); + var plotLineChoices = Model.PlotLines.OrderBy(x => x.Line.PlotLineName, StringComparer.CurrentCultureIgnoreCase).ToList(); + var selectedThreads = plotLineChoices.Where(x => x.IsSelected) + .SelectMany(x => x.Threads.OrderBy(thread => thread.ThreadTitle, StringComparer.CurrentCultureIgnoreCase)).ToList(); }