Skip to content

Commit 5dffbe2

Browse files
committed
Merge pull request #219 from codeschool/resize_textareas
Resize textareas
2 parents ae300c3 + 8371722 commit 5dffbe2

File tree

8 files changed

+51
-13
lines changed

8 files changed

+51
-13
lines changed

bower.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@
1515
"tests"
1616
],
1717
"dependencies": {
18+
"abecedary": "~0.0.5",
1819
"angular": "1.4.0-beta.6",
19-
"jquery": "~2.1.3",
20-
"cs_console": "https://github.com/renz45/cs_console/archive/master.zip",
20+
"angular-animate": "1.4.0-beta.6",
21+
"angular-cookies": "1.4.0-beta.6",
22+
"angular-resource": "1.4.0-beta.6",
23+
"autosize": "~3.0.6",
24+
"bootstrap": "~3.3.4",
2125
"codemirror": "~3.16.0",
22-
"abecedary": "~0.0.5",
23-
"mocha": "~2.2.1",
26+
"cs_console": "https://github.com/renz45/cs_console/archive/master.zip",
27+
"jquery": "~2.1.3",
2428
"lodash": "~3.5.0",
25-
"angular-resource": "1.4.0-beta.6",
2629
"marked": "~0.3.3",
27-
"angular-animate": "1.4.0-beta.6",
28-
"angular-cookies": "1.4.0-beta.6",
29-
"bootstrap": "~3.3.4"
30+
"mocha": "~2.2.1"
3031
}
3132
}

client/javascripts/application.js

Lines changed: 5 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
// -------------------------------------
@@ -41,6 +44,7 @@ jQuery(function($) {
4144
new JS.Classes.Dispatcher({
4245
events: [
4346
{ page : 'course', run : function() { JS.Pages.Course(); } },
47+
{ page : 'feedback', run : function() { JS.Pages.Feedback(); } },
4448
{ page : 'home', run : function() { JS.Pages.Home(); } },
4549
{ match : 'news', run : function() { JS.Pages.News(); } },
4650
{ page : 'news:new', run : function() { JS.Pages.News.New(); } },
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// *************************************
2+
//
3+
// Feedback
4+
// -> Dispatch events
5+
//
6+
// *************************************
7+
8+
JS.Pages.Feedback = function() {
9+
10+
// -------------------------------------
11+
// Modules
12+
// -------------------------------------
13+
14+
JS.Modules.SaveProgress.init();
15+
16+
// -------------------------------------
17+
// Vendor
18+
// -------------------------------------
19+
20+
autosize($(JS.Globals.Vendor.autosizeQuery));
21+
22+
};

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
};

gulpfile.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ var options = {
5252
'client/javascripts/application.js',
5353
'client/javascripts/**/*.js'
5454
],
55-
vendorFiles: ['bower_components/jquery/dist/jquery.js', 'bower_components/bootstrap/js/tooltip.js'],
55+
vendorFiles: [
56+
'bower_components/jquery/dist/jquery.js',
57+
'bower_components/bootstrap/js/tooltip.js',
58+
'bower_components/autosize/dist/autosize.js'
59+
],
5660
vendorCourseFiles: [
5761
'bower_components/angular/angular.js',
5862
'bower_components/angular-resource/angular-resource.js',

views/feedback/index.jade

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ block current_nav
22
- current_page = 'Feedback'
33

44
block layout_variables
5+
- dispatcher = 'feedback'
56
- pageTitle = 'Feedback'
67

78
extends /views/layouts/layout
@@ -37,7 +38,7 @@ block content
3738

3839
fieldset.form-field
3940
label.form-label(for='comment' id='Field1') Give us your feedback to help us improve the site.
40-
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')
4142

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

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)