mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-23 01:32:16 +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,21 +145,24 @@ public ActionResult AddRelease(PostDownloadViewModel model)
|
|||
//Now the download is saved in the DB. Let's get it on the server.
|
||||
model.Download.SaveAs(mapped_dir);
|
||||
|
||||
download_dir = "~/Uploads/Releases/Screenshots/";
|
||||
mapped_dir = Server.MapPath(download_dir);
|
||||
if (!Directory.Exists(mapped_dir))
|
||||
Directory.CreateDirectory(mapped_dir);
|
||||
|
||||
file_name_d = model.Screenshot.FileName.ToLower(); ;
|
||||
foreach (var c in file_name_d.ToCharArray())
|
||||
if (model.Screenshot != null)
|
||||
{
|
||||
if (!ApprovedIdChars.Contains(c))
|
||||
file_name_d = file_name_d.Replace(c, '_');
|
||||
download_dir = "~/Uploads/Releases/Screenshots/";
|
||||
mapped_dir = Server.MapPath(download_dir);
|
||||
if (!Directory.Exists(mapped_dir))
|
||||
Directory.CreateDirectory(mapped_dir);
|
||||
|
||||
file_name_d = model.Screenshot.FileName.ToLower(); ;
|
||||
foreach (var c in file_name_d.ToCharArray())
|
||||
{
|
||||
if (!ApprovedIdChars.Contains(c))
|
||||
file_name_d = file_name_d.Replace(c, '_');
|
||||
}
|
||||
download_dir += file_name_d;
|
||||
mapped_dir = Server.MapPath(download_dir);
|
||||
download.ScreenshotUrl = download_dir.Remove(0, 1);
|
||||
model.Screenshot.SaveAs(mapped_dir);
|
||||
}
|
||||
download_dir += file_name_d;
|
||||
mapped_dir = Server.MapPath(download_dir);
|
||||
download.ScreenshotUrl = download_dir.Remove(0,1);
|
||||
model.Screenshot.SaveAs(mapped_dir);
|
||||
|
||||
//Now we just save to the database...
|
||||
db.Downloads.Add(download);
|
||||
|
|
|
@ -45,7 +45,6 @@ public class PostDownloadViewModel
|
|||
[Required(ErrorMessage = "You must name your build!")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage ="A screenshot is necessary for getting users into the game.")]
|
||||
[DataType(DataType.Upload)]
|
||||
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>
|
||||
|
||||
}
|
||||
@if (!string.IsNullOrWhiteSpace(Model.ScreenshotUrl))
|
||||
{
|
||||
<img src="@Model.ScreenshotUrl" style="width:auto;height:auto;max-width:100%" />
|
||||
}
|
||||
|
||||
@Html.Markdown(Model.Changelog)
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue