Skip to content

Commit

Permalink
add updated example interface
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed May 7, 2017
1 parent 6dda36b commit 8b8b32e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ customs/extensions/*
!customs/extensions/_example/
customs/interfaces/*
!customs/interfaces/.gitignore
!customs/interfaces/_example
/customs/listviews/*
!customs/listviews/.gitignore
!storage/uploads/.gitignore
Expand Down
7 changes: 7 additions & 0 deletions customs/interfaces/_example/component.js
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
});
});
22 changes: 22 additions & 0 deletions customs/interfaces/_example/interface.js
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
}
}
});
});
2 changes: 2 additions & 0 deletions customs/interfaces/_example/templates/input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<textarea maxLength="{{maxLength}}"></textarea>
<span id="count">{{charactersRemaining}}</span>

0 comments on commit 8b8b32e

Please sign in to comment.