Esempio n. 1
0
        public override WidgetResult Configuration()
        {
            var result = new WidgetResult()
            {
                Success = true
            };

            ChecklistConfigModel model = GetConfigModel();

            result.Markup = new WidgetMarkup("views/settings.cshtml", model);

            return(result);
        }
Esempio n. 2
0
        public ChecklistConfigModel GetConfigModel(int templateId = 0)
        {
            var templates = ProjectTemplateManager.GetAll();
            ChecklistConfigModel model = new ChecklistConfigModel();

            GlobalConfigurationWidgetData <ChecklistConfigDataModel> data = GeminiContext.GlobalConfigurationWidgetStore.Get <ChecklistConfigDataModel>(AppGuid);

            if (data != null && data.Value != null && data.Value.Data != null && templates.Count > 0)
            {
                templateId = templateId > 0 ? templateId : templates[0].Id;

                var item = data.Value.Data.Find(s => s.TemplateId == templateId);

                if (item != null)
                {
                    model.Items = item.Items;
                }
            }

            model.Templates = new SelectList(ProjectTemplateManager.GetAll(), "Id", "Name", templateId);

            return(model);
        }