Explorer

html-ui.diff-page

As of snapshot dt2aPjQUrI. See the latest

description
The page /d/<commit>/<part>: how the commit changed the part, as a line diff (html-ui.line-diff-script) between the part as of the parent commit and as of the commit
type
Fn(
  language: String,
  commit: String,
  part: String,
  event: @html-ui.response,
  before: @html-ui.response,
  after: @html-ui.response
) -> @definy.service-io
expression
fn(language$990, commit$0, part$1, event$2, before$3, after$4) =>
  let project$5 = @html-ui.event-field-of(text: $2.text, key: "project");
  let branch$6 = @html-ui.event-field-of(text: $2.text, key: "branch");
  let parent$7 = @html-ui.event-field-of(text: $2.text, key: "parent");
  @html-ui.page(
    language: $990,
    title: @core.string-concat(left: @html-ui.text(language: $990, en: "Diff: ", ja: "差分: ", eo: "Diferenco: "), right: $1),
    body: @html.concat(
      lists: [
        [
          @html-ui.breadcrumb(language: $990, project: $5, branch: $6),
          @html.element(
            name: "h1",
            attributes: [],
            children: [
              @html.element(name: "code", attributes: [], children: [@html.text(text: $1)]),
              @html.text(text: @html-ui.text(language: $990, en: " (diff)", ja: " の差分", eo: " (diferenco)"))
            ]
          ),
          @html.element(
            name: "p",
            attributes: [],
            children: @core.list-concat(
              left: [
                @html.text(text: @html-ui.text(language: $990, en: "Commit ", ja: "コミット ", eo: "Enmeto ")),
                @html-ui.event-link(hash: $0)
              ],
              right: match @core.equal(left: $7, right: "") {
                true =>
                  [
                    @html.text(
                      text: @html-ui.text(
                        language: $990,
                        en: " (the first commit)",
                        ja: " (最初のコミット)",
                        eo: " (la unua enmeto)"
                      )
                    )
                  ],
                false =>
                  [
                    @html.text(
                      text: @html-ui.text(language: $990, en: " compared with its parent ", ja: " と親 ", eo: " kompare kun sia gepatro ")
                    ),
                    @html-ui.event-link(hash: $7),
                    @html.text(text: @html-ui.text(language: $990, en: "", ja: " の違い", eo: ""))
                  ]
              }
            )
          ),
          @html.element(
            name: "p",
            attributes: [],
            children: @core.list-concat(
              left: match @core.equal(left: $3.status, right: 200) {
                true =>
                  [
                    @html.element(
                      name: "a",
                      attributes: [
                        {
                          name: "href",
                          value: @core.string-join(items: ["/p/", $5, "/", $6, "/", $1, "?commit=", $7], separator: "")
                        }
                      ],
                      children: [@html.text(text: @html-ui.text(language: $990, en: "Before", ja: "変更前", eo: "Antaŭe"))]
                    ),
                    @html.text(text: " · ")
                  ],
                false =>
                  []
              },
              right: match @core.equal(left: $4.status, right: 200) {
                true =>
                  [
                    @html.element(
                      name: "a",
                      attributes: [
                        {
                          name: "href",
                          value: @core.string-join(items: ["/p/", $5, "/", $6, "/", $1, "?commit=", $0], separator: "")
                        }
                      ],
                      children: [@html.text(text: @html-ui.text(language: $990, en: "After", ja: "変更後", eo: "Poste"))]
                    )
                  ],
                false =>
                  []
              }
            )
          ),
          @html.element(
            name: "pre",
            attributes: [
              {name: "id", value: "diff"},
              {name: "class", value: "line-diff"},
              {
                name: "data-same",
                value: @html-ui.text(
                  language: $990,
                  en: "No differences.",
                  ja: "違いはありません。",
                  eo: "Neniuj diferencoj."
                )
              }
            ],
            children: []
          ),
          @html-ui.hidden(name: "before", value: @html-ui.diff-text(response: $3)),
          @html-ui.hidden(name: "after", value: @html-ui.diff-text(response: $4)),
          @html.element(
            name: "script",
            attributes: [{name: "type", value: "module"}],
            children: [
              @html.text(
                text: @core.string-concat(
                  left: @html-ui.line-diff-script,
                  right: "renderLineDiff(document.getElementById(\"diff\"), document.querySelector(\"[name=before]\").value, document.querySelector(\"[name=after]\").value, 5);\n"
                )
              )
            ]
          )
        ],
        @html-ui.error-text(response: $2)
      ]
    )
  )
visibility
public
html-ui.diff-page (project html-ui, branch remove-deploy-button, snapshot dt2aPjQUrIkBOz-2trTI6JX-dnOvCsvqp9O2GMbdWn8)
id: xNFf5eCvk_9PAzCdCLnck5GQB0Y11LifmhDhIOgmOMk
content hash: S07UqDf3tpK2ky-T0HGzxHug5GzOffb6jujjo2lEx2A