erichexter / twitter.bootstrap.mvc

nuget package to make bootstrap easy with mvc4
Apache License 2.0
248 stars 134 forks source link

Enable support for SimpleMemebership / OAuth / OpenID #39

Open jjwilliams42 opened 11 years ago

jjwilliams42 commented 11 years ago

In order to use this NuGet package, you must start from an Empty MVC 4 application - which does not have any of the OAuth / membership configured (as in the Internet Application). Would it be possible to allow this to work with the Internet Template for MVC4?

erichexter commented 11 years ago

I am not sure what it would take to make this work with the internet template.. I started with the empty template because..it was quicker to get started. I am open to looking into this.

Eric Hexter

blog | http://Hex.LosTechies.com info | http://www.linkedin.com/in/erichexter

On Fri, Dec 21, 2012 at 10:42 PM, la2texas notifications@github.com wrote:

In order to use this NuGet package, you must start from an Empty MVC 4 application - which does not have any of the OAuth / membership configured (as in the Internet Application). Would it be possible to allow this to work with the Internet Template for MVC4?

— Reply to this email directly or view it on GitHubhttps://github.com/erichexter/twitter.bootstrap.mvc/issues/39.

simonwoodhead commented 11 years ago

I would also like to see this work with the internet template so I can just drop it into an existing project. Alternatively are there any instructions for adding simple membership and other features from the internet template to the empty template after adding twitter.bootstrap.mvc4?

Simon Woodhead

jjwilliams42 commented 11 years ago

Eric - from what I can tell there are just some dependencies missing, the AuthConfig.cs in App_Start, and the relevant .cshtml files and controllers. Is it as simple as configuring these in the NuGet package files? Will this violate any TOS or copyright laws (including the MS OAuth dependencies in this package)? This is my first time looking at an open source project, I've been following MVC since around its first iteration.

jjwilliams42 commented 11 years ago

Rundown of what I had to do to get it working (warning: lengthy process):

Create a new MVC 4 Internet Application

Install-Package twitter.bootstrap.mvc4

You will get an error: 'Views_ViewStart.cshtml' already exists. Skipping...

Copy this (twitter.bootstrap.mvc4) _ViewStart.cshtml from the GitHub project into the Views directory

Copy this (twitter.bootstrap.mvc4) ExampleLayoutsController.cs into the Controllers folder

Open ExampleLayoutRoutesConfig.cs in App_Start, and resolve the missing reference to HomeController

Open BootstrapBundleConfig.cs in App_Start - there is a naming conflict with the style bundle, change:

bundles.Add(new StyleBundle("~/content/css").Include(

to

bundles.Add(new StyleBundle("~/tbs/css").Include( (notice I changed /content to /tbs)

Open _BootstrapLayout.basic.cshtml (as well as the other related files - empty and narrow.cshtml) and RenderSection the featured area:

In the _BootstrapLayout.basic.cshtml I added this after:

@Html.Partial("_alerts") @Html.Partial("_validationSummary") @RenderSection("featured", required: false)

Also at the top of each of these files make sure you are now pointing to the new virtual bundle path:

link href="@Styles.Url("~/tbs/css")" rel="stylesheet" - (notice the change from ~/content/css)

From this repo (or a twitter-bootstrapped empty mvc4 project you have already created), copy the entire Views\ExampleLayouts folder to the new internet project.

Modify your AuthConfig.cs to add some auth providers (facebook, google), then browse to /Account/Login to try one.

Now to streamline this process. I'm just learning about NuGet - not sure if the best way to go about it would be to branch off from twitter.bootstrap.mvc4 and create twitter.bootstrap.mvc4internet, or make it some kind of option with NuGet (if that can even be done?).

Robzilla commented 11 years ago

Hi Eric

Are there any updated Nuget packages for this problem and/or an example solution in GitHub?