PDA

View Full Version : Please Give your Opinion about one _Layout



kdms
Feb 20, 2015, 8:53 AM
Hi,
I am trying to do a basic application with Ext.Net.Mvc. I have make one _Layout page that all others pages can override. I will get your opinion about this architecture.
My Views/Shared/_Layout.cshtml


@{
var X = Html.X();
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Music Store</title>
<link href="~/Content/Css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/Css/Site.css" rel="stylesheet" type="text/css" />
<script src="~/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
@X.ResourceManager()
@(X.Viewport()
.Layout(LayoutType.Border)
.Items(
X.Panel()
.Border(false)
.Region(Region.North)
.Split(false)
.BodyStyle("background-color:000;")
.Height(130)
.BodyPadding(0)
.Items(
//This ImageButton are static and i find how to load this through a controller
X.ImageButton()
.Text("Processing")
.ID("Bt_E_Processing")
.Height(28)
.Width(92)
.ImageUrl(@Url.Content("~/Images/Entete/Simple/Processing.png"))
.PressedImageUrl(@Url.Content("~/Images/Entete/Down/Processing_Down.png"))
.DisabledImageUrl(@Url.Content("~/Images/Entete/Down/Processing_Down.png"))
.Handler(" App.Bt_E_Report.setDisabled(false); App.Bt_E_Configuration.setDisabled(false); App.Bt_E_Processing.setDisabled(true); App.Bt_E_Import.setDisabled(false);")
.DirectEvents(r =>
{
r.Click.Action = "Menu_Item";
r.Click.ExtraParams.Add(new Parameter("param", "Partial3", ParameterMode.Value));
}),
X.ImageButton()
.Text("Import")
.ID("Bt_E_Import")
.Height(28)
.Width(65)
.ImageUrl(@Url.Content("~/Images/Entete/Simple/Import.png"))
.PressedImageUrl(@Url.Content("~/Images/Entete/Down/Import_Down.png"))
.DisabledImageUrl(@Url.Content("~/Images/Entete/Down/Import_Down.png"))
.Handler(" App.Bt_E_Report.setDisabled(false); App.Bt_E_Configuration.setDisabled(false); App.Bt_E_Processing.setDisabled(false); App.Bt_E_Import.setDisabled(true);")
.DirectEvents(r =>
{
r.Click.Action = "Menu_Item";
r.Click.ExtraParams.Add(new Parameter("param", "Partial2", ParameterMode.Value));
}),

X.Container()
.ID("Menu_Container")
.StyleSpec("height:90px; width:400%; background-color:transparent;")
.Listeners(r =>
{
r.Activate.Handler = "App.Bt_E_Configuration.setDisabled(true);";
})
.Loader(
X.ComponentLoader()
.Url(Url.Action("Menu_Item"))
.Mode(LoadMode.Script)
)
)
.Collapsible(false),
//End of head menu

//Second part of layout

X.Panel()
.Title("Aide Contextuel")
.Region(Region.West)
.Layout(LayoutType.Accordion)
.Width(225)
.MinWidth(225)
.MaxWidth(400)
.Split(true)
.Items(

X.TreePanel()
.Store(
Html.X().TreeStore()
.Proxy(
Html.X().AjaxProxy().Url(Url.Action("GetChildren"))
)
)
.ViewModel(long.MaxValue)
)
.Collapsible(true),

// Center. Others pages can override it
X.TabPanel()
.Region(Region.Center)
.Items(
X.Panel()
.Title("Center")
.Border(false)
.BodyPadding(6)
.Content(
@<text>@RenderSection("body", true)</text>
),

X.Panel()
.Title("Close Me")
.Closable(true)
.Border(false)
.BodyPadding(6)
.Html("Closeable Tab")
),

//Footer
X.Panel()
.Border(false)
.Region(Region.South)
.Split(false)
.Height(100)
.BodyPadding(0)
.Html("this is the footer")
)
)
@RenderBody()
</body>
</html>

For example in Views/Home/Index.cshtml, i have this code


@model IEnumerable<WindowShop.Models.Entities.Product>

@{
ViewBag.Title = "Index";

var X = Html.X();
}

@section body{
<h2>Welcomme</h2>

@Html.ActionLink("Admin","Index","Admin")
}


All the imageButton have a partial page that content a submenus. This partials pages are in Views/Shared folder in are called when her ImageButton is pressed and this method of controller is called.


public ActionResult Menu_Item(string param)
{
if (param != null)
{
return new Ext.Net.MVC.PartialViewResult
{
ContainerId = "Menu_Container",
ViewName = param,
ClearContainer = true
};
}
else
{
return new Ext.Net.MVC.PartialViewResult
{
ContainerId = "Menu_Container",
//ViewName = "Partial_Default",
ViewName = "Partial1",
WrapByScriptTag = false
};
}
}

Thanks for all in advance.

kdms
Feb 20, 2015, 1:18 PM
Please i need your help. Thanks again.