thelarz/MvcBreadCrumbs

Removing 1 element as oppose to Clear()?

Opened this issue · 7 comments

Just thought I would ask before I look into this to see if you have an example or idea already. We have several spots where we go from Page1 to Page2 (a new object page), then when save is clicked we go to page3 (edit object page). When page3 loads, page2 is really not needed anymore in terms of breadcrumbs so we would like to present page1 / page3.

Looking into easy way to "remove" an element.

Any thoughts?

I hadn't run across that, but it makes sense and could probably be done pretty easy. Just need another method (e.g. like SetLabel) maybe something fluent like BreadCrumb.ReplaceLast().SetLabel(...). Do you wanna take a stab at it and issue a pull request?

Will do!

I know I am not explaining the scenario above well (makes perfect sense in my head!) of when you would need this but it was pretty easy to expose:
///


/// Remove the currently active URL from the BreadCrumb
///

///
public static void RemoveCurrentBreadCrumb()
{
var state = StateManager.GetState(SessionProvider.SessionId);
state.RemoveCurrent();
}

which I call from the Post of Page2 Right before I redirect to page3.

I added a function on the state class as well:
public void RemoveCurrent()
{
Crumbs.Remove(Current);
}

Are you going to create a pull request?

Will do tonight...can't access the repository sitting be hind my proxy at work.

Hi, is there any news on this issue? I referenced the NuGet package in my mvc project and need exactly this feature.
Thanks a lot.

I believe @mtmcsally was going to issue a pull request, but I have not seen it yet.