Permalink
Browse files

Updated UI to use Bootstrap

  • Loading branch information...
1 parent 40b524b commit 7c220dd52fee7a5ac9864fa2cf03949a302da73a @johnzablocki johnzablocki committed May 15, 2012
@@ -1,62 +1,3 @@
-body
-{
- font-size: .85em;
- font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif;
- color: #232323;
- background-color: #680000;
- margin:0px;
-}
-
-header,
-footer,
-nav,
-section {
- display: block;
-}
-
-h2
-{
- padding:10px;
-}
-
-a
-{
- color:#FF0000;
-}
-
-
-/* Styles for basic forms
------------------------------------------------------------*/
-
-fieldset
-{
- border:1px solid #ddd;
- padding:0 1.4em 1.4em 1.4em;
- margin:20px 20px 1.5em 20px;
-}
-
-legend
-{
- font-size:1.2em;
- font-weight: bold;
-}
-
-textarea
-{
- min-height: 75px;
-}
-
-.editor-label
-{
- margin: 1em 0 0 0;
-}
-
-.editor-field
-{
- margin:0.5em 0 0 0;
-}
-
-
/* Styles for validation helpers
-----------------------------------------------------------*/
.field-validation-error
@@ -84,26 +25,4 @@ textarea
.validation-summary-valid
{
display: none;
-}
-
-/* Navigation ------------- */
-#main-nav
-{
- background-color:#303030;
- color:#fff;
- font-size:2.0em;
-}
-
-#main-nav a
-{
- color:#fff;
- text-decoration:none;
- margin-right:10px;
- margin-left:10px;
-}
-
-#main-nav a:hover
-{
- color:#c0c0c0;
- background-color:#000;
}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -49,7 +49,7 @@ public ActionResult LogOn(string username, string password)
public ActionResult LogOut()
{
SessionUser.SetCurrent(null);
- return RedirectToAction("Index");
+ return RedirectToAction("Index", "Home");
}
//
// GET: /Account/Details/5
@@ -58,7 +58,6 @@ public ActionResult List()
time = t.Timestamp,
user = t.Username
})
- //.Where(t => t.time > SessionUser.Current.LastQuery)
.ToList(), JsonRequestBehavior.AllowGet);
SessionUser.Current.LastQuery = DateTime.Now;
return json;
@@ -9,7 +9,10 @@ public class BeerRepository : RepositoryBase<Beer>
{
public IEnumerable<Beer> GetBeers(string startsWith)
{
- return View("all_beers").StartKey(startsWith).Where(c => c.Name.StartsWith(startsWith));
+ foreach (var item in View("all_beers").StartKey(startsWith).EndKey(startsWith + "Z"))
+ {
+ yield return Get(item.ItemId);
+ }
}
}
}
@@ -10,7 +10,10 @@ public class PlaceRepository : RepositoryBase<Place>
public IEnumerable<Place> GetPlaces(string startsWith)
{
- return View("all_places").StartKey(startsWith).Where(c => c.Name.StartsWith(startsWith));
+ foreach (var item in View("all_places").StartKey(startsWith).EndKey(startsWith + "Z"))
+ {
+ yield return Get(item.ItemId);
+ }
}
}
@@ -43,9 +43,9 @@ public virtual void Remove(string id)
_Client.Remove(id);
}
- protected IView<T> View(string viewName)
- {
- return _Client.GetView<T>(InflectorNet.Pluralize(typeof(T).Name.ToLower()), viewName);
+ protected IView<IViewRow> View(string viewName)
+ {
+ return _Client.GetView(InflectorNet.Pluralize(typeof(T).Name.ToLower()), viewName);
}
protected IView<IViewRow> Project(string viewName)
@@ -21,7 +21,10 @@ public override ulong Create(Tap model)
public IEnumerable<Tap> GetTaps()
{
- return View("all_taps").Limit(10).ToList();
+ foreach (var item in View("all_taps").Limit(20).Descending(true))
+ {
+ yield return Get(item.ItemId);
+ }
}
}
}
@@ -23,7 +23,11 @@ public override ulong Create(User model)
public User GetByEmail(string email)
{
- return View("by_email").Limit(1).Key(email).Stale(StaleMode.False).FirstOrDefault();
+ foreach (var item in View("by_email").Limit(1).Key(email).Stale(StaleMode.False))
+ {
+ return Get(item.ItemId);
+ }
+ return null;
}
private Couchbase.StaleMode StaleModeFirstOrDefault()
@@ -33,7 +37,11 @@ private Couchbase.StaleMode StaleModeFirstOrDefault()
public User GetByUsername(string username)
{
- return View("by_username").Limit(1).Key(username).Stale(StaleMode.False).FirstOrDefault();
+ foreach (var item in View("by_username").Limit(1).Key(username).Stale(StaleMode.False))
+ {
+ return Get(item.ItemId);
+ }
+ return null;
}
public User Get(string username, string password)
@@ -105,6 +105,7 @@
<Compile Include="Session\SessionUser.cs" />
</ItemGroup>
<ItemGroup>
+ <Content Include="Content\Styles\bootstrap.min.css" />
<Content Include="Content\Styles\Grid.css" />
<Content Include="Content\themes\base\images\ui-bg_flat_0_aaaaaa_40x100.png" />
<Content Include="Content\themes\base\images\ui-bg_flat_75_ffffff_40x100.png" />
@@ -188,6 +189,9 @@
<ItemGroup>
<Content Include="Views\Account\Edit.cshtml" />
</ItemGroup>
+ <ItemGroup>
+ <Content Include="Views\Shared\TapForm.cshtml" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -1,15 +1,21 @@
@model TapMapWeb.Models.User
@{
- ViewBag.Title = "Create";
+ ViewBag.Title = "Register for TapMap";
}
-<h2>Create</h2>
+<h2>Register for TapMap</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
-@using (Html.BeginForm()) {
+
+<div style="padding:10px;">
+Existing user? @Html.ActionLink("Login", "LogOn", "Account") here.
+</div>
+
+@using (Html.BeginForm("Create", "Account", FormMethod.Post, new { @class = "well" }))
+{
@Html.ValidationSummary(true)
<fieldset>
<legend>User</legend>
@@ -14,7 +14,8 @@ New user? @Html.ActionLink("Register", "Create", "Account") here.
</div>
-@using (Html.BeginForm()) {
+@using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { @class = "form-vertical well" }))
+{
@Html.ValidationSummary(true)
<fieldset>
<legend>Login</legend>
@@ -1,23 +1,27 @@
@{
- ViewBag.Title = "Index";
+ ViewBag.Title = "TapMap";
}
-<h2>Taps</h2>
+<h2>Welcome to TapMap</h2>
-<div style="padding:10px;" id="taps">
- <script language="javascript">
- window.setInterval(function () {
- $.get('@Url.Content("~/Tap/List")', function (data) {
- $("#taps").empty();
- $.each(data, function (i, v) {
- $("#taps").append(
- "<div>" + v.user + " tapped " + v.beer + " at " + v.place + "</div>" +
- "<div style='margin-bottom:10px;border-bottom:1px solid #c0c0c0;'><em>"
- + v.comment + " at " + v.time +
- "</em></div>"
- );
- });
+<div id="taps" class="well" style="margin-top:20px;">
+
+</div>
+
+<script language="javascript">
+ window.setInterval(function () {
+ $.get('@Url.Content("~/Tap/List")', function (data) {
+ $("#taps").empty();
+ $.each(data, function (i, v) {
+ var date = v.time.replace("/Date(", "").replace(")/", "");
+ $("#taps").append(
+ "<div>" + v.user + " tapped " + v.beer + " at " + v.place + "</div>" +
+ "<div style='margin-bottom:10px;border-bottom:1px solid #c0c0c0;'><em>"
+ + v.comment + " at " + new Date(parseInt(date)) +
+ "</em></div>"
+ );
});
- }, 10000);
- </script>
-</div>
+ });
+ }, 1000);
+
+</script>
@@ -0,0 +1,44 @@
+@{ Func<bool> isLoggedIn = () => SessionUser.Current.IsInRole(TapMapWeb.Constants.RoleConstants.ACTIVE_USERS); }
+@if (isLoggedIn())
+{
+ <div>
+ @Html.Label("Place")
+ @Html.TextBox("Place")
+ @Html.Hidden("PlaceId")
+ @Html.Label("Beer")
+ @Html.TextBox("Beer")
+ @Html.Hidden("BeerId")
+ @Html.Label("Comment")
+ @Html.TextArea("Comment")
+ <input type="Button" value="Tap" id="Tap" class="btn-primary" />
+ </div>
+}
+<script language="javascript">
+ $().ready(function (a) {
+ $("#Place").autocomplete({
+ source: '@Url.Content("~/AutoComplete/Places")',
+ minLength: 2,
+ select: function (e, u) { $("#PlaceId").val(u.item.id); }
+ });
+
+ $("#Beer").autocomplete({
+ source: '@Url.Content("~/AutoComplete/Beers")',
+ minLength: 2,
+ select: function (e, u) { $("#BeerId").val(u.item.id); }
+ });
+
+ $("#Tap").bind("click", function (e) {
+ $.post('@Url.Content("~/Tap/Create")',
+ {
+ "placeId": $("#PlaceId").val(),
+ "beerId": $("#BeerId").val(),
+ "Comment": $("#Comment").val()
+ },
+ function (data) {
+ $("#Place").val("");
+ $("#Beer").val("");
+ $("#Comment").val("");
+ });
+ });
+ });
+</script>
Oops, something went wrong.

0 comments on commit 7c220dd

Please sign in to comment.