forked from directus/v8-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dda36b
commit 8b8b32e
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
define(['core/UIComponent', './interface'], function (UIComponent, Input) { | ||
return UIComponent.extend({ | ||
id: 'exampletextlimit', | ||
dataTypes: ['TEXT'], | ||
Input: Input | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
define(['core/CustomUIView'], function (UIView) { | ||
|
||
var charactersLimit = 100; | ||
|
||
return UIView.extend({ | ||
template: 'example/templates/input', | ||
events: { | ||
'keyup textarea': 'updateCount' | ||
}, | ||
updateCount: function(event) { | ||
var textLength = event.currentTarget.value.length; | ||
var textRemaining = charactersLimit - textLength; | ||
this.$el.find('#count').text(textRemaining); | ||
}, | ||
serialize: function() { | ||
return { | ||
maxLength: charactersLimit, | ||
charactersRemaining: charactersLimit | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<textarea maxLength="{{maxLength}}"></textarea> | ||
<span id="count">{{charactersRemaining}}</span> |