make history table cells align in the middle rather than top (included in site.css)
correct bug in file upload where someone clicks upload without choosing a file! added alternating icon in history table for expanding rows on click, will now show plus when minimised, minus when expanded.
This commit is contained in:
parent
38cfb67f62
commit
7fbcba58ba
@ -38,27 +38,30 @@ namespace RaceLapTimer.ApiControllers
|
|||||||
Directory.CreateDirectory(uploadDirectory);
|
Directory.CreateDirectory(uploadDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
var file = Request.Files.First();
|
if (Request.Files.Any())
|
||||||
|
|
||||||
var newFileName = Guid.NewGuid();
|
|
||||||
var generatedFileName = string.Format("{0}{1}", newFileName, Path.GetExtension(file.Name)); //0000-0000.....ext
|
|
||||||
|
|
||||||
var filename = Path.Combine(uploadDirectory, generatedFileName);
|
|
||||||
|
|
||||||
using (var fileStream = new FileStream(filename, FileMode.Create))
|
|
||||||
{
|
{
|
||||||
file.Value.CopyTo(fileStream);
|
var file = Request.Files.First();
|
||||||
fileStream.Flush();
|
|
||||||
fileStream.Close();
|
var newFileName = Guid.NewGuid();
|
||||||
|
var generatedFileName = string.Format("{0}{1}", newFileName, Path.GetExtension(file.Name)); //0000-0000.....ext
|
||||||
|
|
||||||
|
var filename = Path.Combine(uploadDirectory, generatedFileName);
|
||||||
|
|
||||||
|
using (var fileStream = new FileStream(filename, FileMode.Create))
|
||||||
|
{
|
||||||
|
file.Value.CopyTo(fileStream);
|
||||||
|
fileStream.Flush();
|
||||||
|
fileStream.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
pilot.ImageUrl = "/images/" + generatedFileName;
|
||||||
|
_provider.UpdatePilot(pilot);
|
||||||
|
|
||||||
|
File.Delete(Path.Combine(uploadDirectory, oldImagePath));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pilot.ImageUrl = "/images/" + generatedFileName;
|
|
||||||
_provider.UpdatePilot(pilot);
|
|
||||||
|
|
||||||
File.Delete(Path.Combine(uploadDirectory, oldImagePath));
|
|
||||||
|
|
||||||
string returnurl = "/pilot/edit/" + pilotId;
|
string returnurl = "/pilot/edit/" + pilotId;
|
||||||
return Context.GetRedirect(returnurl);
|
return Context.GetRedirect(returnurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private dynamic DeletePilot(dynamic args)
|
private dynamic DeletePilot(dynamic args)
|
||||||
|
|||||||
@ -166,7 +166,9 @@
|
|||||||
<None Include="www\Views\EditPilot.cshtml">
|
<None Include="www\Views\EditPilot.cshtml">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="www\Views\History.cshtml" />
|
<None Include="www\Views\History.cshtml">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="www\Views\HistoryIndex.cshtml">
|
<None Include="www\Views\HistoryIndex.cshtml">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@ -191,7 +193,9 @@
|
|||||||
<None Include="www\Views\secure.cshtml">
|
<None Include="www\Views\secure.cshtml">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="www\Views\SystemIndex.cshtml" />
|
<None Include="www\Views\SystemIndex.cshtml">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -218,6 +222,9 @@
|
|||||||
<Content Include="www\css\login.css">
|
<Content Include="www\css\login.css">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="www\css\site.css">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="www\css\stickyfooter.css">
|
<Content Include="www\css\stickyfooter.css">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
ViewBag.Title = "History";
|
ViewBag.Title = "History";
|
||||||
}
|
}
|
||||||
<h3>@ViewBag.Title</h3>
|
<h3>@ViewBag.Title</h3>
|
||||||
|
<link rel="stylesheet" href="css/site.css"/>
|
||||||
|
|
||||||
<table class="table table-striped dataTable">
|
<table class="table table-striped dataTable">
|
||||||
<thead>
|
<thead>
|
||||||
@ -17,17 +18,19 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody data-bind="foreach: sessions, visible: sessions().length > 0">
|
<tbody data-bind="foreach: sessions, visible: sessions().length > 0">
|
||||||
<tr data-toggle="collapse" data-bind="attr: { 'data-target': '#collapse' + id() }">
|
<tr data-toggle="collapse" data-bind="attr: { 'data-target': '#collapse' + id() }, click: function(){return $root.toggleIcon('#expIcon'+id())}">
|
||||||
<td class="text-center" data-bind="text: id"></td>
|
<td class="text-center vertical-center"><span data-bind="text: id"></span></td>
|
||||||
<td class="col-md-2" data-bind="text: createdDate">June 16, 2017 19:07</td>
|
<td class="col-md-2 vertical-center"><span data-bind="text: createdDate"></span></td>
|
||||||
<td data-bind="text: title">Race Name 1</td>
|
<td class="vertical-center" data-bind="text: title">Race Name 1</td>
|
||||||
<td class="col-md-1" data-bind="text: mode">standard</td>
|
<td class="col-md-1 vertical-center" data-bind="text: mode">standard</td>
|
||||||
<td class="text-center col-md-1" >5</td>
|
<td class="text-center col-md-1 vertical-center" >5</td>
|
||||||
<td class="col-md-3 text-center">
|
<td class="col-md-3 text-center">
|
||||||
<button type="button" class="btn btn-warning" data-bind="click: $root.deleteSession">Delete</button>
|
<button type="button" class="btn btn-warning" data-bind="click: $root.deleteSession">Delete</button>
|
||||||
<button type="button" class="btn btn-default">Export as PDF</button>
|
<button type="button" class="btn btn-default">Export as PDF</button>
|
||||||
</td>
|
</td>
|
||||||
<td><span class="glyphicon glyphicon-plus"></span></td>
|
<td class="vertical-center">
|
||||||
|
<span data-bind="attr:{id:'expIcon'+id()}" class="glyphicon glyphicon-plus"></span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="collapse" data-bind="attr:{ id: 'collapse' + id()}">
|
<tr class="collapse" data-bind="attr:{ id: 'collapse' + id()}">
|
||||||
<td colspan="6">
|
<td colspan="6">
|
||||||
|
|||||||
3
RaceLapTimer/RaceLapTimer/www/css/site.css
Normal file
3
RaceLapTimer/RaceLapTimer/www/css/site.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.table>tbody>tr>td.vertical-center {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
@ -13,19 +13,26 @@
|
|||||||
var mappedSessions = $.map(allData.data, function (item) { return new RaceSession(item) });
|
var mappedSessions = $.map(allData.data, function (item) { return new RaceSession(item) });
|
||||||
self.sessions(mappedSessions);
|
self.sessions(mappedSessions);
|
||||||
});
|
});
|
||||||
|
self.toggleIcon = function(e) {
|
||||||
|
$(e).toggleClass("glyphicon-plus glyphicon-minus");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
ko.applyBindings(new ViewModel());
|
ko.applyBindings(new ViewModel());
|
||||||
function toggleIcon(e) {
|
function toggleIcon(e) {
|
||||||
$(e.target)
|
$(e.target)
|
||||||
.toggleClass("glyphicon-plus glyphicon-minus");
|
.toggleClass("glyphicon-plus glyphicon-minus");
|
||||||
}
|
}
|
||||||
$(".dataTable").on("hidden.bs.collapse",
|
//$(".dataTable").on("hidden.bs.collapse",
|
||||||
function toggleIcon(e) {
|
// function toggleIcon(e) {
|
||||||
$(e.target)
|
// $(e.target)
|
||||||
.toggleClass("glyphicon-plus glyphicon-minus");
|
// .find("tr.collapse")
|
||||||
});
|
// .find("td")
|
||||||
$(".dataTable").on("shown.bs.collapse",
|
// .toggleClass("glyphicon-plus glyphicon-minus");
|
||||||
function toggleIcon(e) {
|
// });
|
||||||
$(e.target)
|
//$(".dataTable").on("shown.bs.collapse",
|
||||||
.toggleClass("glyphicon-plus glyphicon-minus");
|
// function toggleIcon(e) {
|
||||||
});
|
// $(e.target)
|
||||||
|
// .find("tr.collapse")
|
||||||
|
// .find("td")
|
||||||
|
// .toggleClass("glyphicon-plus glyphicon-minus");
|
||||||
|
// });
|
||||||
Loading…
Reference in New Issue
Block a user