forked from NuGet/NuGetGallery
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replacing RazorGenerator custom tool with msbuild task
- Loading branch information
Showing
53 changed files
with
176 additions
and
8,817 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<PropertyGroup> | |||
<RazorGeneratorMsBuildPath Condition=" '$(RazorGeneratorMsBuildPath)' == '' ">$(MSBuildThisFileDirectory)\RazorGenerator.MsBuild.dll</RazorGeneratorMsBuildPath> | |||
|
|||
<CompileDependsOn> | |||
PrecompileRazorFiles; | |||
$(CompileDependsOn); | |||
</CompileDependsOn> | |||
</PropertyGroup> | |||
|
|||
<UsingTask AssemblyFile="$(RazorGeneratorMsBuildPath)" TaskName="RazorCodeGen" /> | |||
<Target Name="PrecompileRazorFiles" Returns="@(FilesGenerated)"> | |||
<ItemGroup> | |||
<RazorSrcFiles Include="**\*.cshtml" /> | |||
</ItemGroup> | |||
<RazorCodeGen ProjectRoot="$(MsBuildProjectDirectory)" FilesToPrecompile="@(RazorSrcFiles)" RootNamespace="$(RootNamespace)"> | |||
<Output TaskParameter="GeneratedFiles" ItemName="FilesGenerated" /> | |||
</RazorCodeGen> | |||
<ItemGroup> | |||
<Compile Include="@(FilesGenerated)" /> | |||
</ItemGroup> | |||
</Target> | |||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
186 changes: 94 additions & 92 deletions
186
Website/Views/Helpers/ViewHelpers.cshtml → Website/App_Code/ViewHelpers.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,93 +1,95 @@ | |||
@* Generator: MvcHelper *@ | @* Generator: MvcHelper *@ | ||
|
|
||
@using System.Linq; | @using System.Linq; | ||
@using System.Collections; | @using System.Collections; | ||
@using NuGetGallery; | @using System.Web.Mvc; | ||
|
@using Microsoft.Web.Helpers; | ||
@helper PreviousNextPager(IPreviousNextPager pager) { | @using NuGetGallery; | ||
if (pager.HasNextPage || pager.HasPreviousPage) { |
|
||
<ul class="pager"> | @helper PreviousNextPager(IPreviousNextPager pager) { | ||
<li class="previous"> | if (pager.HasNextPage || pager.HasPreviousPage) { | ||
@if (pager.HasPreviousPage) { | <ul class="pager"> | ||
<a href="@pager.PreviousPageUrl" title="Go to the previous page.">Previous</a> | <li class="previous"> | ||
} | @if (pager.HasPreviousPage) { | ||
else { | <a href="@pager.PreviousPageUrl" title="Go to the previous page.">Previous</a> | ||
<text>Previous</text> | } | ||
} | else { | ||
</li> | <text>Previous</text> | ||
<li class="next"> | } | ||
@if (pager.HasNextPage) { | </li> | ||
<a href="@pager.NextPageUrl" title="Go to the next page.">Next</a> | <li class="next"> | ||
} | @if (pager.HasNextPage) { | ||
else { | <a href="@pager.NextPageUrl" title="Go to the next page.">Next</a> | ||
<text>Next</text> | } | ||
} | else { | ||
</li> | <text>Next</text> | ||
</ul> | } | ||
} | </li> | ||
} | </ul> | ||
|
} | ||
@helper Option(string value, string label, string currentValue) { | } | ||
<option value="@value" @if (value == currentValue) {<text>selected="selected"</text>}>@label</option> |
|
||
} | @helper Option(string value, string label, string currentValue) { | ||
|
<option value="@value" @if (value == currentValue) {<text>selected="selected"</text>}>@label</option> | ||
@helper UploadSequence(int currentStep) { | } | ||
<ol class="sequence"> |
|
||
@SequenceStep(1, "Upload", currentStep) | @helper UploadSequence(int currentStep) { | ||
@SequenceStep(2, "Verify Details", currentStep) | <ol class="sequence"> | ||
@SequenceStep(3, "Enjoy", currentStep) | @SequenceStep(1, "Upload", currentStep) | ||
</ol> | @SequenceStep(2, "Verify Details", currentStep) | ||
<div class="clear-fix"><!--Sad Panda--></div> | @SequenceStep(3, "Enjoy", currentStep) | ||
} | </ol> | ||
|
<div class="clear-fix"><!--Sad Panda--></div> | ||
@helper SequenceStep(int step, string caption, int currentStep) { | } | ||
if (currentStep > step) { |
|
||
<li class="past">@caption</li> | @helper SequenceStep(int step, string caption, int currentStep) { | ||
} | if (currentStep > step) { | ||
else if (currentStep == step) { | <li class="past">@caption</li> | ||
<li class="current">@caption</li> | } | ||
} | else if (currentStep == step) { | ||
else { | <li class="current">@caption</li> | ||
<li>@caption</li> | } | ||
} | else { | ||
} | <li>@caption</li> | ||
|
} | ||
@helper OwnersGravatar(IEnumerable<User> owners, int size, UrlHelper url, bool showName = true) { | } | ||
<ul class="owners"> |
|
||
@foreach (var owner in owners) { | @helper OwnersGravatar(IEnumerable<User> owners, int size, UrlHelper url, bool showName = true) { | ||
<li> | <ul class="owners"> | ||
@ViewHelpers.OwnerGravatar(owner, size, url, showName) | @foreach (var owner in owners) { | ||
</li> | <li> | ||
} | @ViewHelpers.OwnerGravatar(owner, size, url, showName) | ||
</ul> | </li> | ||
} | } | ||
|
</ul> | ||
@helper OwnerGravatar(User owner, int size, UrlHelper url, bool showName = true) { | } | ||
<a class="owner" href="@url.Action(MVC.Users.Profiles(owner.Username))" title="@owner.Username"> |
|
||
@GravatarImage(owner.EmailAddress, owner.Username, size) | @helper OwnerGravatar(User owner, int size, UrlHelper url, bool showName = true) { | ||
@if (showName) { | <a class="owner" href="@url.Action(MVC.Users.Profiles(owner.Username))" title="@owner.Username"> | ||
<text>@owner.Username</text> | @GravatarImage(owner.EmailAddress, owner.Username, size) | ||
} | @if (showName) { | ||
</a> | <text>@owner.Username</text> | ||
} | } | ||
|
</a> | ||
@helper GravatarImage(string email, string username, int size) { | } | ||
<text> |
|
||
@Gravatar.GetHtml(email, size, "retro", GravatarRating.G, attributes: new { width = size, height = size, title = username, @class = "owner-image" }) | @helper GravatarImage(string email, string username, int size) { | ||
</text> | <text> | ||
} | @Gravatar.GetHtml(email, size, "retro", GravatarRating.G, attributes: new { width = size, height = size, title = username, @class = "owner-image" }) | ||
|
</text> | ||
@helper ReleaseTag(){ | } | ||
string name = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseName"]; |
|
||
string sha = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseSha"]; | @helper ReleaseTag(){ | ||
string branch = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseBranch"]; | string name = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseName"]; | ||
string time = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseTime"]; | string sha = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseSha"]; | ||
if(!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(sha) && !String.IsNullOrEmpty(branch) && !String.IsNullOrEmpty(time)){ | string branch = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseBranch"]; | ||
<p id="releaseTag"> | string time = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseTime"]; | ||
@name - | if(!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(sha) && !String.IsNullOrEmpty(branch) && !String.IsNullOrEmpty(time)){ | ||
Deployed from <a href="https://github.com/NuGet/NuGetGallery/commit/@sha" title="View the commit.">@sha.Substring(0,10)</a> | <p id="releaseTag"> | ||
on <a href="https://github.com/NuGet/NuGetGallery/branches/@branch" title="View the branch.">@branch</a> | @name - | ||
at @time. | Deployed from <a href="https://github.com/NuGet/NuGetGallery/commit/@sha" title="View the commit.">@sha.Substring(0,10)</a> | ||
</p> | on <a href="https://github.com/NuGet/NuGetGallery/branches/@branch" title="View the branch.">@branch</a> | ||
} | at @time. | ||
</p> | |||
} | |||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.