void ShowUserMenu(UserLoginResponse lr, LoginForm lf) { lf.Close (); Div.CreateContainerFluid(default(Element), fluid=>{ fluid.Style.PaddingLeft="10px"; fluid.Style.PaddingRight="0px"; Div.CreateRowFluid(fluid, row=>{ new Div(row, span=>{ span.ClassName="span2"; new SideNavBar(span, list=>{ foreach(var menu in lr.Menu){ list.AddItem( (li,anchor)=>{ anchor.Text(menu.Titulo); anchor.OnClick(e=>{ e.PreventDefault(); ContenedorWorkArea.Hide(); ContenedorItemArea.Show(); ItemArea.Empty(); var div = Document.CreateDocumentFragment(); foreach(var item in menu.Items){ new Anchor(null, a=>{ a.ClassName="c-icon"; new Image(a, img=>{ img.Src=item.Icono; img.ClassName="img-rounded"; }); a.OnClick(ev=>{ ev.PreventDefault(); if(modules.Contains(item.Modulo)) { ExecuteModule(item); } else { var rq=jQuery.GetScript("modulos/"+item.Modulo+".js"); rq.Done(cb=>{ modules.Add(item.Modulo); ExecuteModule(item); }); rq.Fail(cb=>{ Cayita.Javascript.Firebug.Console.Log("fallo al cargar "+ item.Modulo+" :" + rq.StatusText + " " , rq); Bootbox.Error("fallo al cargar "+ item.Modulo+" :" + rq.StatusText); }); } }); new Span(a, sp=>{ sp.ClassName="c-icon-label"; sp.InnerHTML=item.Titulo; }); }).AppendTo(div); } ItemArea.Element().AppendChild(div); }); }); } }); }); ContenedorItemArea= new Div(row, div=>{ div.ClassName="span10"; div.Style.MarginLeft="10px"; div.Append("<style>img {height: 60px;} .c-icon {height: 160px;}</style>"); ItemArea= new Div(div, i=>{ i.ClassName="c-icons"; var m = Document.CreateElement("h3"); m.Text("Bienvenido " + lr.DisplayName); i.AppendChild(m); }); }); ContenedorWorkArea = new Div(row, div=>{ div.ClassName="span10"; div.Style.MarginLeft="10px"; div.Hide(); new Div(div, i=>{ i.ClassName="c-panel"; new Div(i, h=>{ h.ClassName="c-panel-header"; new Icon(h, icon=>{ icon.ClassName="icon-remove-circle"; icon.OnClick(evt=>{ evt.PreventDefault(); ContenedorWorkArea.Hide(); ContenedorItemArea.Show(); }); }); TituloModulo = Document.CreateElement("h3"); TituloModulo.Text("Titulo del modulo"); h.AppendChild(TituloModulo); }); WorkArea= new Div(i, ct=>{ ct.ClassName="c-panel-content"; }); }); }); }); }).AppendTo(Document.Body); }
void ShowLoginForm() { var form = new LoginForm(Document.Body); form.OnLogin = ShowUserMenu; form.Show(); }