mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-02-03 13:17:33 +00:00
Make release screenshots optional.
This commit is contained in:
parent
6f41a9f80f
commit
e8b18cbf92
3 changed files with 19 additions and 14 deletions
|
@ -145,6 +145,8 @@ namespace Project_Unite.Controllers
|
||||||
//Now the download is saved in the DB. Let's get it on the server.
|
//Now the download is saved in the DB. Let's get it on the server.
|
||||||
model.Download.SaveAs(mapped_dir);
|
model.Download.SaveAs(mapped_dir);
|
||||||
|
|
||||||
|
if (model.Screenshot != null)
|
||||||
|
{
|
||||||
download_dir = "~/Uploads/Releases/Screenshots/";
|
download_dir = "~/Uploads/Releases/Screenshots/";
|
||||||
mapped_dir = Server.MapPath(download_dir);
|
mapped_dir = Server.MapPath(download_dir);
|
||||||
if (!Directory.Exists(mapped_dir))
|
if (!Directory.Exists(mapped_dir))
|
||||||
|
@ -160,6 +162,7 @@ namespace Project_Unite.Controllers
|
||||||
mapped_dir = Server.MapPath(download_dir);
|
mapped_dir = Server.MapPath(download_dir);
|
||||||
download.ScreenshotUrl = download_dir.Remove(0, 1);
|
download.ScreenshotUrl = download_dir.Remove(0, 1);
|
||||||
model.Screenshot.SaveAs(mapped_dir);
|
model.Screenshot.SaveAs(mapped_dir);
|
||||||
|
}
|
||||||
|
|
||||||
//Now we just save to the database...
|
//Now we just save to the database...
|
||||||
db.Downloads.Add(download);
|
db.Downloads.Add(download);
|
||||||
|
|
|
@ -45,7 +45,6 @@ namespace Project_Unite.Models
|
||||||
[Required(ErrorMessage = "You must name your build!")]
|
[Required(ErrorMessage = "You must name your build!")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage ="A screenshot is necessary for getting users into the game.")]
|
|
||||||
[DataType(DataType.Upload)]
|
[DataType(DataType.Upload)]
|
||||||
public HttpPostedFileBase Screenshot { get; set; }
|
public HttpPostedFileBase Screenshot { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,10 @@
|
||||||
<iframe src="http://youtube.com/embed/@Model.DevUpdateId" frameborder="0" allowfullscreen autoplay="true" style="width:720px;height:480px;"></iframe>
|
<iframe src="http://youtube.com/embed/@Model.DevUpdateId" frameborder="0" allowfullscreen autoplay="true" style="width:720px;height:480px;"></iframe>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(Model.ScreenshotUrl))
|
||||||
|
{
|
||||||
<img src="@Model.ScreenshotUrl" style="width:auto;height:auto;max-width:100%" />
|
<img src="@Model.ScreenshotUrl" style="width:auto;height:auto;max-width:100%" />
|
||||||
|
}
|
||||||
|
|
||||||
@Html.Markdown(Model.Changelog)
|
@Html.Markdown(Model.Changelog)
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue