Last active
December 18, 2015 14:59
-
-
Save Maarten88/5800881 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.fbAsyncInit = function () { | |
FB.init({ | |
appId: "@System.Configuration.ConfigurationManager.AppSettings["FacebookAppId"]", // App ID | |
channelUrl: "//@(Request.Url.Authority + Url.Content("~/Site/FacebookChannel"))", // Channel File | |
status: true, // check login status | |
cookie: false, // do not rely on cookies to maintain the session | |
xfbml: true // parse XFBML | |
}); | |
}; | |
// Load the SDK Asynchronously | |
(function (d) { | |
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; | |
if (d.getElementById(id)) { return; } | |
js = d.createElement('script'); js.id = id; js.async = true; | |
js.src = "//connect.facebook.net/@(System.Globalization.CultureInfo.CurrentCulture.ToString().Replace("-", "_"))/all.js"; | |
ref.parentNode.insertBefore(js, ref); | |
}(document)); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Auction.Web.Utility | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>@ViewBag.Title - My ASP.NET MVC Application</title> | |
@RenderSection("meta", required: false) | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link href="~/Content/less/bootstrap.less" rel="stylesheet"> | |
<style type="text/css" > | |
body { | |
padding-top: 60px; | |
padding-bottom: 40px; | |
} | |
</style> | |
<link href="~/Content/less/responsive.less" rel="stylesheet"> | |
@Html.Partial("_html5shiv") | |
<!-- Fav and touch icons --> | |
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="~/Content/ico/apple-touch-icon-144-precomposed.png"> | |
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="~/Content/ico/apple-touch-icon-114-precomposed.png"> | |
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="~/Content/ico/apple-touch-icon-72-precomposed.png"> | |
<link rel="apple-touch-icon-precomposed" href="~/Content/ico/apple-touch-icon-57-precomposed.png"> | |
<link href="~/Content/ico/favicon.ico" rel="shortcut icon" type="image/x-icon" /> | |
</head> | |
<body> | |
@Html.Partial("_NavBar") | |
<div id="fb-root"></div> | |
<div class="container"> | |
@if (CookieConsent.AskCookieConsent(ViewContext)) | |
{ | |
@Html.Partial("_CookieConsentMessage") | |
} | |
@RenderSection("featured", required: false) | |
@RenderBody() | |
<hr /> | |
<div class="footer"> | |
<p>© Company 2013</p> | |
</div> | |
@Scripts.Render("~/bundles/jquery") | |
@Scripts.Render("~/bundles/bootstrap") | |
@if (CookieConsent.HasCookieConsent(ViewContext)) | |
{ | |
@Html.Partial("_FacebookInit") | |
} | |
@RenderSection("scripts", required: false) | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
Layout = null; | |
} | |
<html> | |
<body> | |
<script type="text/javascript" src="//connect.facebook.net/@(System.Globalization.CultureInfo.CurrentCulture.ToString().Replace("-", "_"))/all.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Auction.Web.Utility | |
@{ | |
ViewBag.Title = "SignalR Auction"; | |
ViewBag.Description = "reference implementation of a modern website"; | |
} | |
@section meta { | |
<meta name="description" content="@ViewBag.Description"> | |
<meta property="og:title" content="@ViewBag.Title" /> | |
<meta property="og:description" content="@ViewBag.Description" /> | |
<meta property="og:type" content="website" /> | |
<meta property="og:image" content="@Url.Content("~/Content/images/auction.jpg")" /> | |
<meta property="og:site_name" content="Cloud Auction Demo" /> | |
<meta property="fb:admins" content="@System.Configuration.ConfigurationManager.AppSettings["FacebookAdmins"] /> | |
<meta property="og:url" content="@Request.Url" /> | |
<link rel="canonical" href="@Url.Action("Index", "Auction", new RouteValueDictionary(new { area = "" }), Uri.UriSchemeHttps, Request.Url.Host)" /> | |
} | |
<div class="row-fluid""> | |
<div class="page-header"> | |
<h1> | |
<strong data-bind="text: Title"></strong> | |
<small data-bind="text: Info"></small> | |
</h1> | |
</div> | |
</div> | |
<div class="row-fluid"> | |
<div class="span4"> | |
<div class="carousel slide"> | |
<!-- Carousel items --> | |
<div class="carousel-inner" data-bind="foreach: Photos"> | |
<div class="item" data-bind="css: { active: $index() == 0 }"><img src="/Content/images/none.png" data-bind='attr: { src: $data }' /></div> | |
</div> | |
<!-- Carousel nav --> | |
<a data-bind="visible: Photos().length > 1" class="carousel-control left" href="#photos" data-slide="prev">‹</a> | |
<a data-bind="visible: Photos().length > 1" class="carousel-control right" href="#photos" data-slide="next">›</a> | |
</div> | |
</div> | |
<div class="span8"> | |
<div data-bind="html: Details"></div> | |
<h2 data-bind="text: CurrentPrice"></h2> | |
<p><span data-bind="text: TimeRemainingText"></span> remaining</p> | |
@if (CookieConsent.HasCookieConsent(ViewContext)) | |
{ | |
<div class="fb-like" data-href="@Request.Url.GetLeftPart(UriPartial.Path)" data-send="true" data-layout="button_count" data-width="350" data-show-faces="false" data-font="lucida grande"></div> | |
} | |
</div> | |
</div> | |
@section Scripts { | |
@Scripts.Render("~/bundles/jqueryval") | |
@Scripts.Render("~/bundles/ko-signalr") | |
<script type="text/javascript" src="~/signalr/hubs"></script> | |
@Scripts.Render("~/bundles/home/auction") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Auction.Web.Utility; | |
using System.Web.Mvc; | |
namespace Auction.Web.Controllers | |
{ | |
[AllowAnonymous] | |
public class SiteController : BaseController | |
{ | |
// | |
// GET: /Site/ | |
public ActionResult Index() | |
{ | |
return View(); | |
} | |
public ActionResult AllowCookies(string ReturnUrl) | |
{ | |
CookieConsent.SetCookieConsent(Response, true); | |
return RedirectToLocal(ReturnUrl); | |
} | |
public ActionResult NoCookies(string ReturnUrl) | |
{ | |
CookieConsent.SetCookieConsent(Response, false); | |
// if we got an ajax submit, just return 200 OK, else redirect back | |
if (Request.IsAjaxRequest()) | |
return new HttpStatusCodeResult(System.Net.HttpStatusCode.OK); | |
else | |
return RedirectToLocal(ReturnUrl); | |
} | |
[OutputCache(Duration = 60 * 60 * 24 * 365, Location = System.Web.UI.OutputCacheLocation.Any)] | |
public ActionResult FacebookChannel() | |
{ | |
return View(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment