Skip to content

Instantly share code, notes, and snippets.

@topherfangio
Created June 5, 2014 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topherfangio/5919b2311a5311a3e343 to your computer and use it in GitHub Desktop.
Save topherfangio/5919b2311a5311a3e343 to your computer and use it in GitHub Desktop.
Double Autocomplete view with new BT
/* begin of file /Users/topher/Documents/Development/profoundry/colla/frameworks/scui2/views/autocomplete.js */
SC.AutocompleteInputView = SC.TextFieldView.extend({
layout: { width: 200, height: 24 },
hint: 'Type here...',
valueBinding: 'Craft.testController.someValue',
isEditable: YES,
beginEditing: function() {
return YES;
}
});
SC.AutocompleteSelectionView = SC.View.extend(SC.AutoResize, {
supportsAutoResize: YES,
canEditContent: YES,
layout: { width: 50, height: 24 },
autoResizeLayer: function() {
return this.get('layer');
}.property('layer'),
autoResizeText: " *** woot",
render: function(context) {
context.push(' *** woot');
}
});
SC.AutocompleteView = SC.CollectionView.extend(SC.FlowedLayout, {
defaultFlowSpacing: { left: 10, right: 10, top: 10, bottom: 10 }
});
/* end of file /Users/topher/Documents/Development/profoundry/colla/frameworks/scui2/views/autocomplete.js */
/* begin of file /Users/topher/Documents/Development/profoundry/scui2/views/autocomplete.js */
SC.AutocompleteInputView = SC.TextFieldView.extend({
layout: { width: 200, height: 24 },
hint: 'Type here...',
valueBinding: 'Craft.testController.someValue',
isEditable: YES,
beginEditing: function() {
return YES;
}
});
SC.AutocompleteSelectionView = SC.View.extend(SC.AutoResize, {
supportsAutoResize: YES,
canEditContent: YES,
layout: { width: 50, height: 24 },
autoResizeLayer: function() {
return this.get('layer');
}.property('layer'),
autoResizeText: " *** woot",
render: function(context) {
context.push(' *** woot');
}
});
SC.AutocompleteView = SC.StackedView.extend(SC.FlowedLayout, {
defaultFlowSpacing: { left: 10, right: 10, top: 10, bottom: 10 }
});
/* end of file /Users/topher/Documents/Development/profoundry/scui2/views/autocomplete.js */
/* begin of file /Users/topher/Documents/Development/profoundry/scui2/views/autocomplete.js */
SC.AutocompleteInputView = SC.TextFieldView.extend({
layout: { width: 200, height: 24 },
hint: 'Type here...',
valueBinding: 'Craft.testController.someValue',
isEditable: YES,
beginEditing: function() {
return YES;
}
});
SC.AutocompleteSelectionView = SC.View.extend(SC.AutoResize, {
supportsAutoResize: YES,
canEditContent: YES,
layout: { width: 50, height: 24 },
autoResizeLayer: function() {
return this.get('layer');
}.property('layer'),
autoResizeText: " *** woot",
render: function(context) {
context.push(' *** woot');
}
});
SC.AutocompleteView = SC.View.extend(SC.FlowedLayout, {
defaultFlowSpacing: { left: 10, right: 10, top: 10, bottom: 10 },
contentDidChange: function() {
var content = this.get('content'),
childViews = [];
if (content) {
content.forEach(function(c) {
childViews = this.appendChild(this.createChildView(SC.getPath(c.get(c.get('contentExampleViewKey')))));
});
}
this.set('childViews', childViews);
}.observes('content')
});
/* end of file /Users/topher/Documents/Development/profoundry/scui2/views/autocomplete.js */
/* begin of file /Users/topher/Documents/Development/profoundry/scui2/views/autocomplete.js */
SC.AutocompleteInputView = SC.TextFieldView.extend({
layout: { width: 200, height: 24 },
hint: 'Type here...',
valueBinding: 'Craft.testController.someValue',
isEditable: YES,
beginEditing: function() {
return YES;
}
});
SC.AutocompleteSelectionView = SC.View.extend(SC.AutoResize, {
supportsAutoResize: YES,
canEditContent: YES,
layout: { width: 50, height: 24 },
autoResizeLayer: function() {
return this.get('layer');
}.property('layer'),
autoResizeText: " *** woot",
render: function(context) {
context.push(' *** woot');
}
});
SC.AutocompleteView = SC.View.extend(SC.FlowedLayout, {
defaultFlowSpacing: { left: 10, right: 10, top: 10, bottom: 10 },
contentDidChange: function() {
var content = this.get('content'),
childViews = [];
if (content) {
content.forEach(function(c) {
console.log(' *** adding child view...');
childViews = this.appendChild(this.createChildView(SC.getPath(c.get(c.get('contentExampleViewKey')))));
});
}
this.set('childViews', childViews);
}.observes('content')
});
/* end of file /Users/topher/Documents/Development/profoundry/scui2/views/autocomplete.js */
/* begin of file /Users/topher/Documents/Development/profoundry/scui2/views/autocomplete.js */
SC.AutocompleteInputView = SC.TextFieldView.extend({
layout: { width: 200, height: 24 },
hint: 'Type here...',
valueBinding: 'Craft.testController.someValue',
isEditable: YES,
beginEditing: function() {
return YES;
}
});
SC.AutocompleteSelectionView = SC.View.extend(SC.AutoResize, {
supportsAutoResize: YES,
canEditContent: YES,
layout: { width: 50, height: 24 },
autoResizeLayer: function() {
return this.get('layer');
}.property('layer'),
autoResizeText: " *** woot",
render: function(context) {
context.push(' *** woot');
}
});
SC.AutocompleteView = SC.View.extend(SC.FlowedLayout, {
defaultFlowSpacing: { left: 10, right: 10, top: 10, bottom: 10 },
contentDidChange: function() {
console.log(' *** conentDidChange');
var content = this.get('content'),
childViews = [];
if (content) {
content.forEach(function(c) {
console.log(' *** adding child view...');
childViews = this.appendChild(this.createChildView(SC.getPath(c.get(c.get('contentExampleViewKey')))));
});
}
this.set('childViews', childViews);
}.observes('content')
});
/* end of file /Users/topher/Documents/Development/profoundry/scui2/views/autocomplete.js */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment