From dcbec40d0c35cb1373ea89760c237cc78f2a06f1 Mon Sep 17 00:00:00 2001 From: swag Date: Tue, 9 May 2023 21:15:16 -0400 Subject: [PATCH] More template cleanup for HTML validation --- templates/moderator/admin_reset.html.ep | 4 ++-- templates/moderator/create.html.ep | 6 +++--- templates/moderator/demote.html.ep | 2 +- templates/moderator/lock_acct.html.ep | 2 +- templates/moderator/login.html.ep | 4 ++-- templates/moderator/mod_reset.html.ep | 2 +- templates/moderator/promote.html.ep | 2 +- templates/moderator/unlock_acct.html.ep | 2 +- templates/remark/create.html.ep | 6 ++++-- templates/thread/create.html.ep | 5 ++++- 10 files changed, 20 insertions(+), 15 deletions(-) diff --git a/templates/moderator/admin_reset.html.ep b/templates/moderator/admin_reset.html.ep index 9ccb05c..8dd8547 100644 --- a/templates/moderator/admin_reset.html.ep +++ b/templates/moderator/admin_reset.html.ep @@ -4,11 +4,11 @@
<%= label_for password => 'Password' %> - <%= password_field 'password' %> + <%= password_field password => (id => 'password') %>
<%= submit_button 'Reset' %>
diff --git a/templates/moderator/create.html.ep b/templates/moderator/create.html.ep index e28252f..6f6dfa7 100644 --- a/templates/moderator/create.html.ep +++ b/templates/moderator/create.html.ep @@ -4,15 +4,15 @@
<%= label_for name => 'Name' %> - <%= text_field 'name' %> + <%= text_field name => (id => 'name') %>
<%= label_for password => 'Password' %> - <%= password_field 'password' %> + <%= password_field password => (id => 'password') %>
<%= submit_button 'Create' %>
diff --git a/templates/moderator/demote.html.ep b/templates/moderator/demote.html.ep index de9933c..b0f810f 100644 --- a/templates/moderator/demote.html.ep +++ b/templates/moderator/demote.html.ep @@ -4,7 +4,7 @@
<%= submit_button 'Demote' %>
diff --git a/templates/moderator/lock_acct.html.ep b/templates/moderator/lock_acct.html.ep index e14e006..68ff150 100644 --- a/templates/moderator/lock_acct.html.ep +++ b/templates/moderator/lock_acct.html.ep @@ -4,7 +4,7 @@
<%= submit_button 'Lock' %>
diff --git a/templates/moderator/login.html.ep b/templates/moderator/login.html.ep index b7b06b7..716b16c 100644 --- a/templates/moderator/login.html.ep +++ b/templates/moderator/login.html.ep @@ -4,11 +4,11 @@
<%= label_for password => 'Password' %> - <%= password_field 'password' %> + <%= password_field password => (id => 'password') %>
<%= submit_button 'Login' %>
diff --git a/templates/moderator/mod_reset.html.ep b/templates/moderator/mod_reset.html.ep index 4d4ac44..dabe634 100644 --- a/templates/moderator/mod_reset.html.ep +++ b/templates/moderator/mod_reset.html.ep @@ -4,7 +4,7 @@
<%= label_for password => 'Password' %> - <%= password_field 'password' %> + <%= password_field password => (id => 'password') %>
<%= submit_button 'Reset' %>
diff --git a/templates/moderator/promote.html.ep b/templates/moderator/promote.html.ep index 014c46d..7520899 100644 --- a/templates/moderator/promote.html.ep +++ b/templates/moderator/promote.html.ep @@ -4,7 +4,7 @@
<%= submit_button 'Promote' %>
diff --git a/templates/moderator/unlock_acct.html.ep b/templates/moderator/unlock_acct.html.ep index dcd70f1..0d91327 100644 --- a/templates/moderator/unlock_acct.html.ep +++ b/templates/moderator/unlock_acct.html.ep @@ -4,7 +4,7 @@
<%= submit_button 'Unlock' %>
diff --git a/templates/remark/create.html.ep b/templates/remark/create.html.ep index 7cdb36a..2e71141 100644 --- a/templates/remark/create.html.ep +++ b/templates/remark/create.html.ep @@ -5,6 +5,7 @@
<%= label_for author => 'Author' %> <%= text_field author => session->{'author'}, ( + id => 'author', maxlength => 63, minlength => 1 ) %> @@ -15,11 +16,12 @@
<%= label_for body => 'Text' %> <%= text_area body => ( + id => 'body', maxlength => 4000, minlength => 2, - required => 'true', + required => undef, rows => 6, - autofocus => 'autofocus' + autofocus => undef ) %> <% if (my $error = validation->error('body')) { =%>

Invalid text: Up to 4,000 characters only.

diff --git a/templates/thread/create.html.ep b/templates/thread/create.html.ep index b122c0c..9484ab4 100644 --- a/templates/thread/create.html.ep +++ b/templates/thread/create.html.ep @@ -5,6 +5,7 @@
<%= label_for author => 'Author' %> <%= text_field author => session->{'author'}, ( + id => 'author', maxlength => 63, minlength => 1 ) %> @@ -15,9 +16,10 @@
<%= label_for title => 'Title' %> <%= text_field title => ( + id => 'title', maxlength => 127, minlength => 1, - autofocus => 'autofocus' + autofocus => undef ) %> <% if (my $error = validation->error('title')) { =%>

Invalid title: 1 to 127 characters please.

@@ -26,6 +28,7 @@
<%= label_for body => 'Text' %> <%= text_area body => ( + id => 'body', maxlength => 4000, minlength => 2, required => 'true',