From a2ca78c7901f9f1cd4253893adf01ee264e41401 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 8 Aug 2016 17:29:12 +0000 Subject: [PATCH] Custom ticket fields specify whether required --- config/models | 1 + src/Vervis/Form/Workflow.hs | 2 ++ src/Vervis/Handler/Workflow.hs | 1 + templates/workflow/field/one.hamlet | 2 ++ 4 files changed, 6 insertions(+) diff --git a/config/models b/config/models index ad475e6..d058919 100644 --- a/config/models +++ b/config/models @@ -168,6 +168,7 @@ WorkflowField name Text desc Text Maybe type WorkflowFieldType + required Bool -- filter TicketStatusFilterId UniqueWorkflowField workflow ident diff --git a/src/Vervis/Form/Workflow.hs b/src/Vervis/Form/Workflow.hs index 571bc54..567fb5c 100644 --- a/src/Vervis/Form/Workflow.hs +++ b/src/Vervis/Form/Workflow.hs @@ -56,6 +56,7 @@ data NewField = NewField , nfName :: Text , nfDesc :: Maybe Text , nfType :: WorkflowFieldType + , nfReq :: Bool } newFieldAForm :: WorkflowId -> AForm Handler NewField @@ -64,6 +65,7 @@ newFieldAForm wid = NewField <*> areq textField "Name*" Nothing <*> aopt textField "Description" Nothing <*> areq (selectField optionsEnum) "Type*" Nothing + <*> areq checkBoxField "Required*" Nothing newFieldForm :: WorkflowId -> Form NewField newFieldForm wid = renderDivs $ newFieldAForm wid diff --git a/src/Vervis/Handler/Workflow.hs b/src/Vervis/Handler/Workflow.hs index 02a3a1d..1b71db6 100644 --- a/src/Vervis/Handler/Workflow.hs +++ b/src/Vervis/Handler/Workflow.hs @@ -149,6 +149,7 @@ postWorkflowFieldsR shr wfl = do , workflowFieldName = nfName nf , workflowFieldDesc = nfDesc nf , workflowFieldType = nfType nf + , workflowFieldRequired = nfReq nf } runDB $ insert_ field setMessage "Workflow field added." diff --git a/templates/workflow/field/one.hamlet b/templates/workflow/field/one.hamlet index 10bf606..1bfc7c5 100644 --- a/templates/workflow/field/one.hamlet +++ b/templates/workflow/field/one.hamlet @@ -24,3 +24,5 @@ $# . Description: #{fromMaybe "(none)" $ workflowFieldDesc f}
  • Type: #{show $ workflowFieldType f} +
  • + Required: #{workflowFieldRequired f}