private static string ViewModeTemplate( this HtmlBuilder hb, SiteSettings ss, DeptCollection deptCollection, View view, string viewMode, Action viewModeBody) { var invalid = DeptValidators.OnEntry(ss); switch (invalid) { case Error.Types.None: break; default: return(HtmlTemplates.Error(invalid)); } ss.SetColumnAccessControls(); return(hb.Template( ss: ss, verType: Versions.VerTypes.Latest, methodType: BaseModel.MethodTypes.Index, siteId: ss.SiteId, parentId: ss.ParentId, referenceType: "Depts", script: Libraries.Scripts.JavaScripts.ViewMode(viewMode), userScript: ss.GridScript, userStyle: ss.GridStyle, action: () => hb .Form( attributes: new HtmlAttributes() .Id("DeptsForm") .Class("main-form") .Action(Locations.ItemAction(ss.SiteId)), action: () => hb .ViewSelector(ss: ss, view: view) .ViewFilters(ss: ss, view: view) .Aggregations( ss: ss, aggregations: deptCollection.Aggregations) .Div(id: "ViewModeContainer", action: () => viewModeBody()) .MainCommands( ss: ss, siteId: ss.SiteId, verType: Versions.VerTypes.Latest, bulkMoveButton: true, bulkDeleteButton: true, importButton: true, exportButton: true) .Div(css: "margin-bottom") .Hidden(controlId: "TableName", value: "Depts") .Hidden(controlId: "BaseUrl", value: Locations.BaseUrl())) .MoveDialog(bulk: true) .Div(attributes: new HtmlAttributes() .Id("ExportSettingsDialog") .Class("dialog") .Title(Displays.ExportSettings()))) .ToString()); }
private static HtmlBuilder GridRows( this HtmlBuilder hb, SiteSettings ss, DeptCollection deptCollection, View view, bool addHeader = true, bool clearCheck = false) { var checkAll = clearCheck ? false : Forms.Bool("GridCheckAll"); var columns = ss.GetGridColumns(checkPermission: true); return(hb .THead( _using: addHeader, action: () => hb .GridHeader( columns: columns, view: view, checkAll: checkAll)) .TBody(action: () => deptCollection .ForEach(deptModel => hb .Tr( attributes: new HtmlAttributes() .Class("grid-row") .DataId(deptModel.DeptId.ToString()), action: () => { hb.Td(action: () => hb .CheckBox( controlCss: "grid-check", _checked: checkAll, dataId: deptModel.DeptId.ToString())); columns .ForEach(column => hb .TdValue( ss: ss, column: column, deptModel: deptModel)); })))); }
private static HtmlBuilder Grid( this HtmlBuilder hb, SiteSettings ss, DeptCollection deptCollection, View view) { return(hb .Table( attributes: new HtmlAttributes() .Id("Grid") .Class("grid") .DataAction("GridRows") .DataMethod("post"), action: () => hb .GridRows( ss: ss, deptCollection: deptCollection, view: view)) .Hidden( controlId: "GridOffset", value: ss.GridNextOffset( 0, deptCollection.Count(), deptCollection.Aggregations.TotalCount) .ToString()) .Button( controlId: "ViewSorter", controlCss: "hidden", action: "GridRows", method: "post") .Button( controlId: "ViewSorters_Reset", controlCss: "hidden", action: "GridRows", method: "post")); }