From b8240d55e32d1a832b32b1ae0f0db7135083c652 Mon Sep 17 00:00:00 2001 From: Beck <50498548+beckpaul@users.noreply.github.com> Date: Thu, 14 Dec 2023 16:29:17 -0500 Subject: [PATCH] Clan update and create message validations (#531) * edit validations to only provide a single error msg if empty or over 1k chars * add padding to button used in create and update clan views - class was applied but didn't exist. add class to update view * english fix * normalize btn * implement same error standards on create errors --- public/styles/abstracts/_mixins.sass | 6 +++++- src/backend/routes/views/clans/create.js | 7 ++++--- src/backend/routes/views/clans/post/update.js | 7 ++++--- src/backend/templates/views/clans/create.pug | 4 ++-- src/backend/templates/views/clans/manage.pug | 6 +++--- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/public/styles/abstracts/_mixins.sass b/public/styles/abstracts/_mixins.sass index 365d875f..c0650dc0 100644 --- a/public/styles/abstracts/_mixins.sass +++ b/public/styles/abstracts/_mixins.sass @@ -95,7 +95,11 @@ button font-size: 0.75em margin: 0.25em padding: 0.5em - +.bigButton + @include button + font-size: 1em + margin: 0.75em + padding: 1em .descriptionMain //background-color: variables.$background-secondary padding: 10px diff --git a/src/backend/routes/views/clans/create.js b/src/backend/routes/views/clans/create.js index b10136f6..be0ad2c4 100644 --- a/src/backend/routes/views/clans/create.js +++ b/src/backend/routes/views/clans/create.js @@ -8,9 +8,10 @@ module.exports = [ ) .notEmpty() .isLength({ max: 3 }), - body('clan_description', 'Please add a description for your clan') - .notEmpty() - .isLength({ max: 1000 }), + body('clan_description', 'Cannot exceed 1000 characters').isLength({ + max: 1000, + }), + body('clan_description', 'Cannot be empty').notEmpty(), body('clan_name', "Please indicate your clan's name") .notEmpty() .isLength({ max: 40 }), diff --git a/src/backend/routes/views/clans/post/update.js b/src/backend/routes/views/clans/post/update.js index 12660c1b..f7f6f032 100644 --- a/src/backend/routes/views/clans/post/update.js +++ b/src/backend/routes/views/clans/post/update.js @@ -8,9 +8,10 @@ exports = module.exports = [ ) .notEmpty() .isLength({ max: 3 }), - body('clan_description', 'Please add a description for your clan') - .notEmpty() - .isLength({ max: 1000 }), + body('clan_description', 'Cannot exceed 1000 characters').isLength({ + max: 1000, + }), + body('clan_description', 'Cannot be empty').notEmpty(), body('clan_name', "Please indicate your clan's name") .notEmpty() .isLength({ max: 40 }), diff --git a/src/backend/templates/views/clans/create.pug b/src/backend/templates/views/clans/create.pug index de281872..d97f46c5 100644 --- a/src/backend/templates/views/clans/create.pug +++ b/src/backend/templates/views/clans/create.pug @@ -50,8 +50,8 @@ block content name='clan_description', title='description', required='required', - placeholder='The description players will see when they look your clan' + placeholder='The description players will see when they view your clan' ) #{ clan_description } br - button.bigButton(type='submit') Create your Clan + button.bigButton(type='submit') Create Your Clan diff --git a/src/backend/templates/views/clans/manage.pug b/src/backend/templates/views/clans/manage.pug index f2d8ed7d..4cc04618 100644 --- a/src/backend/templates/views/clans/manage.pug +++ b/src/backend/templates/views/clans/manage.pug @@ -37,11 +37,11 @@ block content name='clan_description', title='description', required='required', - placeholder='The description players will see when they look your clan' + placeholder='The description players will see when they view your clan' ) #{ clan_description } br - button(type='submit') Update Clan Settings + button.bigButton(type='submit') Update Clan Settings br br hr @@ -56,5 +56,5 @@ block content action='/clans/destroy', onsubmit='return confirm(\'THIS OPERATION IS DEFINITIVE. Press OK to confirm you want to delete your clan\');' ) - button(type='submit') Delete my clan + button(type='submit') Delete My Clan br