newsdev / stevedore

search document dumps: ingest and explore in one extensible framework
Apache License 2.0
124 stars 10 forks source link

create a template DSL for search forms #2

Open jeremybmerrill opened 8 years ago

jeremybmerrill commented 8 years ago

There's a lot of boilerplate in the search_form templates. A DSL to "automatically" add that boilerplate (form-group, form-notes, etc. etc.) to distinguish the interesting content from the boilerplate would be really neat.

YAML might be a good place to start, so a template looks like:

fields:
  - title: Full text
    input: <input name="search" id="search" class="form-control" placeholder="Your query..." value="{{= search.query_string.replace(/\"/g, "&quot;") }}" type="text">
    notes: my notes whatever they are

Or:

fields:
  - title: Full text
    input: text/query_string
    notes: my notes whatever they are
  - title: Subject
    input: text/subject
    notes: my notes whatever they are
  - title: Date sent
    input: daterange/sent
    notes: my notes whatever they are

(This idea isn't fully developed, but has a lot of freedom for how to implement it.)