Created
August 29, 2008 02:30
-
-
Save ma11hew28/7883 to your computer and use it in GitHub Desktop.
SC custom test view
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
<%= view :test_view, :view => 'Admin.TestView', | |
:bind => {:value => 'Admin.masterController.test'} %> |
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
// ========================================================================== | |
// 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