Questions tagged [selmer]

12 questions
4
votes
1 answer

Variable not expanded inside an included selmer template

I have a top-level template where I want to use a "fragment" template inside a for cycle but I'm not able to pass in the variable value: {% for item in coll %} {% include "fragment.html" with name="slack" item=item %} {% endfor %} item and…
Juraj Martinka
  • 3,991
  • 2
  • 23
  • 25
3
votes
2 answers

Iterate over a map in selmer

I would like to iterate over a map in selmer, in such a way that allows my to print the keys as well as the values. As far as I can see this is not supported out of the box, so I have tried the following: (defn mapper-tag [args context-map content] …
clumsyjedi
  • 477
  • 6
  • 15
1
vote
2 answers

Selmer: How does one apply filters in a custom tag?

I am playing around with the Selmer library (version 1.12.33) and have constructed a simple custom tag. I want to modify this tag further to allow the use of filters in a similar vein how some standard tags, e.g. if, for, script, and style seem to…
frIT
  • 3,213
  • 1
  • 18
  • 22
1
vote
1 answer

How can I handle html files in Luminus which aren't in "resources"?

I have this: (defn about-page [] (layout/render "about.html" {:title "About"})) But since I have moved the directory "templates" from "resources" to the root directory and on a server I might put it yet in another place, it doesn't work. I did…
user6324692
1
vote
1 answer

Testing clojure with kerodon

I'm testing a clojure luminus/selmer application with kerodon. I'm getting a java.lang.IllegalArgumentException: field could not be found with selector "[:#name]" when trying to access an input field with id=name as follows: (deftest home (->…
joeabala
  • 266
  • 3
  • 11
1
vote
1 answer

If tag in Selmer (clojure templating engine similar to Django)

I am trying to do an admin page for a webapp, displaying the status of a user ("User" or "Admin"). Here is an extract of the Selmer template I wrote: {% for user in users %} {{user.admin}} {% if {{user.admin}}…
1
vote
1 answer

Looping through JSON in a Selmer template

I`m making simple quiz game and want to store the questions in a JSON file like so: {"questions": [ { "question":"2+2 ?", "answer_A":1, "answer_B":2, "answer_C":3, "answer_D":4, …
Cosaquee
  • 724
  • 1
  • 6
  • 22
0
votes
0 answers

Luminus- accessing data from a REST API route in a selmer template

I would like to make a Luminus app that provides a REST API and serves data from that API in Selmer templates. However, I can't figure out how to get the routing to work. For example, if you create a luminus template using the command lein new…
0
votes
1 answer

Easy way to access the request map in every selmer template?

I want to access the current page URL in my Selmer templates so that I can pass it to an edit page action so that this page can include a link back to the 'calling' page even after editing. Here's the template code in my Selmer template -- this…
Eric Clack
  • 1,886
  • 1
  • 15
  • 28
0
votes
1 answer

including selmer in a compojure-app is causing error while starting server

I am trying to build a compojure-app and I just included the selmer dependency. I am getting an exception when I try to do a lein ring server-headless I am using [selmer "1.0.7"] as the dependency in a lein project this is the exception that I am…
SK176H
  • 1,319
  • 3
  • 14
  • 25
0
votes
2 answers

How to add a dynamically concatenated file name for "include" tag in Selmer (Clojure)?

I'm new to Clojure. My issue is regarding selmer templating library. What I want to do is apply a variable for following way. But its not working; {% include {{right-page}} %} ------- X (here right-page is a concatenated sting for a target file…
Dan Jay
  • 874
  • 10
  • 27
0
votes
1 answer

View changes to Selmer templates without restarting server

I'm creating a web app with Clojure using Selmer templates. I'm using Jetty, and I have to restart it to see my changes. I want to see my changes without restarting the server. How can I achieve this?
Rooney
  • 1,195
  • 10
  • 18