lincx
lincx

Reputation: 253

Orchard CMS: Using the Current Theme in Custom view

I have a controller

public class JobSearchResultController : Controller {

    public ActionResult Index() {

        return View();
    }
}

the View ~/Views/JobSearchResult/Index

@Html.Raw("<b> TEST VIEW </b>")

And then I register the route

    public IEnumerable<RouteDescriptor> GetRoutes()
    {
        return new[] {
            new RouteDescriptor {
                Priority = 5,
                Route = new Route(
                    "JobSearchResult",
                    new RouteValueDictionary {
                        {"area", "Module.Test"},
                        {"controller", "JobSearchResult"},
                        {"action", "Index"}
                    },
                    new RouteValueDictionary(),
                    new RouteValueDictionary {
                        {"area", "Module.Test"}
                    },
                    new MvcRouteHandler())
            }
        };
    }

And I'm calling it in one of the other views

      @Html.ActionLink("Click Me", 
             "Index", 
             new { controller = "JobSearchResult", area = "Module.Test"" })

Works good, it takes me to the Actual View/Index displaying the plain page with

TEST VIEW

in localhost/Orchard.Web/JobSearchResult URL

Now, my problem is I'm expecting this page to use the current theme / current layout (masterpage) just like a normal content type

How can I do this?

I know theres an [Admin] attribute where you can be able to display in Admin view using the Admin theme but how about if I want to display it in the Client. Is there something like

[Client] //display in Client
public class JobSearchResultController : Controller {

    public ActionResult Index() {

    return View();
     }
}

Thanks in advance!

Upvotes: 0

Views: 694

Answers (1)

damoclarke
damoclarke

Reputation: 671

Yes. You can apply the Orchard.Themes.ThemedAttribute:

[Themed] //display in Client
public class JobSearchResultController : Controller {
    public ActionResult Index() {
        return View();
    }
}

Upvotes: 2

Related Questions