Skip to content

Commit

Permalink
Merge pull request #354 from hargata/Hargata/gas.search
Browse files Browse the repository at this point in the history
deprecated pinned notes
  • Loading branch information
hargata committed Mar 1, 2024
2 parents b8b545a + 993c271 commit bcf3c3d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Views/Home/_GarageDisplay.cshtml
Expand Up @@ -28,7 +28,7 @@
<div class="row gy-3 align-items-stretch vehiclesContainer">
@foreach (Vehicle vehicle in Model)
{
<div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-4 user-select-none garage-item" ondragover="dragOver(event)" ondrop="dropBox(event, @vehicle.Id)" draggable="true" ondragstart="dragStart(event, @vehicle.Id)" data-tags='@string.Join(" ", vehicle.Tags)' id="gridVehicle_@vehicle.Id" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-trigger="manual" onmouseenter="loadPinnedNotes(@vehicle.Id)" ontouchstart="loadPinnedNotes(@vehicle.Id)" ontouchcancel="hidePinnedNotes(@vehicle.Id)" ontouchend="hidePinnedNotes(@vehicle.Id)" onmouseleave="hidePinnedNotes(@vehicle.Id)">
<div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-4 user-select-none garage-item" ondragover="dragOver(event)" ondrop="dropBox(event, @vehicle.Id)" draggable="true" ondragstart="dragStart(event, @vehicle.Id)" data-tags='@string.Join(" ", vehicle.Tags)' id="gridVehicle_@vehicle.Id" data-bs-toggle="tooltip" data-bs-html="true" data-bs-title="@await Html.PartialAsync("_VehicleExtraFields", vehicle.ExtraFields)" data-bs-placement="bottom" data-bs-trigger="manual" onmouseenter="loadPinnedNotes(@vehicle.Id)" ontouchstart="loadPinnedNotes(@vehicle.Id)" ontouchcancel="hidePinnedNotes(@vehicle.Id)" ontouchend="hidePinnedNotes(@vehicle.Id)" onmouseleave="hidePinnedNotes(@vehicle.Id)">
<div class="card" onclick="viewVehicle(@vehicle.Id)">
<img src="@vehicle.ImageLocation" style="height:145px; object-fit:scale-down; pointer-events:none; @(string.IsNullOrWhiteSpace(vehicle.SoldDate) ? "" : "filter: grayscale(100%);")" />
@if (!string.IsNullOrWhiteSpace(vehicle.SoldDate))
Expand Down
10 changes: 10 additions & 0 deletions Views/Home/_VehicleExtraFields.cshtml
@@ -0,0 +1,10 @@
@model List<ExtraField>
@if (Model.Any())
{
<ul class='list-group list-group-flush'>
@foreach (ExtraField field in Model)
{
<li><b>@field.Name</b> : @field.Value</li>
}
</ul>
}
23 changes: 2 additions & 21 deletions wwwroot/js/garage.js
Expand Up @@ -173,27 +173,8 @@ function performLogOut() {
}
function loadPinnedNotes(vehicleId) {
var hoveredGrid = $(`#gridVehicle_${vehicleId}`);
if (hoveredGrid.attr("data-bs-title") == undefined) {
$.get(`/Vehicle/GetPinnedNotesByVehicleId?vehicleId=${vehicleId}`, function (data) {
if (data.length > 0) {
//converted pinned notes to html.
var htmlString = "<ul class='list-group list-group-flush'>";
data.forEach(x => {
htmlString += `<li><b>${x.description}</b> : ${x.noteText}</li>`;
});
htmlString += "</ul>";
hoveredGrid.attr("data-bs-title", htmlString);
new bootstrap.Tooltip(hoveredGrid);
hoveredGrid.tooltip("show");
} else {
//disable the tooltip
hoveredGrid.attr("data-bs-title", "");
}
});
} else {
if (hoveredGrid.attr("data-bs-title") != '') {
hoveredGrid.tooltip("show");
}
if (hoveredGrid.attr("data-bs-title") != '') {
hoveredGrid.tooltip("show");
}
}
function hidePinnedNotes(vehicleId) {
Expand Down

0 comments on commit bcf3c3d

Please sign in to comment.