Skip to content

Instantly share code, notes, and snippets.

@lihaoyi
Created October 28, 2016 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lihaoyi/2a3320f126bc44c48b9e1c475985b80d to your computer and use it in GitHub Desktop.
Save lihaoyi/2a3320f126bc44c48b9e1c475985b80d to your computer and use it in GitHub Desktop.

PSA: if anyone is wondering to how to add debuggability to your Scalatags fragments to figure out where stuff comes from, you can do it with the SourceCode library (which is already pulled in by Scalatags):

  def tagged(implicit name: sourcecode.Enclosing, line: sourcecode.Line) =
    data.enclosing := (name.value + ":" + line.value)

Use e.g.

val searchForm = form(
    tagged,
    cls := "form-inline",
    row,
    width := SharedTemplates.extendedSidebarWidth,
    flexShrink := 0
  )

Which renders to

<form 
  data-enclosing="grepgit.client.Search#searchForm:73" 
  class="form-inline Web-row" 
  style="width: 600px; flex-shrink: 0;"
>
    ...
</form>

From then on it becomes easy to look at the DOM and figure out where stuff came from, and you can add clever hovers and stuff using jQuery if that's what you fancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment