about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-10-26 01:55:24 +0200
committerGitHub <noreply@github.com>2018-10-26 01:55:24 +0200
commit161aeadbb4fcd08bc6a38acae9626f4124c78951 (patch)
treed0fd1ce7710c4eccf203b8ccb927dda748a523b0 /app
parent768b0f132d8680563cce34e9abd8f3f3ba8a9bb9 (diff)
Remove character counter from edit profile (#9100)
* Remove display name and bio counter hint, simply limit input

* Remove now redundant translations

* Fix code style issue
Diffstat (limited to 'app')
-rw-r--r--app/javascript/packs/public.js16
-rw-r--r--app/views/settings/profiles/show.html.haml8
2 files changed, 5 insertions, 19 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index 11dc1bafc..3b02b7c39 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -21,7 +21,6 @@ window.addEventListener('message', e => {
 });
 
 function main() {
-  const { length } = require('stringz');
   const IntlMessageFormat = require('intl-messageformat').default;
   const { timeAgoString } = require('../mastodon/components/relative_timestamp');
   const { delegate } = require('rails-ujs');
@@ -133,26 +132,13 @@ function main() {
   });
 
   delegate(document, '#account_display_name', 'input', ({ target }) => {
-    const nameCounter = document.querySelector('.name-counter');
-    const name        = document.querySelector('.card .display-name strong');
-
-    if (nameCounter) {
-      nameCounter.textContent = 30 - length(target.value);
-    }
+    const name = document.querySelector('.card .display-name strong');
 
     if (name) {
       name.innerHTML = emojify(target.value);
     }
   });
 
-  delegate(document, '#account_note', 'input', ({ target }) => {
-    const noteCounter = document.querySelector('.note-counter');
-
-    if (noteCounter) {
-      noteCounter.textContent = 160 - length(target.value);
-    }
-  });
-
   delegate(document, '#account_avatar', 'change', ({ target }) => {
     const avatar = document.querySelector('.card .avatar img');
     const [file] = target.files || [];
diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml
index 42e3840a1..f5c50144b 100644
--- a/app/views/settings/profiles/show.html.haml
+++ b/app/views/settings/profiles/show.html.haml
@@ -6,8 +6,8 @@
 
   .fields-row
     .fields-row__column.fields-group.fields-row__column-6
-      = f.input :display_name, wrapper: :with_label, hint: t('simple_form.hints.defaults.display_name', count: 30 - @account.display_name.size).html_safe
-      = f.input :note, wrapper: :with_label, hint: t('simple_form.hints.defaults.note', count: 160 - @account.note.size).html_safe
+      = f.input :display_name, wrapper: :with_label, input_html: { maxlength: 30 }, hint: false
+      = f.input :note, wrapper: :with_label, input_html: { maxlength: 160 }, hint: false
 
   .fields-row
     .fields-row__column.fields-row__column-6
@@ -36,8 +36,8 @@
 
         = f.simple_fields_for :fields do |fields_f|
           .row
-            = fields_f.input :name, placeholder: t('simple_form.labels.account.fields.name')
-            = fields_f.input :value, placeholder: t('simple_form.labels.account.fields.value')
+            = fields_f.input :name, placeholder: t('simple_form.labels.account.fields.name'), input_html: { maxlength: 255 }
+            = fields_f.input :value, placeholder: t('simple_form.labels.account.fields.value'), input_html: { maxlength: 255 }
 
     .fields-row__column.fields-group.fields-row__column-6
       %h6= t('verification.verification')