コード例 #1
0
 private void InitializeQuickAccess()
 {
     QuickExpense             = new QuickAccessViewModel <Icon, string>(Icons);
     QuickExpense.AddInvoked += OnAddExpenseCategory;
     QuickIncome              = new QuickAccessViewModel <Icon, string>(Icons);
     QuickIncome.AddInvoked  += OnAddIncomeCategory;
 }
コード例 #2
0
        public MainViewModel()
        {
            Help   = new HelpViewModel();
            Themes = new ThemesViewModel();

            Explorer    = new ExplorerViewModel();
            QuickAccess = new QuickAccessViewModel();
            QuickAccess.NavigateCallback = Explorer.NavigateToDirectory;
        }
コード例 #3
0
        private void InitializeQuickAccess()
        {
            if (_options.DefaultSortOrder == Infrastructure.Enums.CategorySortOrder.Name)
            {
                QuickExpense = new QuickAccessViewModel <OperationCategory, double>(_dataContext.Categories.Collection, x => x.Type == OperationType.Expense, y => y.Name);
                QuickIncome  = new QuickAccessViewModel <OperationCategory, double>(_dataContext.Categories.Collection, x => x.Type == OperationType.Income, y => y.Name);
            }
            else
            {
                QuickExpense = new QuickAccessViewModel <OperationCategory, double>(_dataContext.Categories.Collection, x => x.Type == OperationType.Expense, y => y.Usage);
                QuickIncome  = new QuickAccessViewModel <OperationCategory, double>(_dataContext.Categories.Collection, x => x.Type == OperationType.Income, y => y.Usage);
            }
            QuickExpense.AddInvoked += OnQuickExpenseAdd;
            QuickIncome.AddInvoked  += OnQuickIncomeAdd;

            OnPropertyChanged("QuickExpense", "QuickIncome");
        }
コード例 #4
0
        public ActionResult Render(QuickAccessPageType pageType, int contentId = 0)
        {
            var model = new QuickAccessViewModel
            {
                PageType = pageType
            };

            if (UserHelper.IsAdmin)
            {
                ApplyAdminQuickAccess(model, pageType, contentId);
            }
            else if (UserHelper.IsEditor)
            {
                ApplyEditorQuickAccess(model, pageType, contentId);
            }

            return(PartialView("_Render", model));
        }
コード例 #5
0
        private void ApplyEditorQuickAccess(QuickAccessViewModel model, QuickAccessPageType pageType, int contentId = 0)
        {
            switch (pageType)
            {
            case QuickAccessPageType.PageBuilder:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add", MobileText = "Add", CssClass = "add", Actions = new System.Collections.Generic.List <QuickAccessAction> {
                        new QuickAccessAction {
                            Icon = "fa fa-image", Text = "Upload Image", Link = Url.Action("UploadImage", "MediaManager", new { area = nameof(Admin) }), LaunchModal = true
                        }, new QuickAccessAction {
                            Icon = "fa fa-rss", Text = "Write Blog Post", Link = Url.Action("Create", "BlogManager", new { area = nameof(Admin) }), LaunchModal = true
                        },
                    }
                });
                model.Categories.Add(Content(false, true));
                break;

            case QuickAccessPageType.BlogManager:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add", MobileText = "Add", CssClass = "add", Actions = new System.Collections.Generic.List <QuickAccessAction> {
                        new QuickAccessAction {
                            Icon = "fa fa-rss", Text = "Write Blog Post", Link = Url.Action("Create", "BlogManager", new { area = nameof(Admin) }), LaunchModal = true
                        }, new QuickAccessAction {
                            Icon = "fa fa-image", Text = "Upload Image", Link = Url.Action("UploadImage", "MediaManager", new { area = nameof(Admin) }), LaunchModal = true
                        },
                    }
                });
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-cog", DesktopText = "Post Options", MobileText = "Options", CssClass = "options", Actions = new System.Collections.Generic.List <QuickAccessAction> {
                        new QuickAccessAction {
                            Icon = "fa fa-pencil", Text = "Edit Post", Link = Url.Action("Edit", "BlogManager", new { area = nameof(Admin), postId = contentId }), LaunchModal = true
                        },
                    }
                });
                model.Categories.Add(Content(false, true));
                break;

            default:
                throw new ArgumentException("Relevant Page Type Not Supplied");
            }
        }
コード例 #6
0
        private void ApplyAdminQuickAccess(QuickAccessViewModel model, QuickAccessPageType pageType, int contentId = 0)
        {
            switch (pageType)
            {
            case QuickAccessPageType.ExitAdministrationPanel_Admin:
                model.Categories.Add(ExitButton());
                break;

            case QuickAccessPageType.AdministrationPanel_Admin:
                model.Categories.Add(ExitButton());
                break;

            case QuickAccessPageType.PageBuilder:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add", MobileText = "Add", CssClass = "add", Actions = new System.Collections.Generic.List <QuickAccessAction> {
                        new QuickAccessAction {
                            Icon = "fa fa-plus", Text = "Add Section", JavaScript = "TogglePanel('section-panel');"
                        }, new QuickAccessAction {
                            Icon = "fa fa-plus", Text = "Add Component", JavaScript = "TogglePanel('component-panel');"
                        }, new QuickAccessAction {
                            Icon = "fa fa-plus", Text = "Add Blank Page", Link = Url.Action("Create", "PageManager", new { area = nameof(Admin) }), LaunchModal = true
                        }, new QuickAccessAction {
                            Icon = "fa fa-image", Text = "Upload Image", Link = Url.Action("UploadImage", "MediaManager", new { area = nameof(Admin) }), LaunchModal = true
                        }, new QuickAccessAction {
                            Icon = "fa fa-rss", Text = "Write Blog Post", Link = Url.Action("Create", "BlogManager", new { area = nameof(Admin) }), LaunchModal = true
                        },
                    }
                });
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-cog", DesktopText = "Page Options", MobileText = "Options", CssClass = "options", Actions = new System.Collections.Generic.List <QuickAccessAction> {
                        new QuickAccessAction {
                            Icon = "fa fa-pencil", Text = "Edit Page", Link = Url.Action("Edit", "PageManager", new { area = nameof(Admin), pageId = contentId }), LaunchModal = true
                        }, new QuickAccessAction {
                            Icon = "fa fa-sort", Text = "Edit Order", JavaScript = "ChangeOrder()"
                        },
                    }
                });
                model.Categories.Add(MoreContent(true, true));
                model.Categories.Add(AdminButton());
                break;

            case QuickAccessPageType.BlogManager:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add", MobileText = "Add", CssClass = "add", Actions = new System.Collections.Generic.List <QuickAccessAction> {
                        new QuickAccessAction {
                            Icon = "fa fa-rss", Text = "Write Blog Post", Link = Url.Action("Create", "BlogManager", new { area = nameof(Admin) }), LaunchModal = true
                        }, new QuickAccessAction {
                            Icon = "fa fa-image", Text = "Upload Image", Link = Url.Action("UploadImage", "MediaManager", new { area = nameof(Admin) }), LaunchModal = true
                        },
                    }
                });
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-cog", DesktopText = "Post Options", MobileText = "Options", CssClass = "options", Actions = new System.Collections.Generic.List <QuickAccessAction> {
                        new QuickAccessAction {
                            Icon = "fa fa-pencil", Text = "Edit Post", Link = Url.Action("Edit", "BlogManager", new { area = nameof(Admin), postId = contentId }), LaunchModal = true
                        },
                    }
                });
                model.Categories.Add(MoreContent(true, true));
                model.Categories.Add(AdminButton());
                break;

            case QuickAccessPageType.UserManagement_Admin:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add User", MobileText = "Add User", CssClass = "act", LaunchModal = true, Link = Url.Action("Create", "UserManager", new { area = nameof(Admin) })
                });
                model.Categories.Add(ExitButton());
                break;

            case QuickAccessPageType.ThemeManager_Admin:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add Theme", MobileText = "Add Theme", CssClass = "act", LaunchModal = true, Link = Url.Action("Create", "ThemeManager", new { area = nameof(Admin) })
                });
                model.Categories.Add(ExitButton());
                break;

            case QuickAccessPageType.PageManager_Admin:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add Page", MobileText = "Add Page", CssClass = "act", LaunchModal = true, Link = Url.Action("Create", "PageManager", new { area = nameof(Admin) })
                });
                model.Categories.Add(ExitButton());
                break;

            case QuickAccessPageType.CopyManager_Admin:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add Copy", MobileText = "Add Copy", CssClass = "act", LaunchModal = true, Link = Url.Action("Create", "CopyManager", new { area = nameof(Admin) })
                });
                model.Categories.Add(ExitButton());
                break;

            case QuickAccessPageType.BlogManager_Admin:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Add Blog Post", MobileText = "Add Post", CssClass = "act", LaunchModal = true, Link = Url.Action("Create", "BlogManager", new { area = nameof(Admin) })
                });
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-bookmark", DesktopText = "Add Category", MobileText = "Add Category", CssClass = "act", LaunchModal = true, Link = Url.Action("Add", "PostCategories", new { area = nameof(Admin) })
                });
                model.Categories.Add(ExitButton());
                break;

            case QuickAccessPageType.MediaManager_Admin:
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-trash", DesktopText = "Delete Image", MobileText = "Delete", CssClass = "act delete"
                });
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-plus", DesktopText = "Upload Image", MobileText = "Upload Image", CssClass = "act", LaunchModal = true, Link = Url.Action("UploadImage", "MediaManager", new { area = nameof(Admin) })
                });
                model.Categories.Add(new QuickAccessCategory {
                    Icon = "fa fa-camera", DesktopText = "Upload Font", MobileText = "Upload Font", CssClass = "act", LaunchModal = true, Link = Url.Action("UploadFont", "MediaManager", new { area = nameof(Admin) })
                });
                model.Categories.Add(ExitButton());
                break;
            }
        }