<commit_before>package views.html

import play.api.data.Form

import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._

import controllers.routes

object dev {

  def settings(settings: List[lila.memo.SettingStore[_]])(implicit ctx: Context) = {
    val title = "Settings"
    views.html.base.layout(
      title = title,
      moreCss = cssTag("mod.misc")
    )(
      main(cls := "page-menu")(
        mod.menu("setting"),
        div(id := "settings", cls := "page-menu__content box box-pad")(
          h1(title),
          p("Tread lightly."),
          settings.map { s =>
            postForm(action := routes.Dev.settingsPost(s.id))(
              p(s.text | s.id),
              s.form.value match {
                case Some(v: Boolean) =>
                  div(
                    span(cls := "form-check-input")(form3.cmnToggle(s.id, "v", v))
                  )
                case v =>
                  input(
                    name := "v",
                    value := (v match {
                      case None    => ""
                      case Some(x) => x.toString
                      case x       => x.toString
                    })
                  )
              },
              submitButton(cls := "button button-empty", dataIcon := "")
            )
          }
        )
      )
    )
  }

  def cli(form: Form[_], res: Option[String])(implicit ctx: Context) = {
    val title = "Command Line Interface"
    views.html.base.layout(
      title = title,
      moreCss = frag(cssTag("mod.misc"), cssTag("form3"))
    ) {
      main(cls := "page-menu")(
        views.html.mod.menu("cli"),
        div(id := "dev-cli", cls := "page-menu__content box box-pad")(
          h1(title),
          p(
            "Run arbitrary lila commands.",
            br,
            "Only use if you know exactly what you're doing."
          ),
          res map { pre(_) },
          postForm(action                         := routes.Dev.cliPost)(
            form3.textarea(form("command"))(style := "height:10em", autofocus),
            br,
            br,
            form3.submit(frag("Submit"))
          ),
          h2("Command examples:"),
          pre("""uptime
announce 10 minutes Lichess will restart!<commit_msg>both input (for browser completion) and textarea in /dev/cli<commit_after>package views.html

import play.api.data.Form

import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._

import controllers.routes

object dev {

  def settings(settings: List[lila.memo.SettingStore[_]])(implicit ctx: Context) = {
    val title = "Settings"
    views.html.base.layout(
      title = title,
      moreCss = cssTag("mod.misc")
    )(
      main(cls := "page-menu")(
        mod.menu("setting"),
        div(id := "settings", cls := "page-menu__content box box-pad")(
          h1(title),
          p("Tread lightly."),
          settings.map { s =>
            postForm(action := routes.Dev.settingsPost(s.id))(
              p(s.text | s.id),
              s.form.value match {
                case Some(v: Boolean) =>
                  div(
                    span(cls := "form-check-input")(form3.cmnToggle(s.id, "v", v))
                  )
                case v =>
                  input(
                    name := "v",
                    value := (v match {
                      case None    => ""
                      case Some(x) => x.toString
                      case x       => x.toString
                    })
                  )
              },
              submitButton(cls := "button button-empty", dataIcon := "")
            )
          }
        )
      )
    )
  }

  def cli(form: Form[_], res: Option[String])(implicit ctx: Context) = {
    val title = "Command Line Interface"
    views.html.base.layout(
      title = title,
      moreCss = frag(cssTag("mod.misc"), cssTag("form3"))
    ) {
      main(cls := "page-menu")(
        views.html.mod.menu("cli"),
        div(id := "dev-cli", cls := "page-menu__content box box-pad")(
          h1(title),
          p(
            "Run arbitrary lila commands.",
            br,
            "Only use if you know exactly what you're doing."
          ),
          res map { pre(_) },
          postForm(action := routes.Dev.cliPost)(
            form3.input(form("command"))(autofocus),
            br,
            form3.submit(frag("Submit"))
          ),
          hr,
          postForm(action := routes.Dev.cliPost)(
            p("Same thing but with a textarea for multiline commands:"),
            form3.textarea(form("command"))(style := "height:8em"),
            br,
            form3.submit(frag("Submit"))
          ),
          h2("Command examples:"),
          pre("""uptime
announce 10 minutes Lichess will restart!
{'fraction_non_alphanumeric': 0.13834400165186866, 'fraction_numerical': 0.004749122444765641, 'mean_word_length': 1.486652977412731, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4397009', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1388, 'n_words': 298}