Skip to content

Commit 8371722

Browse files
committed
Implement Autosize on textarea elements
1 parent 040cb88 commit 8371722

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

client/javascripts/application.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ JS.Inbox = {};
2727

2828
JS.Globals = {
2929
homepageChallengeAnswer : /^['"][A-z-\.\s]*['"](;)?/,
30-
userNameCookie : 'try_name'
30+
userNameCookie : 'try_name',
31+
Vendor : {
32+
autosizeQuery : '.js-autosize'
33+
}
3134
};
3235

3336
// -------------------------------------

client/javascripts/components/dispatcher/feedback.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@ JS.Pages.Feedback = function() {
1313

1414
JS.Modules.SaveProgress.init();
1515

16+
// -------------------------------------
17+
// Vendor
18+
// -------------------------------------
19+
20+
autosize($(JS.Globals.Vendor.autosizeQuery));
21+
1622
};

client/javascripts/components/dispatcher/news.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,10 @@ JS.Pages.News = function() {
3030
elementNode : '.js-alert'
3131
});
3232

33+
// -------------------------------------
34+
// Vendor
35+
// -------------------------------------
36+
37+
autosize($(JS.Globals.Vendor.autosizeQuery));
38+
3339
};

views/feedback/index.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ block content
3838

3939
fieldset.form-field
4040
label.form-label(for='comment' id='Field1') Give us your feedback to help us improve the site.
41-
textarea.form-input.js-formValidator-input.js-saveProgress(name='Field1' id='Field1' rows='10' required='true' data-validate='required' data-saveprogress='feedback_content')
41+
textarea.form-input.form-textarea.js-autosize.js-formValidator-input.js-saveProgress(name='Field1' id='Field1' rows='8' required='true' data-validate='required' data-saveprogress='feedback_content')
4242

4343
input.btn.js-formValidator-submit(id='saveForm' name='saveForm' type='submit' value='Submit')
4444

views/news/new.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ block content
5050
span.form-label Description
5151

5252
- bodyValue = body ? body : ''
53-
textarea.form-input.form-textarea.js-counter.js-formValidator-input.js-saveProgress(name='body' rows=8 data-validate='required' required='true' placeholder="Today we released Sundae.js 2.0, which now has extra sprinkles, extra nuts, and now has three scoops of vanilla instead of two. If you can't eat dairy, you can now replace the ice cream with sherbert." data-saveprogress='news_description')
53+
textarea.form-input.form-textarea.js-autosize.js-counter.js-formValidator-input.js-saveProgress(name='body' rows=4 data-validate='required' required='true' placeholder="Today we released Sundae.js 2.0, which now has extra sprinkles, extra nuts, and now has three scoops of vanilla instead of two. If you can't eat dairy, you can now replace the ice cream with sherbert." data-saveprogress='news_description')
5454
=bodyValue
5555

5656
.split

views/news/show.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ block content
7676
img.thumb(src=user.avatar_url width=50)
7777
.bucket-content
7878
fieldset.form-field
79-
textarea.form-input.form-textatrea.js-formValidator-input.js-saveProgress(name='body' data-saveprogress='comment' data-validate='required' required='true')
79+
textarea.form-input.form-textatrea.js-autosize.js-formValidator-input.js-saveProgress(name='body' data-saveprogress='comment' data-validate='required' required='true')
8080

8181
input(type='hidden' name='_csrf' value=token)
8282
input.btn.btn--a.form-btn.js-formValidator-submit(type='submit' value='Submit')

0 commit comments

Comments
 (0)