Skip to content

Commit

Permalink
Move views back into /Areas
Browse files Browse the repository at this point in the history
This effectively reverts a portion of #f618fc8, which removed the interstitial `/Areas/Editor` folders in order to flatten the folder structure. It turns out that views in a **Razor Class Library** are not namespaced, unlike `/wwwroot`, and are thus subject to being subsequently overwritten by host sites embedding the library. This is especially concerning for `/Views/Shared` where common file names, such as `_Layout.cshtml`, could easily take priority. This is actually a useful behavior in some contexts, as it allows more flexibility on overriding elements. But it's peculiar that Microsoft applied this to `/wwwroot` but not `/Views` (e.g., by creating some type of assembly based namespacing convention). Having the files buried a couple additional levels is less than ideal organizationally, but at least we can keep the `.cs` files in (children of) the root directory.
  • Loading branch information
JeremyCaney committed Dec 31, 2019
1 parent b9d3ba6 commit 03c2c8c
Show file tree
Hide file tree
Showing 27 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model BooleanAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<div class="@Model.AttributeDescriptor.CssClass form-check form-check-inline">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model DateTimeAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
var includeDatePicker = Model.AttributeDescriptor.IncludeDatePicker?? true;
var includeTimePicker = Model.AttributeDescriptor.IncludeTimePicker?? true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model AttributeViewModel<AttributeDescriptorTopicViewModel>

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<div class="@Model.AttributeDescriptor.CssClass form-check form-check-inline">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model FileListAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

@if (Model.Files.Count > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model FilePathAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model AttributeViewModel<HtmlAttributeTopicViewModel>

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<style type="text/css">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model LastModifiedAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<div class="label">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model LastModifiedByAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<div class="label">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model NestedTopicListAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<script type="text/javascript">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model AttributeViewModel<NumberAttributeTopicViewModel>

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model AttributeViewModel<RelationshipAttributeTopicViewModel>

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
var rootTopicKey = Model.AttributeDescriptor.RootTopic?.UniqueKey.Replace(":", "/") ?? Model.AttributeDescriptor.RootTopicKey?.Replace(":", "/") ?? "Root";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model AttributeViewModel<TextAttributeTopicViewModel>

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model AttributeViewModel<TextAreaAttributeTopicViewModel>

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<textarea
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model TokenizedTopicListAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
var rootTopicKey = Model.AttributeDescriptor.RootTopic?.UniqueKey.Replace(":", "/") ?? Model.AttributeDescriptor.RootTopicKey?.Replace(":", "/") ?? "Root";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model TopicListAttributeViewModel

@{
Layout = "~/Views/Editor/Components/_Layout.cshtml";
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
}

<select
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@model OnTopic.Editor.Models.EditorViewModel

@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "Home Page";
var bindingModel = new EditorBindingModel();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@{
Layout = "~/Areas/Editor/Views/Shared/_Layout.cshtml";
}
3 changes: 0 additions & 3 deletions OnTopic.Editor.AspNetCore/Views/_ViewStart.cshtml

This file was deleted.

0 comments on commit 03c2c8c

Please sign in to comment.