Просмотр исходного кода

Merge pull request #10609 from growilabs/feat/174791-175791-change-ui-to-a-checkbox

feat: Change ui to a checkbox
Yuki Takei 3 месяцев назад
Родитель
Сommit
346cee4957

+ 2 - 2
apps/app/public/static/locales/en_US/admin.json

@@ -356,8 +356,8 @@
     "confidential_example": "ex): internal use only",
     "default_language": "Default language for new users",
     "default_mail_visibility": "Disclose e-mail for new users",
-    "default_read_only_for_new_user": "New User Viewing Permissions Settings",
-    "editable": "Editable",
+    "default_read_only_for_new_user": "Editing Restrictions for New Users",
+    "set_read_only_for_new_user": "Set new users to read-only mode",
     "file_uploading": "File uploading",
     "enable_files_except_image": "Enabling this option will allow upload of any file type. Without this option, only image file upload is supported.",
     "attach_enable": "You can attach files other than image files if you enable this option.",

+ 2 - 2
apps/app/public/static/locales/fr_FR/admin.json

@@ -356,8 +356,8 @@
     "confidential_example": "ex): usage interne seulement",
     "default_language": "Langue par défaut",
     "default_mail_visibility": "Mode d'affichage de l'adresse courriel",
-    "default_read_only_for_new_user": "Configuration des droits d'accès pour les nouveaux utilisateurs",
-    "editable": "modifiable",
+    "default_read_only_for_new_user": "Restriction d'édition pour les nouveaux utilisateurs",
+    "set_read_only_for_new_user": "Rendre les nouveaux utilisateurs en lecture seule",
     "file_uploading": "Téléversement de fichiers",
     "enable_files_except_image": "Autoriser tout les types de fichiers",
     "attach_enable": "Autorise le téléversement de tout les types de fichiers.",

+ 2 - 2
apps/app/public/static/locales/ja_JP/admin.json

@@ -365,8 +365,8 @@
     "confidential_example": "例: 社外秘",
     "default_language": "新規ユーザーのデフォルト設定言語",
     "default_mail_visibility": "新規ユーザーの初期メール公開設定",
-    "default_read_only_for_new_user": "新規ユーザーの閲覧権限設定",
-    "editable": "編集可能",
+    "default_read_only_for_new_user": "新規ユーザーの編集制限",
+    "set_read_only_for_new_user": "新規ユーザーを閲覧専用にする",
     "file_uploading": "ファイルアップロード",
     "enable_files_except_image": "画像以外のファイルアップロードを許可",
     "attach_enable": "許可をしている場合、画像以外のファイルをページに添付可能になります。",

+ 2 - 2
apps/app/public/static/locales/ko_KR/admin.json

@@ -356,8 +356,8 @@
     "confidential_example": "예): 내부 전용",
     "default_language": "새 사용자를 위한 기본 언어",
     "default_mail_visibility": "새 사용자를 위한 이메일 공개",
-    "default_read_only_for_new_user": "신규 사용자의 열람 권한 설정",
-    "editable": "편집 가능",
+    "default_read_only_for_new_user": "신규 사용자의 편집 제한",
+    "set_read_only_for_new_user": "신규 사용자를 열람 전용으로 설정",
     "file_uploading": "파일 업로드",
     "enable_files_except_image": "이 옵션을 활성화하면 모든 파일 형식을 업로드할 수 있습니다. 이 옵션이 없으면 이미지 파일 업로드만 지원됩니다.",
     "attach_enable": "이 옵션을 활성화하면 이미지 파일 외의 파일을 첨부할 수 있습니다.",

+ 2 - 2
apps/app/public/static/locales/zh_CN/admin.json

@@ -365,8 +365,8 @@
     "confidential_example": "ex):仅供内部使用",
     "default_language": "新用户的默认语言",
     "default_mail_visibility": "新用户的默认电子邮件可见性",
-    "default_read_only_for_new_user": "新用戶的瀏覽權限設定",
-    "editable": "可編輯",
+    "default_read_only_for_new_user": "新用戶編輯限制",
+    "set_read_only_for_new_user": "將新用戶設為僅限瀏覽",
     "file_uploading": "文件上传",
     "enable_files_except_image": "启用此选项将允许上传任何文件类型。如果没有此选项,则仅支持图像文件上载。",
     "attach_enable": "如果启用此选项,则可以附加图像文件以外的文件。",

+ 5 - 19
apps/app/src/client/components/Admin/App/AppSetting.jsx

@@ -35,7 +35,7 @@ const AppSetting = (props) => {
       globalLang: adminAppContainer.state.globalLang || 'en-US',
       // Convert boolean to string for radio button value
       isEmailPublishedForNewUser: String(adminAppContainer.state.isEmailPublishedForNewUser ?? true),
-      isReadOnlyForNewUser: String(adminAppContainer.state.isReadOnlyForNewUser ?? false),
+      isReadOnlyForNewUser: adminAppContainer.state.isReadOnlyForNewUser ?? false,
       fileUpload: adminAppContainer.state.fileUpload ?? false,
     });
   }, [
@@ -59,8 +59,7 @@ const AppSetting = (props) => {
       // Convert string 'true'/'false' to boolean
       const isEmailPublished = data.isEmailPublishedForNewUser === 'true' || data.isEmailPublishedForNewUser === true;
       await adminAppContainer.changeIsEmailPublishedForNewUserShow(isEmailPublished);
-      const isReadOnlyForNewUser = data.isReadOnlyForNewUser === 'true' || data.isReadOnlyForNewUser === true;
-      await adminAppContainer.changeIsReadOnlyForNewUserShow(isReadOnlyForNewUser);
+      await adminAppContainer.changeIsReadOnlyForNewUserShow(data.isReadOnlyForNewUser);
       await adminAppContainer.changeFileUpload(data.fileUpload);
 
       await adminAppContainer.updateAppSettingHandler();
@@ -177,26 +176,13 @@ const AppSetting = (props) => {
 
           <div className="form-check form-check-inline">
             <input
-              type="radio"
-              id="radio-email-show"
-              className="form-check-input"
-              value="true"
-              {...register('isReadOnlyForNewUser')}
-            />
-            <label className="form-label form-check-label" htmlFor="radio-email-show">{t('admin:user_management.user_table.read_only')}</label>
-          </div>
-
-          <div className="form-check form-check-inline">
-            <input
-              type="radio"
-              id="radio-email-hide"
+              type="checkbox"
+              id="checkbox-read-only-for-new-user"
               className="form-check-input"
-              value="false"
               {...register('isReadOnlyForNewUser')}
             />
-            <label className="form-label form-check-label" htmlFor="radio-email-hide">{t('admin:app_setting.editable')}</label>
+            <label className="form-label form-check-label" htmlFor="checkbox-read-only-for-new-user">{t('admin:app_setting.set_read_only_for_new_user')}</label>
           </div>
-
         </div>
       </div>