示例#1
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            RequireJsOptions.Add(
                "homeUrl",
                Url.Action("Index", "Home", new { area = "" }),
                RequireJsOptionsScope.Global);

            RequireJsOptions.Add(
                "saveThemeUrl",
                Url.Action("SaveTheme", "Home", new { area = "" }),
                RequireJsOptionsScope.Global);

            RequireJsOptions.Add(
                "startTheme",
                Enum.GetName(typeof(BsTheme), GetTheme.Theme),
                RequireJsOptionsScope.Global);

            RequireJsOptions.Add(
                "themeEnum",
                RequireJsHtmlHelpers.ToJsonDictionary <BsTheme>(),
                RequireJsOptionsScope.Global);

            //RequireJsOptions.Add("loggerUrl", Url.Action("LogException", "Error", new { area = string.Empty }), RequireJsOptionsScope.Global);

            //RequireJsOptions.Add("loadLoggerUrl", Url.Action("LogLoadTimes", "Log", new { area = string.Empty }), RequireJsOptionsScope.Global);

            //RequireJsOptions.Add("requestKey", "request-guid", RequireJsOptionsScope.Global);
        }
示例#2
0
        public ActionResult Index(int?stateId)
        {
            BsGridRepositorySettings <ContributorSearchModel> bsGridSettings = null;

            if (stateId.HasValue)
            {
                var state = _componentState.Get(stateId.Value);

                if (state != null)
                {
                    bsGridSettings = state.ToBsGridRepositorySettings <ContributorSearchModel>();
                }
            }

            if (bsGridSettings == null)
            {
                bsGridSettings = new BsGridRepositorySettings <ContributorSearchModel>()
                {
                    PageSize = 5,
                    Page     = 1
                };
            }

            bsGridSettings.Search = _gridRepository.GetSearchForm(bsGridSettings.Search);

            var gridModel = _gridRepository.ToBsGridViewModel(bsGridSettings);

            var model = new ContributorsViewModel
            {
                Grid    = gridModel,
                Toolbar = new BsToolbarModel <ContributorSearchModel, ContributorNewModel, List <ContributorOrderModel> >
                {
                    Search = bsGridSettings.Search,
                    New    = _gridRepository.GetNewForm(),
                    Order  = _gridRepository.GetOrderForm(true)
                }
            };

            var options = new Dictionary <string, object>
            {
                { "pagerUrl", Url.Action("Pager") },
                { "getRowsUrl", Url.Action("GetRows") },
                { "enableDisableUrl", Url.Action("EnableDisable") },
                { "exportExcelUrl", Url.Action("ExportExcel") },
                { "updateUrl", Url.Action("Update") },
                { "deleteUrl", Url.Action("Delete") },
                { "editComponents", RequireJsHtmlHelpers.ToJsonDictionary <EditComponents>() }
            };

            RequireJsOptions.Add("index", options);

            return(View(model));
        }
示例#3
0
 public override void RegisterGlobalOptions()
 {
     RequireJsOptions.Add(
         "homeUrl",
         Url.Action("Index", "Home", new { area = "" }),
         RequireJsOptionsScope.Global);
     RequireJsOptions.Add(
         "adminUrl",
         Url.Action("Index", "Dashboard", new { area = "Admin" }),
         RequireJsOptionsScope.Global);
     RequireJsOptions.Add(
         "statusEnum",
         RequireJsHtmlHelpers.ToJsonDictionary <AjaxRequestStatus>(),
         RequireJsOptionsScope.Global);
 }
示例#4
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            RequireJsOptions.Add(
                "homeUrl",
                Url.Action("Index", "Home", new { area = "" }),
                RequireJsOptionsScope.Global);

            RequireJsOptions.Add(
                "adminUrl",
                Url.Action("Index", "Dashboard", new { area = "Admin" }),
                RequireJsOptionsScope.Global);

            RequireJsOptions.Add(
                "statusEnum",
                RequireJsHtmlHelpers.ToJsonDictionary <AjaxRequestStatus>(),
                RequireJsOptionsScope.Global);
        }
示例#5
0
        public ActionResult Index()
        {
            var userData = Session["UserData"] as UserData;

            var gridSettings = new UsersSettings
            {
                PageSize = 5,
                Page     = 1,
                UserData = userData
            };

            var gridModel = _usersRepository.ToBsGridViewModel(gridSettings);

            var model = new UsersPageModel
            {
                Grid    = gridModel,
                Toolbar = new BsToolbarModel <UserSearchModel, UserNewModel>
                {
                    Search = _usersRepository.GetSearchForm(gridSettings),
                    New    = _usersRepository.GetNewForm(gridSettings),
                }
            };

            var options = new Dictionary <string, object>
            {
                { "pagerUrl", Url.Action("Pager") },
                { "getRowsUrl", Url.Action("GetRows") },
                { "enableDisableUrl", Url.Action("EnableDisable") },
                { "deleteUrl", Url.Action("Delete") },
                { "updateComponentListUrl", Url.Action("UpdateComponentList") },
                { "currentCulture", Thread.CurrentThread.CurrentCulture.Name.Split('-')[0] },
                { "autocompleteComponents", RequireJsHtmlHelpers.ToJsonDictionary <UserAutocompleteComponents>() },
                { "userRoles", RequireJsHtmlHelpers.ToJsonDictionary <UserRoles>() }
            };

            RequireJsOptions.Add("Index", options);

            return(View(model));
        }
示例#6
0
        public override void RegisterGlobalOptions()
        {
            RequireJsOptions.Add(
                "homeUrl",
                Url.Action("Index", "Home", new { area = "" }),
                RequireJsOptionsScope.Global);

            RequireJsOptions.Add(
                "saveThemeUrl",
                Url.Action("SaveTheme", "Home", new { area = "" }),
                RequireJsOptionsScope.Global);

            RequireJsOptions.Add(
                "startTheme",
                Enum.GetName(typeof(BsTheme), GetTheme.Theme),
                RequireJsOptionsScope.Global);

            RequireJsOptions.Add(
                "themeEnum",
                RequireJsHtmlHelpers.ToJsonDictionary <BsTheme>(),
                RequireJsOptionsScope.Global);
        }
示例#7
0
        public ActionResult Index()
        {
            var model = new GroupEditorModel()
            {
                Developers = new BsEditorTabModel <ContributorRowModel, ContributorSearchModel, ContributorNewModel>
                {
                    Grid = repo.ToBsGridViewModel(new BsGridRepositorySettings <ContributorSearchModel>
                    {
                        Page     = 1,
                        PageSize = 10,
                        Search   = new ContributorSearchModel
                        {
                            RolesFilter = new List <ProjectRole>()
                            {
                                ProjectRole.Developer, ProjectRole.TeamLeader
                            }
                        }
                    }),
                    Search = repo.GetSearchForm(null),
                    New    = repo.GetNewForm()
                },

                Testers = new ContributorsInheritExample
                {
                    Grid = repo.ToBsGridViewModel(new BsGridRepositorySettings <ContributorSearchModel>
                    {
                        Page     = 1,
                        PageSize = 10,
                        Search   = new ContributorSearchModel
                        {
                            RolesFilter = new List <ProjectRole>()
                            {
                                ProjectRole.Tester
                            }
                        }
                    }),
                    Search = repo.GetSearchForm(null)
                },

                BFormsProject = new BsEditorGroupModel <ContributorsGroupRowModel, ContributorsRowFormModel>
                {
                    Items = new List <ContributorsGroupRowModel>()
                    {
                        new ContributorsGroupRowModel
                        {
                            Id            = 1,
                            Name          = "Stefan P.",
                            TabId         = ContributorType.Developer,
                            Contributions = "concept, api design, razor helpers, documentation, c# bug fixing, testing",
                            Form          = new ContributorsRowFormModel()
                            {
                                Contributions = "concept, api design, razor helpers, documentation, c# bug fixing, testing"
                            }
                        },
                        new ContributorsGroupRowModel
                        {
                            Id            = 6,
                            Name          = "Oana M.",
                            TabId         = ContributorType.Developer,
                            Contributions = "UI & UX, css master",
                            Form          = new ContributorsRowFormModel()
                            {
                                Contributions = "UI & UX, css master"
                            }
                        },
                        new ContributorsGroupRowModel
                        {
                            Id            = 3,
                            Name          = "Cezar C.",
                            TabId         = ContributorType.Developer,
                            Contributions = "documentation, razor helpers",
                            Form          = new ContributorsRowFormModel()
                            {
                                Contributions = "documentation, razor helpers"
                            }
                        },
                        new ContributorsGroupRowModel
                        {
                            Id            = 4,
                            Name          = "Marius C.",
                            TabId         = ContributorType.Developer,
                            Contributions = "js framework, datetime picker, automated tests for js",
                            Form          = new ContributorsRowFormModel()
                            {
                                Contributions = "js framework, datetime picker, automated tests for js"
                            }
                        }
                    },
                    Form = new ContributorsRowFormModel()
                },

                RequireJsProject = new BsEditorGroupModel <ContributorsGroupRowModel>
                {
                    Items = new List <ContributorsGroupRowModel>()
                    {
                        new ContributorsGroupRowModel
                        {
                            Id            = 1,
                            Name          = "Stefan P.",
                            Contributions = "concept, api design, razor helpers, documentation, c# bug fixing, testing",
                            TabId         = ContributorType.Developer
                        },
                        new ContributorsGroupRowModel
                        {
                            Id            = 3,
                            Name          = "Cezar C.",
                            Contributions = "documentation, razor helpers",
                            TabId         = ContributorType.Developer
                        }
                    }
                },
                Form = new GroupFormModel()
            };

            var viewModel = new GroupEditorViewModel
            {
                Editor = model
            };

            var options = new
            {
                getTabUrl         = Url.Action("GetTab"),
                save              = Url.Action("Save"),
                advancedSearchUrl = Url.Action("Search"),
                addUrl            = Url.Action("New"),
                contributorType   = RequireJsHtmlHelpers.ToJsonDictionary <ContributorType>(),
                projectRole       = RequireJsHtmlHelpers.ToJsonDictionary <ProjectRole>()
            };

            RequireJsOptions.Add("index", options);

            return(View(viewModel));
        }
示例#8
0
        public ActionResult Index(int?stateId)
        {
            BsGridRepositorySettings <ContributorSearchModel> bsGridSettings = null;

            //HttpContext.Items["RequestTheme"] = BsTheme.Black;

            if (stateId.HasValue)
            {
                var state = _componentState.Get(stateId.Value);

                if (state != null)
                {
                    bsGridSettings = state.ToBsGridRepositorySettings <ContributorSearchModel>();
                }
            }


            bsGridSettings = new BsGridRepositorySettings <ContributorSearchModel>()
            {
                PageSize = 5,
                Page     = 1,
                //GoTo = BsDirectionType.First
            };

            bsGridSettings.Search = _gridRepository.GetSearchForm(bsGridSettings.Search);

            bsGridSettings.OrderableColumns = new List <BsColumnOrder> {
                new BsColumnOrder
                {
                    Name = "Name",
                    Type = BsOrderType.Descending
                }
            };

            var gridModel = _gridRepository.ToBsGridViewModel(bsGridSettings, x => x.Id);

            var model = new ContributorsViewModel
            {
                Grid    = gridModel,
                Toolbar = new BsToolbarModel <ContributorSearchModel, ContributorNewModel, List <ContributorOrderModel> >
                {
                    Search = bsGridSettings.Search,
                    New    = _gridRepository.GetNewForm(),
                    Order  = _gridRepository.GetOrderForm(true)
                }
            };

            var options = new Dictionary <string, object>
            {
                { "pagerUrl", Url.Action("Pager") },
                { "getRowsUrl", Url.Action("GetRows") },
                { "enableDisableUrl", Url.Action("EnableDisable") },
                { "exportExcelUrl", Url.Action("ExportExcel") },
                { "updateUrl", Url.Action("Update") },
                { "deleteUrl", Url.Action("Delete") },
                { "editComponents", RequireJsHtmlHelpers.ToJsonDictionary <EditComponents>() },
                { "countUrl", Url.Action("Count") }
            };

            RequireJsOptions.Add("index", options);

            return(View(model));
        }