Added icon to edit

Added edit link to success notification
This commit is contained in:
2014-01-21 15:11:10 -05:00
parent 9c2149d52c
commit 0ef5199048
4 changed files with 31 additions and 19 deletions
+4 -1
View File
@@ -109,6 +109,8 @@ namespace MileageTraker.Web.Controllers
.First(pt => pt.PurposeTypeId == model.Purpose.Selected); .First(pt => pt.PurposeTypeId == model.Purpose.Selected);
DataService.AddLog(log); DataService.AddLog(log);
var editLink = Url.Action("EditPast", "CreateLog", new {id = log.LogId});
TempData["StatusMessage-Type"] = "alert-success"; TempData["StatusMessage-Type"] = "alert-success";
TempData["StatusMessage"] = TempData["StatusMessage"] =
@"You've successfully created an entry @"You've successfully created an entry
@@ -117,7 +119,8 @@ namespace MileageTraker.Web.Controllers
on <strong>" + model.Date.ToShortDateString() + @"</strong> on <strong>" + model.Date.ToShortDateString() + @"</strong>
in Vehicle Id <strong>" + model.VehicleId + @"</strong> in Vehicle Id <strong>" + model.VehicleId + @"</strong>
ending in <strong>" + model.EndOdometer + @"</strong> ending in <strong>" + model.EndOdometer + @"</strong>
miles on the odometer."; miles on the odometer. " +
@"<a href='" + editLink + @"' class='btn btn-mini btn-success'>Edit</a>";
return RedirectToAction("Index"); return RedirectToAction("Index");
} }
+19 -15
View File
@@ -103,24 +103,28 @@ $(function() {
}); });
}); });
$(function () { function addButtonIcons () {
var textToIcon = { var textToIcon = {
'Edit': 'edit', 'Edit': 'edit',
'Filter': 'filter', 'Filter': 'filter',
'Details' : 'zoom-in', 'Details' : 'zoom-in',
'Delete': 'trash', 'Delete': 'trash',
'Add': 'plus', 'Add': 'plus',
'Export': 'download', 'Export': 'download',
'Driver Mileage': 'user', 'Driver Mileage': 'user',
'Vehicle Mileage': 'car' 'Vehicle Mileage': 'car'
}; };
$.each(textToIcon, function(text, icon) { $.each(textToIcon, function(text, icon) {
$("a:contains('" + text + "')") $("a:contains('" + text + "'):not(:has(i))")
.prepend('<i class="icon-' + icon + '" /> '); .prepend('<i class="icon-' + icon + '" /> ');
}); });
$(".navbar-inverse a[title='Manage']") $(".navbar-inverse a[title='Manage']:not(:has(i))")
.prepend('<i class="icon-user icon-white" /> '); .prepend('<i class="icon-user icon-white" /> ');
}
$(function () {
addButtonIcons();
}); });
// Convert MVC3 WebGrid paging to Bootstrap // Convert MVC3 WebGrid paging to Bootstrap
+2 -2
View File
@@ -15,8 +15,8 @@
@Html.Partial("_ValidationSummary") @Html.Partial("_ValidationSummary")
@Html.EditorForModel() @Html.EditorForModel()
<div class="form-actions"> <div class="form-actions">
<input type="submit" value="Submit" class="btn btn-primary" /> <input type="submit" value="Update" class="btn btn-primary" />
@Html.ActionLink("Cancel", "Index", new {}, new { @class = "btn" }) @Html.ActionLink("Cancel", "Index", new {}, new { @class = "btn btn-mini" })
</div> </div>
</fieldset> </fieldset>
} }
+6 -1
View File
@@ -39,6 +39,7 @@
@Html.Encode(log.LogType.Enum.GetDisplayShortName()) @Html.Encode(log.LogType.Enum.GetDisplayShortName())
</td> </td>
<td> <td>
<div class='btn-group'>
@if (log.Date >= DomainRules.GetLogEntryCutoff()) @if (log.Date >= DomainRules.GetLogEntryCutoff())
{ {
@Html.ActionLink("Edit", "EditPast", new {id = log.LogId}, new {@class = "btn btn-mini"}) @Html.ActionLink("Edit", "EditPast", new {id = log.LogId}, new {@class = "btn btn-mini"})
@@ -47,6 +48,7 @@
{ {
@Html.ActionLink("Edit", "EditPast", new {id = log.LogId}, new {@class = "btn btn-mini disabled", title="Previous Month" }) @Html.ActionLink("Edit", "EditPast", new {id = log.LogId}, new {@class = "btn btn-mini disabled", title="Previous Month" })
} }
</div>
</td> </td>
</tr> </tr>
} }
@@ -57,5 +59,8 @@ else
<p>Mileage history not found for <strong>@ViewData["name"]</strong></p> <p>Mileage history not found for <strong>@ViewData["name"]</strong></p>
} }
<script type="text/javascript"> <script type="text/javascript">
$('a.btn.disabled').prop('disabled', true).removeAttr('href'); $(function () {
$('a.btn.disabled').prop('disabled', true).removeAttr('href');
addButtonIcons();
});
</script> </script>