2012-02-16 3 views
1

htmlをradiofieldListのラベルとしてレンダリングしようとすると、次のエラーが発生しました。ラジオボタンラベル内にhtmlを挿入するには

Handler/Manager.hs:91:32: 
No instance for (RenderMessage Scheduler (Handler RepHtml)) 
    arising from a use of `radioFieldList' 
Possible fix: 
    add an instance declaration for 
    (RenderMessage Scheduler (Handler RepHtml)) 
In the first argument of `mreq', namely `(radioFieldList bPairs)' 
In a stmt of a 'do' block: 
    (jobRes, jobView) <- mreq 
         (radioFieldList bPairs) "Scheduled Jobs" Nothing 
In the expression: 
    do { let bPairs = buttonPairs kjPairs 
      statusPairs 
      = map (pack . show &&& id) $ ([minBound .. maxBound] :: [Status   ]); 
     (jobRes, jobView) <- mreq 
           (radioFieldList bPairs) "Scheduled Jobs" Nothing; 
     (noteRes, noteView) <- mreq textareaField " Notes " Nothing; 
     (statusRes, statusView) <- mreq 
            (selectFieldList statusPairs) " Status " Nothing; 
     .... } 

ので、以下のコード与えられ、それはそれは私に起こった(RenderMessage Scheduler (Handler RepHtml))

statusForm :: RForm CapturedData 
statusForm kjPairs extra = do 
let bPairs = buttonPairs kjPairs 
    statusPairs = map (pack . show &&& id) $ 
        ([minBound .. maxBound] :: [Status]) 
(jobRes ,jobView) <- mreq (radioFieldList bPairs) "Scheduled Jobs" Nothing 
(noteRes, noteView) <- mreq textareaField " Notes " Nothing 
(statusRes, statusView) <- mreq (selectFieldList statusPairs) " Status " Nothing -- as of 0.9.4.x it is just best to explicitly type widgetFile 
let widget = toWidget ($(widgetFile "status") :: Widget) 
return (CapturedData <$> jobRes <*> statusRes <*> noteRes 
     , widget) 

buttonPairs :: [KeyJobPair] -> [(Handler RepHtml,KeyJobPair)] 
buttonPairs kjList = sort $ map buttonPairs' kjList 
    where buttonPairs' :: KeyJobPair -> (Handler RepHtml,KeyJobPair) 
    buttonPairs' (KeyJobPair ((Key key), JobData (Firmware product) 
              (Version version) 
              (StartDate sDate) 
              status)) = 
     let (Right jid) = fromPersistValue key :: Either Text Int64 
     in (hamletToRepHtml [hamlet|<a [email protected]{RootR}(" Job Id " ++ (show jid))>|] 
     ,KeyJobPair (Key key, JobData (Firmware product) 
             (Version version) 
             (StartDate sDate) 
             status)) 

のインスタンスを作成しても意味がない、本当の答えは(HTML,a)を受け入れるカスタムフィールドを作成することです、これとは対照的に、(msg,a)radioFieldListが必要です。 RenderMessageのインスタンスを作成するだけでうまくいくと思っています。

+0

作業しているライブラリは何ですか?文脈からは分かりません。 – Tener

+0

私の間違い、私はタグを修正した。 –

答えて

1

おそらくhamletToRepHtmlに電話する必要はありません。renderHtmlからText.Hamletに電話をかけてください。

このマシンにyesododがインストールされていないため(確認できません)、正しい方向を指すはずです。私はそれがウィジェットであることを望んでおらず、レンダリングしたいと思っています。

関連する問題