Skip to content

Instantly share code, notes, and snippets.

View topherfangio's full-sized avatar

Topher Fangio topherfangio

View GitHub Profile
@topherfangio
topherfangio / app.js
Created August 26, 2011 15:30
Handlebars Text Binding
var App = SC.Application.create();
App.myVar = 'test';
App.BasicTextView = SC.View.extend({
textValue: null,
textValueDidChange: function() {
var jQuery = this.$();
@topherfangio
topherfangio / example.handlebars
Created August 25, 2011 21:11
Quick example of how to use SC.TemplateCollection ItemViews
{{#collection MyApp.ExampleCollectionView contentBinding="MyApp.myController.content"}}
{{view MyApp.MyButton class='mini right'}}
{{/collection}}
<body>
<script src="assets/bpm_libs.js" type="text/javascript"></script>
<script type="text/javascript">
spade.require('Planitly');
</script>
<script type="text/x-handlebars">
<div class='container_16'>
{
"name": "planitly",
"version": "0.0.1",
"bpm": "1.0.0",
"description": "DESCRIPTION HERE",
"author": "YOUR NAME HERE",
"homepage": "URL",
"directories": {
"lib": "./lib",
"tests": "./tests"
@topherfangio
topherfangio / example.js
Created July 19, 2011 07:38
Example of a computed property using @each
MyApp.Project = SC.Record.create({
tasks: SC.Record.toMany(...),
tasksNeedUpdate: 0,
tasksDidUpdate: function() {
this.set('tasksNeedUpate', this.get('tasksNeedUpdate') + 1);
}.observes('*tasks.@each.isComplete'),
allTasksCompleted: function() {
@topherfangio
topherfangio / example.js
Created July 16, 2011 15:12
Eample of SC SelectAll
selectAllClicked: function(evt) {
/*
* Go ahead and deselect all objects first so that we don't confuse the user
*/
Pharos360.studentsController.selectObject();
/*
* Now, select only those students that aren't currently selected
*/
var students = Pharos360.filteredStudentsController.get('arrangedObjects');
@topherfangio
topherfangio / popup_example.js
Created June 17, 2011 16:01
Example of a popup using the popover theme
MyApp.myPopoverView = SC.PickerPane.create({
layout: { width: 300, height: 150 },
themeName: 'popover',
contentView: SC.WorkspaceView.extend({
topToolbar: null,
bottomToolbar: null,
contentView: SC.View.extend({
@topherfangio
topherfangio / main_page.js
Created June 16, 2011 16:07
Basic SC Bindings Example
...
editingPane: MyApp.editingPane.extend({}),
...
class AuditsController < ApiController
def index
@audits = current_member.audit_responses.where('updated_at IS NULL').map{ |ar| ar.audit.attributes }.uniq
respond_with @audits
end
@topherfangio
topherfangio / rental_units_list.js
Created May 10, 2011 17:07
Basic List/Example Views
ScHerestay.RentalUnitsIndex = SC.View.extend(SC.Control, {
childViews: 'list'.w(),
list: SC.ScrollView.design({
layout: {top: 10, left: 2, right: 2, buttom: 5},
contentView: SC.ListView.design({
layout: {top: 0, bottom: 0, left: 0, right: 0},
contentBinding: 'ScHerestay.rentalUnitsController.content',
exampleView: ScHerestay.UnitRow,