Skip to content

Commit

Permalink
Clan update and create message validations (#531)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
beckpaul authored Dec 14, 2023
1 parent 7f8d01b commit b8240d5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
6 changes: 5 additions & 1 deletion public/styles/abstracts/_mixins.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/backend/routes/views/clans/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down
7 changes: 4 additions & 3 deletions src/backend/routes/views/clans/post/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down
4 changes: 2 additions & 2 deletions src/backend/templates/views/clans/create.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/backend/templates/views/clans/manage.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit b8240d5

Please sign in to comment.