From df76ae8f0f9abedb288911faa48b3c4412b2a750 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 2 Jun 2016 13:18:11 -0400 Subject: [PATCH] Added counters to some text fields, fixed some phone fields, other changes --- views/admin/events/edit.html | 31 ++++++++++++++++++++++++++++++ views/admin/events/editFiles.html | 13 ++++++------- views/admin/events/editStatus.html | 4 ++-- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/views/admin/events/edit.html b/views/admin/events/edit.html index f453774..7d9aeeb 100644 --- a/views/admin/events/edit.html +++ b/views/admin/events/edit.html @@ -246,7 +246,13 @@ }); fullCalendarLoaded = true; + } + + // Count remaining characters in field + $('.glm-char-count').keyup( function() { + glmCharsRemaining($(this)); + }); }); @@ -1053,6 +1059,31 @@ } }); + // Display number of characters remaining in limited field + function glmCharsRemaining(f) { + var maxChar = f.attr('maxlength'); + var len = f.val().length; + var rem = maxChar - len; + var msgArea = f.attr('data-msgArea'); + if (rem < 0) { + rem = rem * -1; + $('#' + msgArea).html('There are ' + rem + ' more characters than permitted'); + } else { + $('#' + msgArea).html('Characters remaining: ' + rem); + } + } + + // Setup initial fields using limited character counts + $('.glm-char-count').each( function() { + glmCharsRemaining($(this)); + }); + + // Count remaining characters in field + $('.glm-char-count').keyup( function() { + glmCharsRemaining($(this)); + }); + + // Set masking for phone number fields - see http://digitalbush.com/projects/masked-input-plugin/ $.mask.definitions['e'] = "[A-Za-z0-9: ]"; $(".glm-phone-input").mask("999-999-9999? eeeeeeeeeee"); diff --git a/views/admin/events/editFiles.html b/views/admin/events/editFiles.html index c3c6393..376599b 100644 --- a/views/admin/events/editFiles.html +++ b/views/admin/events/editFiles.html @@ -2,7 +2,6 @@ - @@ -39,8 +38,8 @@ @@ -61,8 +60,8 @@ diff --git a/views/admin/events/editStatus.html b/views/admin/events/editStatus.html index 5f81075..c767d2f 100644 --- a/views/admin/events/editStatus.html +++ b/views/admin/events/editStatus.html @@ -146,8 +146,8 @@ -- 2.17.1
 

(maximum description length 250 characters)

File #1: @@ -18,8 +17,8 @@
   Description: - -
Maximum 165 characters + +
{if $event.fieldFail.file1_descr}

{$event.fieldFail.file1_descr}

{/if}
   Description: - -
Maximum 165 characters + +
{if $event.fieldFail.file2_descr}

{$event.fieldFail.file2_descr}

{/if}
   Description: - -
Maximum 165 characters + +
{if $event.fieldFail.file3_descr}

{$event.fieldFail.file3_descr}

{/if}
Intro Text: - -
Maximum 165 characters + +
{if $event.fieldFail.intro}

{$event.fieldFail.intro}

{/if}