fn(language$990, project$0, branch$1, part$2, response$3) =>
let exists$4 = @core.equal(left: $3.status, right: 200);
let visibility$20 = match $4 {
true =>
@html-ui.part-section(text: $3.text, start: "\nvisibility: ", end: "\ndescription: "),
false =>
"public"
};
let description$21 = match $4 {
true =>
@html-ui.part-section(text: $3.text, start: "\ndescription: ", end: "\n\ntype:\n"),
false =>
""
};
@html-ui.page(
language: $990,
title: @core.string-concat(left: @html-ui.text(language: $990, en: "Edit: ", ja: "編集: ", eo: "Redakti: "), right: $2),
body: [
@html-ui.breadcrumb(language: $990, project: $0, branch: $1),
@html.element(
name: "h1",
attributes: [],
children: [
@html.text(text: $2),
@html.text(
text: match $4 {
true =>
@html-ui.text(language: $990, en: " (edit)", ja: " を編集", eo: " (redakti)"),
false =>
@html-ui.text(language: $990, en: " (new)", ja: " を足す", eo: " (nova)")
}
)
]
),
@html-ui.text-element(
name: "p",
text: @html-ui.text(
language: $990,
en: "Signed with the key of this local definy server. Only the account that created the branch can take snapshots.",
ja: "手元の definy サーバーの鍵で署名します。ブランチを作ったアカウントでしかスナップショットを作れません。",
eo: "Subskribita per la ŝlosilo de ĉi tiu loka definy-servilo. Nur la konto, kiu kreis la branĉon, povas fari momentfotojn."
)
),
@html.element(
name: "form",
attributes: [
{name: "id", value: "edit-form"},
{name: "data-project", value: $0},
{name: "data-branch", value: $1},
{name: "data-part", value: $2},
{
name: "data-check-ok",
value: @html-ui.text(
language: $990,
en: "No type errors. A snapshot of this change can be taken.",
ja: "型の誤りはありません。このままスナップショットを作れます。",
eo: "Neniuj tipaj eraroj. Ĉi tiu ŝanĝo povas esti konservita kiel momentfoto."
)
},
{
name: "data-exists",
value: match $4 {
true =>
"1",
false =>
"0"
}
}
],
children: @html.concat(
lists: [
match $4 {
true =>
[
@html.element(
name: "p",
attributes: [{name: "class", value: "muted"}],
children: [
@html.text(
text: @html-ui.text(
language: $990,
en: "To rename, use \"Rename\" on the part page (it also rewrites the parts that reference it).",
ja: "名前を変えるときは, パーツのページの「名前を変える」を使います (参照しているパーツも書き換えます)。",
eo: "Por renomi, uzu \"Renomi\" en la paĝo de la parto (ĝi ankaŭ reskribas la partojn, kiuj referencas ĝin)."
)
)
]
)
],
false =>
[]
},
match $4 {
true =>
[],
false =>
[
@html.element(
name: "p",
attributes: [],
children: [
@html.text(text: @html-ui.text(language: $990, en: "Start from: ", ja: "雛形: ", eo: "Komenci de: ")),
@html.element(
name: "button",
attributes: [
{name: "type", value: "button"},
{name: "data-template-type", value: "Fn(x: Number) -> Number"},
{name: "data-template-expression", value: "fn(x$0) =>\n $0"}
],
children: [@html.text(text: @html-ui.text(language: $990, en: "Function", ja: "関数", eo: "Funkcio"))]
),
@html.text(text: " "),
@html.element(
name: "button",
attributes: [
{name: "type", value: "button"},
{name: "data-template-type", value: "Number"},
{name: "data-template-expression", value: "0"}
],
children: [@html.text(text: @html-ui.text(language: $990, en: "Value", ja: "値", eo: "Valoro"))]
),
@html.text(text: " "),
@html.element(
name: "button",
attributes: [
{name: "type", value: "button"},
{name: "data-template-type", value: "Type"},
{name: "data-template-expression", value: "Record{\n value: Number\n}"}
],
children: [@html.text(text: @html-ui.text(language: $990, en: "Type", ja: "型", eo: "Tipo"))]
)
]
)
]
},
[
@html-ui.hidden(name: "part_name", value: $2),
@html-ui.labeled(
label: @html-ui.text(language: $990, en: "Type", ja: "型", eo: "Tipo"),
control: @html.element(
name: "textarea",
attributes: [{name: "name", value: "type"}, {name: "rows", value: "3"}, {name: "spellcheck", value: "false"}],
children: [
@html.text(
text: match $4 {
true =>
@html-ui.part-section(text: $3.text, start: "\ntype:\n", end: "\n\nexpression:\n"),
false =>
""
}
)
]
)
),
@html-ui.labeled(
label: @html-ui.text(language: $990, en: "Expression", ja: "式", eo: "Esprimo"),
control: @html.element(
name: "textarea",
attributes: [
{name: "name", value: "expression"},
{name: "rows", value: "20"},
{name: "spellcheck", value: "false"}
],
children: [
@html.text(
text: match $4 {
true =>
@html-ui.part-section(text: $3.text, start: "\n\nexpression:\n", end: ""),
false =>
""
}
)
]
)
),
@html-ui.labeled(
label: @html-ui.text(language: $990, en: "Visibility", ja: "公開範囲", eo: "Videbleco"),
control: @html.element(
name: "select",
attributes: [{name: "name", value: "visibility"}],
children: [
@html-ui.option(
value: "public",
label: @html-ui.text(language: $990, en: "Public", ja: "公開", eo: "Publika"),
selected: @core.not(value: @core.equal(left: $20, right: "private"))
),
@html-ui.option(
value: "private",
label: @html-ui.text(
language: $990,
en: "Private (only from its module)",
ja: "非公開 (同じモジュールからだけ参照できる)",
eo: "Privata (nur el sia modulo)"
),
selected: @core.equal(left: $20, right: "private")
)
]
)
),
@html-ui.labeled(
label: @html-ui.text(language: $990, en: "Description (English)", ja: "説明 (英語)", eo: "Priskribo (angla)"),
control: @html.element(
name: "input",
attributes: [
{name: "name", value: "description_en"},
{name: "value", value: @html-ui.description-of(text: $21, language: "en")}
],
children: []
)
),
@html-ui.labeled(
label: @html-ui.text(language: $990, en: "Description (Japanese)", ja: "説明 (日本語)", eo: "Priskribo (japana)"),
control: @html.element(
name: "input",
attributes: [
{name: "name", value: "description_ja"},
{name: "value", value: @html-ui.description-of(text: $21, language: "ja")}
],
children: []
)
),
@html-ui.labeled(
label: @html-ui.text(
language: $990,
en: "Description (Esperanto)",
ja: "説明 (エスペラント)",
eo: "Priskribo (Esperanta)"
),
control: @html.element(
name: "input",
attributes: [
{name: "name", value: "description_eo"},
{name: "value", value: @html-ui.description-of(text: $21, language: "eo")}
],
children: []
)
),
@html-ui.labeled(
label: @html-ui.text(
language: $990,
en: "Snapshot message",
ja: "スナップショットのメッセージ",
eo: "Mesaĝo de la momentfoto"
),
control: @html.element(
name: "input",
attributes: [
{name: "name", value: "message"},
{name: "placeholder", value: @core.string-concat(left: "Change ", right: $2)}
],
children: []
)
),
@html.element(
name: "p",
attributes: [],
children: [
@html.element(
name: "button",
attributes: [{name: "type", value: "button"}, {name: "id", value: "check-button"}],
children: [
@html.text(
text: @html-ui.text(language: $990, en: "Check types", ja: "型を確かめる", eo: "Kontroli tipojn")
)
]
),
@html.text(text: " "),
@html.element(
name: "button",
attributes: [{name: "type", value: "submit"}],
children: [
@html.text(
text: @html-ui.text(
language: $990,
en: "Take a snapshot",
ja: "スナップショットを作る",
eo: "Fari momentfoton"
)
)
]
),
@html.element(
name: "span",
attributes: [{name: "class", value: "muted"}],
children: [
@html.text(
text: @html-ui.text(
language: $990,
en: " Ctrl+Enter checks the types without taking a snapshot.",
ja: " Ctrl+Enter でスナップショットを作らずに型を確かめます。",
eo: " Ctrl+Enter kontrolas la tipojn sen fari momentfoton."
)
)
]
)
]
)
]
]
)
),
@html.element(name: "pre", attributes: [{name: "id", value: "out"}], children: []),
@html.element(
name: "h2",
attributes: [],
children: [
@html.text(text: @html-ui.text(language: $990, en: "Changes", ja: "変更の差分", eo: "Ŝanĝoj"))
]
),
@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 changes yet.",
ja: "まだ変更はありません。",
eo: "Ankoraŭ neniuj ŝanĝoj."
)
}
],
children: []
),
@html.element(
name: "script",
attributes: [{name: "type", value: "module"}],
children: [
@html.text(text: @core.string-concat(left: @html-ui.line-diff-script, right: @html-ui.snapshot-script))
]
)
]
)