Merge pull request #95 from bjarnef/dev-project-nuget

Add url to NuGet package
This commit is contained in:
Sebastiaan Janssen
2017-01-22 19:06:46 +01:00
committed by GitHub
8 changed files with 102 additions and 10 deletions
@@ -79,6 +79,53 @@
}
.pre {
overflow: auto;
display: block;
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
background-color: #333;
color: #fff;
font-size: 0.8rem;
line-height: 1.4em;
background-clip: padding-box;
padding: 8px 15px 8px 15px;
border-radius: 5px;
width: 100%;
min-width: 300px;
text-align: left;
border: none;
margin: 0 auto;
&:hover {
background: lighten(#333, 5%);
cursor: pointer;
}
}
.pm-nuget {
position: relative;
display: block;
margin: 10px auto 25px auto;
height: 100%;
width: auto;
color: #fff;
&:before {
content:"PM>";
display: block;
position: absolute;
top: 50%;
left: 0;
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
font-size: 0.8rem;
transform: translate(15px, -46%);
opacity: .9;
}
.pre {
padding-left: 45px;
}
}
h2, h3, strong, span {
color: $color-headline;
@@ -109,6 +109,12 @@
@Html.ValidationMessageFor(m => m.SourceCodeUrl)
<small>url to where the source code is stored, (ie: codeplex.com, github.com etc)</small>
</p>
<p>
@Html.LabelFor(m => m.NuGetPackageUrl)
@Html.TextBoxFor(m => m.NuGetPackageUrl)
@Html.ValidationMessageFor(m => m.NuGetPackageUrl)
<small>url to the NuGet package if any available</small>
</p>
<p>
@Html.LabelFor(m => m.BugTrackingUrl)
@Html.TextBoxFor(m => m.BugTrackingUrl)
@@ -4,6 +4,7 @@
@using OurUmbraco.Project
@using OurUmbraco.Project.Services
@using OurUmbraco.Wiki.BusinessLogic
@using System.Text.RegularExpressions;
@{
var project = Model.Content;
@@ -38,6 +39,7 @@
var cs = new ContributionService(ApplicationContext.Current.DatabaseContext);
var contributors = cs.GetContributors(project.Id).ToList();
var nuGetPackageUrl = project.GetPropertyValue<string>("nuGetPackageUrl");
var sourceUrl = project.GetPropertyValue<string>("sourceUrl");
var websiteUrl = project.GetPropertyValue<string>("websiteUrl");
var demoUrl = project.GetPropertyValue<string>("demoUrl");
@@ -255,14 +257,42 @@
<div class="col-md-4 col-md-offset-1">
<div class="package-detail-sidebar">
@if (currentRelease != null)
{
<a href="/FileDownload?id=@currentRelease.Id" class="button green" onclick="ga('PackageMaker.send', 'pageview', window.location.pathname + '/virtual/download/package-files/@(currentRelease.Name.Replace("'", ""))')"><i class="icon-Download-alt"></i>&nbsp;Download package<br/><small>version @project.GetPropertyValue("version")</small></a>
}
else
{
<div class="button green">No current release</div>
}
<div class="package-download">
@if (currentRelease != null)
{
<a href="/FileDownload?id=@currentRelease.Id" class="button green" onclick="ga('PackageMaker.send', 'pageview', window.location.pathname + '/virtual/download/package-files/@(currentRelease.Name.Replace("'", ""))')"><i class="icon-Download-alt"></i>&nbsp;Download package<br/><small>version @project.GetPropertyValue("version")</small></a>
}
else
{
<div class="button green">No current release</div>
}
@if (!string.IsNullOrEmpty(nuGetPackageUrl))
{
Regex regex = new Regex(@"^(http|https)://", RegexOptions.IgnoreCase);
if (!regex.Match(nuGetPackageUrl).Success)
{
nuGetPackageUrl = "http://" + nuGetPackageUrl;
}
var nuGetPackageUri = new Uri(nuGetPackageUrl);
string nuGetPackageCmd = string.Empty;
if (nuGetPackageUri.Segments.Length >= 2)
{
nuGetPackageCmd = nuGetPackageUri.Segments[2].Trim("/");
}
if (!string.IsNullOrEmpty(nuGetPackageCmd))
{
<p class="small">or, install via <a href="@nuGetPackageUrl">nuget</a></p>
<span class="pm-nuget">
<input class="pre nuget" value="Install-Package @nuGetPackageCmd" readonly>
</span>
}
}
</div>
<div class="package-creator">
<h3>Project owner</h3>
@@ -46,12 +46,13 @@ namespace OurUmbraco.MarketPlace.Interfaces
bool OpenForCollab { get; set; }
bool Live { get; set; }
bool Disabled { get; set; }
String SourceCodeUrl { get; set; }
string SourceCodeUrl { get; set; }
string NuGetPackageUrl { get; set; }
int Downloads { get; }
int Karma { get; }
string ProjectUrl { get; set; }
Guid Version { get; }
String LicenseKey { get; set; }
string LicenseKey { get; set; }
int ProjectViews { get; }
}
}
@@ -40,6 +40,7 @@ namespace OurUmbraco.MarketPlace.ListingItem
ProjectUrl = content.GetPropertyValue<string>("websiteUrl", "");
SupportUrl = content.GetPropertyValue<string>("supportUrl", "");
SourceCodeUrl = content.GetPropertyValue<string>("sourceUrl", "");
NuGetPackageUrl = content.GetPropertyValue<string>("nuGetPackageUrl", "");
DemonstrationUrl = content.GetPropertyValue<string>("demoUrl", "");
OpenForCollab = content.GetPropertyValue<bool>("openForCollab", false);
NotAPackage = content.GetPropertyValue<bool>("notAPackage", false);
@@ -110,6 +111,7 @@ namespace OurUmbraco.MarketPlace.ListingItem
public bool NotAPackage { get; set; }
public bool OpenForCollab { get; set; }
public string SourceCodeUrl { get; set; }
public string NuGetPackageUrl { get; set; }
public bool Live { get; set; }
public bool Stable { get; set; }
public bool Approved { get; set; }
@@ -162,6 +162,7 @@ namespace OurUmbraco.MarketPlace.NodeListing
content.SetValue("licenseUrl", listingItem.LicenseUrl);
content.SetValue("supportUrl", listingItem.SupportUrl);
content.SetValue("sourceUrl", listingItem.SourceCodeUrl);
content.SetValue("nuGetPackageUrl", listingItem.NuGetPackageUrl);
content.SetValue("demoUrl", listingItem.DemonstrationUrl);
content.SetValue("openForCollab", listingItem.OpenForCollab);
content.SetValue("notAPackage", listingItem.NotAPackage);
@@ -40,6 +40,7 @@ namespace OurUmbraco.Our.Controllers
model.Description = project.Description;
model.Version = project.CurrentVersion;
model.SourceCodeUrl = project.SourceCodeUrl;
model.NuGetPackageUrl = project.NuGetPackageUrl;
model.DemonstrationUrl = project.DemonstrationUrl;
model.OpenForCollaboration = project.OpenForCollab;
model.GoogleAnalyticsCode = project.GACode;
@@ -83,6 +84,7 @@ namespace OurUmbraco.Our.Controllers
project.LicenseUrl = model.LicenseUrl;
project.ProjectUrl = model.ProjectUrl;
project.SourceCodeUrl = model.SourceCodeUrl;
project.NuGetPackageUrl = model.NuGetPackageUrl;
project.DemonstrationUrl = model.DemonstrationUrl;
project.CategoryId = int.Parse(model.Category);
project.OpenForCollab = model.OpenForCollaboration;
+3
View File
@@ -43,6 +43,9 @@ namespace OurUmbraco.Our.Models
[Display(Name = "Source code URL")]
public string SourceCodeUrl { get; set; }
[Display(Name = "NuGet package URL")]
public string NuGetPackageUrl { get; set; }
[Display(Name = "Bug tracking URL")]
public string BugTrackingUrl { get; set; }