finish basic proj

This commit is contained in:
Tommy Parnell
2015-03-19 22:23:52 -04:00
parent f5ae330e4c
commit 6e5f68e5a6
9 changed files with 57 additions and 22 deletions

View File

@@ -11,11 +11,12 @@ namespace UntappedWidgetGenerator.Web
{ {
Get["/"] = x => { return View["Views/Index/Index.cshtml", "tparnell"]; }; Get["/"] = x => { return View["Views/Index/Index.cshtml", "tparnell"]; };
Get["/{username}/browse"] = x => { return View["Views/Index/Index.cshtml", (string)x.username]; }; Get["/{username}/browse"] = x => { return View["Views/Index/Index.cshtml", (string)x.username]; };
Get["/{username}"] = parameters => Get["/{username}/html"] = parameters =>
{ {
var info = new UntappedRepository().Get(parameters.username); var info = new UntappedRepository().Get(parameters.username);
return View["Profile", info]; return View["Profile", info];
}; };
Get["/{username}"] = parameters => Response.AsJson(new UntappedRepository().Get((string)parameters.username));
} }
} }
} }

View File

@@ -1,11 +0,0 @@
(function ($) {
$.fn.untappd = function (username) {
this.each(function () {
var that = this;
$.get("http://untappdwidget.azurewebsites.net/" + username)
.success(function (data) {
$(that).html(data);
});
});
};
})(jQuery);

View File

@@ -0,0 +1,45 @@
(function ($) {
//I would love to use handlebars, but I am trying to limit the required packages
var buildProfileTemplate = function (data, badges) {
return "<div class=\"profile\" style=\"background-image: Url(" + data.headerBackgroundUrl + ")\"><div class=\"user-info\">\
<div class=\"user-avatar\">\
<div class=\"avatar-holder\">\
<img src=\""+ data.avatarUrl + "\" alt=\"User Avatar\" />\
</div>\
</div>\
<div class=\"info\">\
<h1>"+ data.info + "</h1>\
<span class=\"username\">"+ data.username + "</span>\
</div>\
</div>\
<div class=\"stats-bar\">\
<span class=\"badges\">"+ badges + "\
</span>\
</div>\
</div>";
}
var buildBadges = function (data) {
var badges = "";
$.each(data.badges, function (index, value) {
badges = badges + "<a href=\"" + value.linkUrl + "\" ><span><img src=\"" + value.imageUrl + "\" /></span></a>";
});
return badges;
}
$.fn.untappd = function (username) {
this.each(function () {
var that = this;
$.get("http://untappdwidget.azurewebsites.net/" + username)
.success(function (data) {
$(that).html(buildProfileTemplate(data,buildBadges(data)));
});
});
};
})(jQuery);

View File

@@ -85,11 +85,11 @@
<Content Include="Content\bootstrap.css" /> <Content Include="Content\bootstrap.css" />
<Content Include="Content\bootstrap.min.css" /> <Content Include="Content\bootstrap.min.css" />
<Content Include="Content\nancy-logo.png" /> <Content Include="Content\nancy-logo.png" />
<Content Include="Content\main.css"> <Content Include="Content\jquery.css">
<DependentUpon>main.less</DependentUpon> <DependentUpon>jquery.UntappedWidget.less</DependentUpon>
</Content> </Content>
<Content Include="Content\main.min.css"> <Content Include="Content\jquery.min.css">
<DependentUpon>main.css</DependentUpon> <DependentUpon>jquery.css</DependentUpon>
</Content> </Content>
<Content Include="Content\Site.css" /> <Content Include="Content\Site.css" />
<Content Include="fonts\glyphicons-halflings-regular.svg" /> <Content Include="fonts\glyphicons-halflings-regular.svg" />
@@ -104,7 +104,7 @@
<Content Include="Scripts\bootstrap.min.js" /> <Content Include="Scripts\bootstrap.min.js" />
<Content Include="Scripts\jquery-1.9.1.js" /> <Content Include="Scripts\jquery-1.9.1.js" />
<Content Include="Scripts\jquery-1.9.1.min.js" /> <Content Include="Scripts\jquery-1.9.1.min.js" />
<Content Include="Scripts\Jquery.Untapped.js" /> <Content Include="Scripts\jquery.UntappedWidget.js" />
<Content Include="Web.config" /> <Content Include="Web.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -117,9 +117,9 @@
<Content Include="Views\Index\Index.cshtml" /> <Content Include="Views\Index\Index.cshtml" />
<Content Include="packages.config" /> <Content Include="packages.config" />
<Content Include="Views\Index\Badge.cshtml" /> <Content Include="Views\Index\Badge.cshtml" />
<Content Include="Content\main.less" /> <Content Include="Content\jquery.UntappedWidget.less" />
<Content Include="Content\main.css.map"> <Content Include="Content\jquery.css.map">
<DependentUpon>main.css</DependentUpon> <DependentUpon>jquery.css</DependentUpon>
</Content> </Content>
<Content Include="Views\Shared\_Layout.cshtml" /> <Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Scripts\jquery-1.9.1.min.map" /> <Content Include="Scripts\jquery-1.9.1.min.map" />

View File

@@ -4,11 +4,11 @@
} }
<div id="target"></div> <div id="target"></div>
@section styles{ @section styles{
<link rel="stylesheet" href="~/Content/main.min.css" /> <link rel="stylesheet" href="~/Content/jquery.UntappedWidget.min.css" />
} }
@section scripts{ @section scripts{
<script src="~/Scripts/Jquery.Untapped.js"></script> <script src="~/Scripts/jquery.UntappedWidget.js"></script>
<script> $(document).ready(function() { <script> $(document).ready(function() {
$("#target").untappd("@Model"); $("#target").untappd("@Model");
});</script> });</script>