Explorer

html-ui.module-tools

description
(en) Forms to change the description, visibility and name of a module and to delete it
type
Fn(language: String, project: String, branch: String, module: String, response: @html-ui.response) -> List<@html.node>
expression
fn(language$990, project$0, branch$1, module$2, response$3) =>
  let visibility$5 = @html-ui.json-text(value: $3.json, key: "visibility");
  @html.concat(
    lists: [
      [
        @html.element(
          name: "h2",
          attributes: [],
          children: [
            @html.text(
              text: @html-ui.text(language: $990, en: "Module settings", ja: "モジュールの設定", eo: "Agordoj de la modulo")
            )
          ]
        ),
        @html.element(
          name: "p",
          attributes: [],
          children: [
            @html.text(
              text: @html-ui.text(
                language: $990,
                en: "Renaming does not rewrite the references from other parts, so if parts of this module are referenced, the type check fails and it cannot be saved.",
                ja: "名前を変えても他のパーツからの参照は書き換えないので, このモジュールのパーツが参照されていると型検査の誤りになって保存できません。",
                eo: "Renomado ne reskribas la referencojn el aliaj partoj, do se partoj de ĉi tiu modulo estas referencataj, la tipkontrolo malsukcesas kaj ĝi ne povas esti konservita."
              )
            )
          ]
        )
      ],
      @html-ui.tool-form(
        tool: "definy_create_snapshot",
        then: @core.string-join(items: ["/p/", $0, "/", $1, "/{modules.0.rename}"], separator: ""),
        confirm: "",
        fields: @core.list-concat(
          left: [
            @html-ui.hidden(name: "project", value: $0),
            @html-ui.hidden(name: "branch", value: $1),
            @html-ui.hidden(name: "message", value: @core.string-concat(left: "Change module ", right: $2)),
            @html-ui.hidden(name: "modules.0.module", value: $2),
            @html.element(
              name: "label",
              attributes: [],
              children: [
                @html.text(text: @html-ui.text(language: $990, en: "Name", ja: "名前", eo: "Nomo")),
                @html.element(
                  name: "input",
                  attributes: [
                    {name: "name", value: "modules.0.rename"},
                    {name: "required", value: ""},
                    {name: "value", value: $2}
                  ],
                  children: []
                )
              ]
            ),
            @html.element(
              name: "label",
              attributes: [],
              children: [
                @html.text(text: @html-ui.text(language: $990, en: "Visibility ", ja: "公開範囲 ", eo: "Videbleco ")),
                @html.element(
                  name: "select",
                  attributes: [{name: "name", value: "modules.0.visibility"}],
                  children: [
                    @html-ui.option(
                      value: "public",
                      label: @html-ui.text(language: $990, en: "Public", ja: "公開", eo: "Publika"),
                      selected: @core.equal(left: $5, right: "public")
                    ),
                    @html-ui.option(
                      value: "private",
                      label: @html-ui.text(language: $990, en: "Private", ja: "非公開", eo: "Privata"),
                      selected: @core.equal(left: $5, right: "private")
                    )
                  ]
                )
              ]
            )
          ],
          right: @html-ui.description-fields(
            language: $990,
            prefix: "modules.0.descriptions",
            texts: @definy.mcp-read-descriptions(value: @definy.json-get(value: $3.json, key: "descriptions"))
          )
        ),
        button: @html-ui.text(language: $990, en: "Save", ja: "保存", eo: "Konservi")
      ),
      [
        @html.element(
          name: "h2",
          attributes: [],
          children: [
            @html.text(
              text: @html-ui.text(language: $990, en: "Delete the module", ja: "モジュールを消す", eo: "Forigi la modulon")
            )
          ]
        )
      ],
      @html-ui.tool-form(
        tool: "definy_create_snapshot",
        then: @core.string-join(items: ["/p/", $0, "/", $1], separator: ""),
        confirm: @core.string-join(
          items: [
            @html-ui.text(language: $990, en: "Delete the module ", ja: "モジュール ", eo: "Ĉu forigi la modulon "),
            $2,
            @html-ui.text(
              language: $990,
              en: " and all its parts?",
              ja: " と全てのパーツを消しますか?",
              eo: " kaj ĉiujn ĝiajn partojn?"
            )
          ],
          separator: ""
        ),
        fields: [
          @html-ui.hidden(name: "project", value: $0),
          @html-ui.hidden(name: "branch", value: $1),
          @html-ui.hidden(name: "message", value: @core.string-concat(left: "Delete module ", right: $2)),
          @html-ui.hidden-json(
            name: "modules",
            value: @core.string-join(
              items: ["[{\"module\":", @definy.json-string-literal(value: $2), ",\"delete\":true}]"],
              separator: ""
            )
          )
        ],
        button: @html-ui.text(language: $990, en: "Delete", ja: "消す", eo: "Forigi")
      )
    ]
  )
visibility
public
html-ui.module-tools (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: sBd8kNILjH548dZ5goy5ILtpKSm6SXXWK6_hzvNX8hg
content hash: tZ044Mk2bMHKjzhAPGeONRMGKcoh-DxnAnqiCK1XGP8