Skip to content

Commit

Permalink
Introduce OnTopic 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyCaney committed Dec 29, 2019
2 parents 19900e6 + b144ea4 commit 85ee208
Show file tree
Hide file tree
Showing 53 changed files with 3,202 additions and 0 deletions.
202 changes: 202 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# Archive data (generated by app)
[Ww]ebsite/[Aa]rchives/*/
[Ww]ebsite/[Ss]cripts/
[Ww]ebsite/[Dd]ebug/

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
x64/
build/
bld/
[Bb]in/
[Oo]bj/
*.nupkg

# Roslyn cache directories
*.ide/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

#NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

*_i.c
*_p.c
*_i.h
*.bat
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding addin-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml

# NuGet Packages Directory
packages/*
## TODO: If the tool you use requires repositories.config
## uncomment the next line
#!packages/repositories.config

# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the line above has been uncommented)
!packages/build/

# Windows Azure Build Output
csx/
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
.vs

# Custom
ConnectionStrings.config
5 changes: 5 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
assembly-versioning-scheme: MajorMinorPatch
mode: ContinuousDelivery
branches: {}
ignore:
sha: []
60 changes: 60 additions & 0 deletions OnTopic.Web.Mvc.Host/App_Start/RouteConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*==============================================================================================================================
| Author Ignia, LLC
| Client Ignia, LLC
| Project OnTopicSample OnTopic Site
\=============================================================================================================================*/
using System.Web.Mvc;
using System.Web.Routing;

namespace OnTopic.Web.Mvc.Host {

/*============================================================================================================================
| CLASS: ROUTE CONFIGURATION
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides default routing configuration for MVC.
/// </summary>
public static class RouteConfig {

/*==========================================================================================================================
| METHOD: REGISTER ROUTES
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provided a <see cref="RouteCollection"/>, registers all routes associated with the application.
/// </summary>
/// <param name="routes">
/// The route collection for the server, typically passed from the <see cref="System.Web.HttpApplication"/> class.
/// </param>
public static void RegisterRoutes(RouteCollection routes) {

/*------------------------------------------------------------------------------------------------------------------------
| Handle OnTopic redirects
\-----------------------------------------------------------------------------------------------------------------------*/
routes.MapRoute(
name: "TopicRedirect",
url: "Topic/{topicId}",
defaults: new { controller = "Redirect", action = "Redirect" }
);

/*------------------------------------------------------------------------------------------------------------------------
| Handle OnTopic Web namespace
\-----------------------------------------------------------------------------------------------------------------------*/
routes.MapRoute(
name: "WebTopics",
url: "Web/{*path}",
defaults: new { controller = "Topic", action = "Index", id = UrlParameter.Optional, rootTopic = "Web" }
);

/*------------------------------------------------------------------------------------------------------------------------
| Handle default route convention
\-----------------------------------------------------------------------------------------------------------------------*/
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Fallback", action = "Index", id = UrlParameter.Optional }
);

}

} //Class
} //Namespace
20 changes: 20 additions & 0 deletions OnTopic.Web.Mvc.Host/Controllers/ErrorController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*==============================================================================================================================
| Author Ignia, LLC
| Client Ignia, LLC
| Project OnTopicSample OnTopic Site
\=============================================================================================================================*/
using OnTopic.ViewModels;
using OnTopic.Web.Mvc.Controllers;

namespace OnTopic.Web.Mvc.Host.Controllers {

/*============================================================================================================================
| CLASS: ERROR CONTROLLER
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides access to the views associated with 400 and 500 error results.
/// </summary>
public class ErrorController : ErrorControllerBase<PageTopicViewModel> {

} // Class
} // Namespace
90 changes: 90 additions & 0 deletions OnTopic.Web.Mvc.Host/Controllers/LayoutController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*==============================================================================================================================
| Author Ignia, LLC
| Client Ignia, LLC
| Project OnTopicSample OnTopic Site
\=============================================================================================================================*/
using System.Threading.Tasks;
using System.Web.Mvc;
using OnTopic.Repositories;
using OnTopic.Web.Mvc.Controllers;
using OnTopic.Web.Mvc.Models;
using OnTopic.ViewModels;
using OnTopic.Mapping.Hierarchical;

namespace OnTopic.Web.Mvc.Host.Controllers {

/*============================================================================================================================
| CLASS: LAYOUT CONTROLLER
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides access to the default homepage for the site.
/// </summary>
public class LayoutController : LayoutControllerBase<NavigationTopicViewModel> {

/*==========================================================================================================================
| PRIVATE FIELDS
\-------------------------------------------------------------------------------------------------------------------------*/
private readonly ITopicRepository _topicRepository = null;

/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new instance of a Topic Controller with necessary dependencies.
/// </summary>
/// <returns>A topic controller for loading OnTopic views.</returns>
public LayoutController(
ITopicRoutingService topicRoutingService,
IHierarchicalTopicMappingService<NavigationTopicViewModel> hierarchicalTopicMappingService,
ITopicRepository topicRepository
) : base(
topicRoutingService,
hierarchicalTopicMappingService
) {
_topicRepository = topicRepository;
}

/*==========================================================================================================================
| PAGE LEVEL NAVIGATION
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides page-level navigation for the current page.
/// </summary>
public async Task<PartialViewResult> PageLevelNavigation() {

/*------------------------------------------------------------------------------------------------------------------------
| Establish variables
\-----------------------------------------------------------------------------------------------------------------------*/
var currentTopic = CurrentTopic;
var navigationRootTopic = currentTopic;

/*------------------------------------------------------------------------------------------------------------------------
| Identify navigation root
>-------------------------------------------------------------------------------------------------------------------------
| The navigation root in the case of the page-level navigation any parent of content type "PageGroup".
\-----------------------------------------------------------------------------------------------------------------------*/
if (navigationRootTopic != null) {
while (navigationRootTopic.Parent != null && !navigationRootTopic.ContentType.Equals("PageGroup")) {
navigationRootTopic = navigationRootTopic.Parent;
}
}

if (navigationRootTopic?.Parent == null) navigationRootTopic = null;

/*------------------------------------------------------------------------------------------------------------------------
| Construct view model
\-----------------------------------------------------------------------------------------------------------------------*/
var navigationViewModel = new NavigationViewModel<NavigationTopicViewModel>() {
NavigationRoot = await HierarchicalTopicMappingService.GetRootViewModelAsync(navigationRootTopic),
CurrentKey = CurrentTopic?.GetUniqueKey()
};

/*------------------------------------------------------------------------------------------------------------------------
| Return the corresponding view
\-----------------------------------------------------------------------------------------------------------------------*/
return PartialView(navigationViewModel);

}

} // Class
} // Namespace
1 change: 1 addition & 0 deletions OnTopic.Web.Mvc.Host/Global.asax
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="OnTopic.Web.Mvc.Host.Global" Language="C#" %>
Loading

0 comments on commit 85ee208

Please sign in to comment.