diff --git a/modules/structs/org.go b/modules/structs/org.go index b4c58623fd2..7c83dcdee7e 100644 --- a/modules/structs/org.go +++ b/modules/structs/org.go @@ -30,8 +30,8 @@ type OrganizationPermissions struct { // CreateOrgOption options for creating an organization type CreateOrgOption struct { // required: true - UserName string `json:"username" binding:"Required"` - FullName string `json:"full_name"` + UserName string `json:"username" binding:"Required;Username;MaxSize(40)"` + FullName string `json:"full_name" binding:"MaxSize(100)"` Description string `json:"description" binding:"MaxSize(255)"` Website string `json:"website" binding:"ValidUrl;MaxSize(255)"` Location string `json:"location" binding:"MaxSize(50)"` @@ -45,7 +45,7 @@ type CreateOrgOption struct { // EditOrgOption options for editing an organization type EditOrgOption struct { - FullName string `json:"full_name"` + FullName string `json:"full_name" binding:"MaxSize(100)"` Description string `json:"description" binding:"MaxSize(255)"` Website string `json:"website" binding:"ValidUrl;MaxSize(255)"` Location string `json:"location" binding:"MaxSize(50)"` diff --git a/templates/org/create.tmpl b/templates/org/create.tmpl index 26321f62084..0cc93c1e987 100644 --- a/templates/org/create.tmpl +++ b/templates/org/create.tmpl @@ -11,7 +11,7 @@ {{template "base/alert" .}}
- + {{.locale.Tr "org.org_name_helper"}}
diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl index c1623db4d74..a7ddb1fa417 100644 --- a/templates/org/settings/options.tmpl +++ b/templates/org/settings/options.tmpl @@ -14,26 +14,27 @@ {{.CsrfTokenHtml}}
- +
- +
- +
- +
- +
diff --git a/web_src/js/features/common-organization.js b/web_src/js/features/common-organization.js index 1796efc6a8c..352e824b05b 100644 --- a/web_src/js/features/common-organization.js +++ b/web_src/js/features/common-organization.js @@ -1,25 +1,16 @@ import $ from 'jquery'; import {initCompLabelEdit} from './comp/LabelEdit.js'; -import {hideElem, showElem} from '../utils/dom.js'; +import {toggleElem} from '../utils/dom.js'; export function initCommonOrganization() { if ($('.organization').length === 0) { return; } - if ($('.organization.settings.options').length > 0) { - $('#org_name').on('keyup', function () { - const $prompt = $('#org-name-change-prompt'); - const $prompt_redirect = $('#org-name-change-redirect-prompt'); - if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) { - showElem($prompt); - showElem($prompt_redirect); - } else { - hideElem($prompt); - hideElem($prompt_redirect); - } - }); - } + $('.organization.settings.options #org_name').on('input', function () { + const nameChanged = $(this).val().toLowerCase() !== $(this).attr('data-org-name').toLowerCase(); + toggleElem('#org-name-change-prompt', nameChanged); + }); // Labels initCompLabelEdit('.organization.settings.labels');