finish basic proj
This commit is contained in:
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
|
||||||
@@ -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);
|
||||||
|
|
||||||
|
|
||||||
@@ -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" />
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user