Scredit · YAML

- conEditRoot:
    Control: GroupContainer@1.5.0
    Variant: AutoLayout
    Properties:
      Fill: =RGBA(255, 255, 255, 1)
      Height: =Parent.Height
      LayoutAlignItems: =LayoutAlignItems.Stretch
      LayoutDirection: =LayoutDirection.Vertical
      LayoutGap: =8
      PaddingBottom: =16
      PaddingLeft: =24
      PaddingRight: =24
      PaddingTop: =16
      Width: =Parent.Width
      X: =0
      Y: =0
    Children:
      - lblEditHeading:
          Control: Label@2.5.1
          Properties:
            FontWeight: =FontWeight.Bold
            Height: =44
            Size: =20
            Text: =If(gblFormMode = "edit", "投稿を編集", "新規投稿")
      - lblEditNote:
          Control: Label@2.5.1
          Properties:
            AutoHeight: =true
            Color: =RGBA(96, 96, 96, 1)
            Height: =40
            Size: =11
            Text: ="投稿者名は画面上ですべて「匿名」と表示されます。なお、管理のためSharePointには投稿者の情報が記録されます。"
      - lblPostCategoryLabel:
          Control: Label@2.5.1
          Properties:
            FontWeight: =FontWeight.Semibold
            Height: =28
            Text: ="カテゴリ"
      - tabPostCategory:
          Control: ModernTabList@1.0.2
          Properties:
            AlignInContainer: =AlignInContainer.Start
            Appearance: =TabListAppearance.FilledCircular
            Default: |-
              =If(gblFormMode = "edit", {Value: gblThread.Category.Value}, {Value: "質問"})
            Height: =36
            Items: =["質問", "雑談", "要望", "お知らせ"]
            LayoutMinHeight: =16
            LayoutMinWidth: =16
            Width: =360
      - lblPostTitleLabel:
          Control: Label@2.5.1
          Properties:
            FontWeight: =FontWeight.Semibold
            Height: =28
            Text: ="タイトル(必須・100文字以内)"
      - txtTitle:
          Control: Classic/TextInput@2.3.2
          Properties:
            Default: =If(gblFormMode = "edit", gblThread.Title, "")
            Height: =40
            HintText: ="タイトルを入力"
            MaxLength: =100
      - lblTitleError:
          Control: Label@2.5.1
          Properties:
            Color: =RGBA(164, 38, 44, 1)
            Height: =22
            Size: =11
            Text: ="タイトルを入力してください。"
            Visible: =locSubmitted && IsBlank(Trim(txtTitle.Text))
      - lblPostBodyLabel:
          Control: Label@2.5.1
          Properties:
            FontWeight: =FontWeight.Semibold
            Height: =28
            Text: ="本文(必須・2000文字以内)"
      - txtBody:
          Control: Classic/TextInput@2.3.2
          Properties:
            Default: =If(gblFormMode = "edit", gblThread.Body, "")
            FillPortions: =1
            Height: =160
            HintText: ="本文を入力"
            LayoutMinHeight: =120
            MaxLength: =2000
            Mode: =TextMode.MultiLine
      - lblBodyInfo:
          Control: Label@2.5.1
          Properties:
            Color: =If(locSubmitted && IsBlank(Trim(txtBody.Text)), RGBA(164, 38, 44, 1), RGBA(96, 96, 96, 1))
            Height: =22
            Size: =11
            Text: =If(locSubmitted && IsBlank(Trim(txtBody.Text)), "本文を入力してください。", Len(txtBody.Text) & " / 2000 文字")
      - conEditButtons:
          Control: GroupContainer@1.5.0
          Variant: AutoLayout
          Properties:
            FillPortions: =0
            Height: =52
            LayoutAlignItems: =LayoutAlignItems.Center
            LayoutDirection: =LayoutDirection.Horizontal
            LayoutGap: =8
            LayoutMinHeight: =16
            LayoutMinWidth: =16
          Children:
            - btnSavePost:
                Control: Classic/Button@2.2.0
                Properties:
                  Height: =40
                  OnSelect: |-
                    =UpdateContext({locSubmitted: true});
                    If(
                        IsBlank(Trim(txtTitle.Text)) || IsBlank(Trim(txtBody.Text)),
                        Notify("入力内容を確認してください。", NotificationType.Warning),
                        gblFormMode = "edit" && Lower(gblThread.Author.Email) <> gblMe,
                        Notify("自分の投稿以外は編集できません。", NotificationType.Error),
                        gblFormMode = "edit",
                        IfError(
                            Patch(
                                colThreads,
                                LookUp(colThreads, ID = gblThread.ID),
                                {
                                    Title: Trim(txtTitle.Text),
                                    Body: txtBody.Text,
                                    Category: {Value: tabPostCategory.Selected.Value},
                                    Modified: Now()
                                }
                            );
                            Set(gblThread, LookUp(colThreads, ID = gblThread.ID));
                            Notify("投稿を更新しました。", NotificationType.Success);
                            Navigate(scrDetail, ScreenTransition.None),
                            Notify("更新に失敗しました。時間をおいて再度お試しください。", NotificationType.Error)
                        ),
                        IfError(
                            Collect(
                                colThreads,
                                {
                                    ID: Coalesce(Max(colThreads, ID), 0) + 1,
                                    Title: Trim(txtTitle.Text),
                                    Body: txtBody.Text,
                                    Category: {Value: tabPostCategory.Selected.Value},
                                    Author: {Email: gblMe},
                                    Created: Now(),
                                    Modified: Now(),
                                    IsDeleted: false
                                }
                            );
                            Notify("投稿しました。", NotificationType.Success);
                            Navigate(scrList, ScreenTransition.None),
                            Notify("投稿に失敗しました。時間をおいて再度お試しください。", NotificationType.Error)
                        )
                    )
                  Text: =If(gblFormMode = "edit", "保存", "投稿する")
                  Width: =140
            - btnCancelPost:
                Control: Classic/Button@2.2.0
                Properties:
                  BorderColor: =RGBA(200, 200, 200, 1)
                  BorderThickness: =1
                  Color: =RGBA(50, 49, 48, 1)
                  Fill: =RGBA(255, 255, 255, 1)
                  Height: =40
                  HoverColor: =RGBA(50, 49, 48, 1)
                  HoverFill: =RGBA(243, 242, 241, 1)
                  OnSelect: =If(gblFormMode = "edit", Navigate(scrDetail, ScreenTransition.None), Navigate(scrList, ScreenTransition.None))
                  Text: ="キャンセル"
                  Width: =140

コメントを残す

メールアドレスが公開されることはありません。 ※ が付いている欄は必須項目です

日記

前の記事

小説アイディア
日記

次の記事

匿名掲示板 進捗メモNew!!