Skip to content

Instantly share code, notes, and snippets.

@ma11hew28
Created August 29, 2008 02:30
Show Gist options
  • Save ma11hew28/7883 to your computer and use it in GitHub Desktop.
Save ma11hew28/7883 to your computer and use it in GitHub Desktop.
SC custom test view
<%= view :test_view, :view => 'Admin.TestView',
:bind => {:value => 'Admin.masterController.test'} %>
// ==========================================================================
// Admin.TestView
// ==========================================================================
require('core');
require('views/label');
require('views/view');
require('mixins/delegate_support');
/** @class
(Document Your View Here)
@extends SC.View
@author AuthorName
@version 0.1
*/
Admin.TestView = SC.View.extend(SC.DelegateSupport,
/** @scope Admin.TestView.prototype */ {
emptyElement: '<span class="cell-label"></span>',
value: 'work please',
render: function() {
var html = [];
var value = this.get('value');
var cellLabel = this.outlet('cellLabel');
cellLabel.set('value', value);
// the newlines and spaces are for well formatted html
html.push('<span class="cell-label"></span>');
// Finally set the innerHTML of the view
html = html.join('');
this.set('innerHTML', html);
}.observes('value'),
/** @private */
cellLabel: SC.LabelView.extend({
isEditable: YES,
}).outletFor('.cell-label?'),
}) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment