NerdDinner being updated to MVC3 with Razor, HTML5, GeoLocation, EF CodeFirst, jQuery Mobile, YepNope and Modernizr and a fixed Mobile Device Capabilities ViewEngine
Two years ago Rob, Phil, and I released our MVC 1.0 book with the Gu helping with the big intro. I created the basic Nerd Dinner sample application (code here) and released the first 185 pages for free. Since the initial 1.0 release, we've had help from lots of people like Dave Ward, Andrew Aarnott and Jon Galloway on a lot of little things like JavaScript and OpenAuth support, then John V. Petersen moving us to MVC3 with Razor Views, and Peter Mourfield taking on lots of JavaScript and new features. These guys started working on a feature here and a feature there in our spare time. It's been a collaborative effort with folks dropping in, contributing here and there with long periods of silence in between.
After John V. Petersen moved us to MVC3 and Razor, Peter Mourfield got on a feature tear and now we've added or updated:
- Mvc 3 + Razor
- EF Code First (for a database that already exists!)
- All libraries via NuGet
- YepNope with Modernizr
- JQuery Mobile beta 2
- An updated MobileCapableRazorViewEngine fixing a nasty caching bug I introduced a few years back
- The new MobileViewEngine is on NuGet and has been blogged. MVC4 will have formal support for mobile views baked in.
- Geolocation, both desktop and mobile
- MvcHtml5Templates by Scott Kirkland
- ELMAH (and MiniProfiler to come soon)
- 51Degrees Mobile capabilities module
- DotNetOpenAuth by Andrew Arnott
- proper Web Deploy Transforms
Now, to be clear, this isn't a release, it's an initial almost release. Call it an Alpha. That said, it's up live at http://www.nerddinner.com and the source continues to move forward in the Trunk on Codeplex. We've got some inconsistencies with the mobile site and back button, and geoloc is not working completely on an iPhone but it's decent on a browser. We're working on this an hour here and an hour there, but if you, Dear Reader, find any bugs in the trunk or obvious stupid mistakes, please to let us know and *cough* submit a patch *cough*. Or at least leave a nice Issue we can track.
As we get these features working rock solid, Pete and I will do a series of posts digging in to what worked well and what didn't in each feature. Already Pete has a good blog post talking about adding HTML5 Geolocation to Nerd Dinner with yepnope.js, and Modernizr. He used yepnope, a great library for saying "do you support this feature? Yep? Get this JS. Nope? Get this JS. For example:
<script type="text/javascript">
$(document).ready(function () {
yepnope({
test: Modernizr.geolocation,
yep: '@Url.Content("~/Scripts/geo.js")',
nope: '@Url.Content("~/Scripts/geo-polyfill.js")',
callback: function (url, result, key) {
getCurrentLocation();
}
});
});
</script>
Love it. More details and code on Pete's blog post. In the image below you can see IE9 warning me that my local site wants to track my physical location.
Here's Firefox prompting me for a location on the live site:
And Chrome:
As I said, there are surely lots of bugs and subtleties we need to iron out, but I'm glad we're actually moving this sample forward. Hope you enjoy, and do feel free to fix our bugs for us, Dear Reader. ;)
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Any chance you guys can get rid of those ugly ass markers and use something that look a little less tacky?
These look interesting: http://mapicons.nicolasmollet.com/category/markers/
Definitely an alpha release.
Might I suggest setting up subdomain(s) for new version and keeping the main domain running the stable version.
None the less, thanks for keeping at this project. It has been a great resource over the years for learning how to implement new features.
Gustafson - Sorry, had a bad deploy this afternoon. Those features are working now. Thanks!
Could you consider to add the use of head.js and/or HTML5 Boilerplate as well, please?
I think those can speed up the initial loading performance of the website. Thanks for the info and inspiration!
Teun - Good idea. Add it as an issue on the CodePlex site?
Ray - Your location isn't stored anywhere, it's requested on the client side with JavaScript from your browser and used only once.
PS Well, colleague of mine pointed me to this post http://stackoverflow.com/questions/7110023/firefox-6-infinite-page-refresh-with-page-with-hash-tags. Seems you have to update the scripts guys :)
Cheers
(http://www.hanselman.com/blog/ABetterASPNETMVCMobileDeviceCapabilitiesViewEngine.aspx)
Thanks for your work in this area!
For people new to MVC - the code without the book isn't very helpful (I saw one of my colleagues struggling with MVC2 version without a book and I expect even more of the same with MVC3).
So, please! update the Nerd Dinner book to MVC3 as well!
will you prapare videos about nerddinner innovations. not all the site, some inportant changes...
At present the solution on codeplex would fail a stylecop audit badly. There is complicated code in there there simply isn't commented. How is someone new to MVC supposed to follow what is going on?
Please please get someone to tidy up the solution before adding more features. Hell you'll probably spot and prevent a few more 'subtleties' by doing this.
Us mere mortals can't keep up!
I've been doing ASP.NET since 2002 and I have to say MVC3 works well and it's great to see Nerd Dinner in it's MVC3 glory. We took the plunge a few weeks ago to switch to MVC3 and now there's no going back ...
Thanks!
Hi thanks for your valuable post, however after updating the script, search is still reloading constantly in FF (v. 11).
Search within Chrome and IE are fine.
P.S. I'm working on NerdDinner MVC 2., since the tutorial/pdf still somewhat applies for this.
Can anyone give an example of the mobile pages in mvc3. I only saw you have to put .Mobile.cshtml in a view and it's a mobile view. But I need an example to see what to put in the view please.
Regards
thank you
Comments are closed.
Also, not to turn this into a "my favorite libary needs to be included" request, but Compass Style has become one of my go to tools for getting good cross browser (vendor specific prefix) tools for writing CSS3.