public
Last active

SC custom test view

  • Download Gist
body.rhtml
RHTML
1 2
<%= view :test_view, :view => 'Admin.TestView',
:bind => {:value => 'Admin.masterController.test'} %>
test.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
// ==========================================================================
// 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?'),
 
}) ;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.