diff --git a/Views/Vehicle/_CollisionRecords.cshtml b/Views/Vehicle/_CollisionRecords.cshtml index 3fb54b1..cd57214 100644 --- a/Views/Vehicle/_CollisionRecords.cshtml +++ b/Views/Vehicle/_CollisionRecords.cshtml @@ -68,7 +68,7 @@ @foreach (CollisionRecord collisionRecord in Model) { - + @collisionRecord.Date.ToShortDateString() @collisionRecord.Mileage @collisionRecord.Description diff --git a/Views/Vehicle/_Gas.cshtml b/Views/Vehicle/_Gas.cshtml index 2324266..3f8abd3 100644 --- a/Views/Vehicle/_Gas.cshtml +++ b/Views/Vehicle/_Gas.cshtml @@ -112,7 +112,7 @@ @foreach (GasRecordViewModel gasRecord in Model.GasRecords) { - + @gasRecord.Date @gasRecord.Mileage @(gasRecord.DeltaMileage == default ? "---" : gasRecord.DeltaMileage) diff --git a/Views/Vehicle/_Notes.cshtml b/Views/Vehicle/_Notes.cshtml index 25f9739..32618f9 100644 --- a/Views/Vehicle/_Notes.cshtml +++ b/Views/Vehicle/_Notes.cshtml @@ -44,7 +44,7 @@ @foreach (Note note in Model) { - + @if (note.Pinned) { @note.Description diff --git a/Views/Vehicle/_OdometerRecords.cshtml b/Views/Vehicle/_OdometerRecords.cshtml index 2b10254..dc19d2f 100644 --- a/Views/Vehicle/_OdometerRecords.cshtml +++ b/Views/Vehicle/_OdometerRecords.cshtml @@ -65,7 +65,7 @@ @foreach (OdometerRecord odometerRecord in Model) { - + @odometerRecord.Date.ToShortDateString() @odometerRecord.Mileage @CarCareTracker.Helper.StaticHelper.TruncateStrings(odometerRecord.Notes, 75) diff --git a/Views/Vehicle/_ReminderRecords.cshtml b/Views/Vehicle/_ReminderRecords.cshtml index c57ae23..2fb11e6 100644 --- a/Views/Vehicle/_ReminderRecords.cshtml +++ b/Views/Vehicle/_ReminderRecords.cshtml @@ -45,7 +45,7 @@ @foreach (ReminderRecordViewModel reminderRecord in Model) { - + @if (reminderRecord.Urgency == ReminderUrgency.VeryUrgent) { @translator.Translate(userLanguage, "Very Urgent") diff --git a/Views/Vehicle/_ServiceRecords.cshtml b/Views/Vehicle/_ServiceRecords.cshtml index db74d4f..4e1f8a5 100644 --- a/Views/Vehicle/_ServiceRecords.cshtml +++ b/Views/Vehicle/_ServiceRecords.cshtml @@ -68,7 +68,7 @@ @foreach (ServiceRecord serviceRecord in Model) { - + @serviceRecord.Date.ToShortDateString() @serviceRecord.Mileage @serviceRecord.Description diff --git a/Views/Vehicle/_SupplyRecords.cshtml b/Views/Vehicle/_SupplyRecords.cshtml index 6ec35ac..ab20a38 100644 --- a/Views/Vehicle/_SupplyRecords.cshtml +++ b/Views/Vehicle/_SupplyRecords.cshtml @@ -70,7 +70,7 @@ @foreach (SupplyRecord supplyRecord in Model) { - + @supplyRecord.Date.ToShortDateString() @supplyRecord.PartNumber @supplyRecord.PartSupplier diff --git a/Views/Vehicle/_TaxRecords.cshtml b/Views/Vehicle/_TaxRecords.cshtml index b35f850..ae21988 100644 --- a/Views/Vehicle/_TaxRecords.cshtml +++ b/Views/Vehicle/_TaxRecords.cshtml @@ -67,7 +67,7 @@ @foreach (TaxRecord taxRecord in Model) { - + @taxRecord.Date.ToShortDateString() @taxRecord.Description @((hideZero && taxRecord.Cost == default) ? "---" : taxRecord.Cost.ToString("C")) diff --git a/Views/Vehicle/_UpgradeRecords.cshtml b/Views/Vehicle/_UpgradeRecords.cshtml index f934763..3565775 100644 --- a/Views/Vehicle/_UpgradeRecords.cshtml +++ b/Views/Vehicle/_UpgradeRecords.cshtml @@ -68,7 +68,7 @@ @foreach (UpgradeRecord upgradeRecord in Model) { - + @upgradeRecord.Date.ToShortDateString() @upgradeRecord.Mileage @upgradeRecord.Description diff --git a/wwwroot/js/shared.js b/wwwroot/js/shared.js index 9b19821..361b1ca 100644 --- a/wwwroot/js/shared.js +++ b/wwwroot/js/shared.js @@ -663,6 +663,9 @@ function isRightClick(e) { } return false; } +function stopEvent() { + event.stopPropagation(); +} function rangeMouseUp(e) { if ($(".table-context-menu").length > 0) { $(".table-context-menu").hide(); diff --git a/wwwroot/lib/bootstrap-tagsinput/bootstrap-tagsinput.js b/wwwroot/lib/bootstrap-tagsinput/bootstrap-tagsinput.js index 23a9ebc..648c9ba 100644 --- a/wwwroot/lib/bootstrap-tagsinput/bootstrap-tagsinput.js +++ b/wwwroot/lib/bootstrap-tagsinput/bootstrap-tagsinput.js @@ -363,6 +363,13 @@ }, 250); } break; + //ENTER EVENT + case 13: + case 32: + var tagToAdd = $input.val(); + $input.val(''); + self.add(tagToAdd); + break; default: // ignore } @@ -374,53 +381,18 @@ $input.attr('size', Math.max(this.inputSize, size)); }, self)); - self.$container.on('input', 'input', $.proxy(function (event) { - if (event.originalEvent.data == undefined) { - var $input = $(event.target); - var text = $input.val(), - maxLengthReached = self.options.maxChars && text.length >= self.options.maxChars; - if (self.options.freeInput && (keyCombinationInList(event, self.options.confirmKeys) || maxLengthReached)) { - //check if confirm keys are in input and then replace them. - event.preventDefault(); - text = text.replace(String.fromCharCode(event.which), "") - // Only attempt to add a tag if there is data in the field - if (text.length !== 0) { - self.add(maxLengthReached ? text.substr(0, self.options.maxChars) : text); - $input.val(''); - } - } - var textLength = $input.val().length, - wordSpace = Math.ceil(textLength / 5), - size = textLength + wordSpace + 1; - $input.attr('size', Math.max(this.inputSize, size)); - }; - })); - - self.$container.on('keypress', 'input', $.proxy(function(event) { - var $input = $(event.target); - - if (self.$element.attr('disabled')) { - self.$input.attr('disabled', 'disabled'); - return; - } - var text = $input.val(), - maxLengthReached = self.options.maxChars && text.length >= self.options.maxChars; - if (self.options.freeInput && (keyCombinationInList(event, self.options.confirmKeys) || maxLengthReached)) { - //check if confirm keys are in input and then replace them. - event.preventDefault(); - text = text.replace(String.fromCharCode(event.which), ""); - // Only attempt to add a tag if there is data in the field - if (text.length !== 0) { - self.add(maxLengthReached ? text.substr(0, self.options.maxChars) : text); - $input.val(''); - } - } - - // Reset internal input's size - var textLength = $input.val().length, - wordSpace = Math.ceil(textLength / 5), - size = textLength + wordSpace + 1; - $input.attr('size', Math.max(this.inputSize, size)); + self.$container.on('input', 'input', $.proxy(function(event) { + var $input = $(event.target); + //check if the previous inserted value was a space. + var text = $input.val(); + if (text.length > 0) { + var lastChar = text.charAt(text.length - 1); + if (lastChar == " ") { + text = text.replace(" ", ""); + self.add(text); + $input.val(''); + } + } }, self)); // Remove icon clicked @@ -577,33 +549,4 @@ } return (iCaretPos); } - - /** - * Returns boolean indicates whether user has pressed an expected key combination. - * @param object keyPressEvent: JavaScript event object, refer - * http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html - * @param object lookupList: expected key combinations, as in: - * [13, {which: 188, shiftKey: true}] - */ - function keyCombinationInList(keyPressEvent, lookupList) { - var found = false; - $.each(lookupList, function (index, keyCombination) { - if (typeof (keyCombination) === 'number' && keyPressEvent.which === keyCombination) { - found = true; - return false; - } - - if (keyPressEvent.which === keyCombination.which) { - var alt = !keyCombination.hasOwnProperty('altKey') || keyPressEvent.altKey === keyCombination.altKey, - shift = !keyCombination.hasOwnProperty('shiftKey') || keyPressEvent.shiftKey === keyCombination.shiftKey, - ctrl = !keyCombination.hasOwnProperty('ctrlKey') || keyPressEvent.ctrlKey === keyCombination.ctrlKey; - if (alt && shift && ctrl) { - found = true; - return false; - } - } - }); - - return found; - } })(window.jQuery);