Questions tagged [hamlet]

Hamlet is a type-safe framework for generating HTML code from Haskell

Hamlet is a type-safe tool for generating HTML code in Haskell. It is used in the Yesod web framework .

86 questions
0
votes
1 answer

Check for admin permissions in Yesod using database

I'm trying to implement the isAdmin function in a similar fashion to these Yesod book examples. The problem is that I want to keep my 'admin' emails in the database, but when I make a database query, isAdmin loses its purity, so I have to return…
Igor Deruga
  • 1,504
  • 1
  • 10
  • 18
0
votes
1 answer

SVG tags in hamlet shakespearean (yesod/haskell) templates?

Is there a way to include tags in hamlet? If not, what are the workarounds/alternatives?
daj
  • 6,962
  • 9
  • 45
  • 79
0
votes
1 answer

Yesod: how to output pretty html

How do i print nice formatted html? I want something like app.locals.pretty = true. ExpressJS: how to output pretty html
0
votes
1 answer

run whamlet in pure code?

In a yesod application, I want to create URL attributes for a graph that will be rendered by graphviz , and I want to use interpolation. Ideally, graphToDot nonClusteredParams { fmtNode = \ (n,l) -> [ URL [whamlet| @{MyRoute ...} |] } g Of…
d8d0d65b3f7cf42
  • 2,597
  • 15
  • 28
0
votes
1 answer

Is there a way to pass a Hamlet block as an argument to a function?

Let's say that I have a generic content :: Widget -> Widget helper, which takes a Widget and wraps it in some HTML. Is is possible to call this function giving it the argument inline in the Hamlet file, similarly to what one would do in Ruby on…
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
0
votes
1 answer

How can I embed both Text and Widget in another Widget in Yesod?

Given a simple example like this glyphicon :: Text -> Widget glyphicon name = toWidget [hamlet||] foo :: ToMarkup a => a -> Widget foo content = toWidget [hamlet|
#{content}
|] Is…
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
0
votes
1 answer

Building emails with Typed-Urls in Yesod

I'm working on a user registration process in Yesod. The plan is to have send a newly registered user an email which activates their account. I have attempted to create a widget which included a Typed-Url back to the route that accepts the email…
0
votes
1 answer

Making login page fancier or Injecting one widget inside another

loginHandler = do tp <- getRouteToParent lift $ defaultLayout $ do --setTitleI Msg.LoginTitle master <- getYesod --mapM_ ( flip apLogin tp ) ( authPlugins master ) [whamlet|

Authentication providers|] let ws = mapM (…

Kuznero
  • 141
  • 6
0
votes
1 answer

Yesod Resources and URL type safety automation

I've been on a mission to learn everything about Yesod, and I'm (somewhat) stuck on the routing system and it's relation to subsites and cross-route linking in general. The first thing I would like to address is the "ResourceR" pattern found…
Athan Clark
  • 3,886
  • 2
  • 21
  • 39
0
votes
1 answer

Yesod how to get record from inside hamlet

The question: how do i get a record from the dataBase given a Maybe PersistInt64 (maybe primaryKey) from inside hamlet let's say i have a homepage. If a person visit my homepage who is logged in. The person will be welcomed with his name and has…
BARJ
  • 1,543
  • 3
  • 20
  • 28
0
votes
1 answer

Cassius and Hamlet

I've used to hamlet to produce an internal stylesheet as follows: style = [hamlet|