Skip to content

Instantly share code, notes, and snippets.

View erichocean's full-sized avatar

Erich Ocean erichocean

  • Xy Group Ltd
  • North Carolina
View GitHub Profile
//
// SCWindow.h
// StateCode
//
// Created by Erich Ocean on 8/13/08.
// Copyright 2008 Erich Atlas Ocean. All rights reserved.
//
@class SCLayerView, SCView, SCPage;
//
// SCView.h
// StateCode
//
// Created by Erich Ocean on 8/13/08.
// Copyright 2008 Erich Atlas Ocean. All rights reserved.
//
@interface SCView : NSResponder
{
//
// MainWindow.objc
// PhotoBooth
//
// Created by Erich Ocean on 9/8/08.
// Copyright 2008 Erich Atlas Ocean. All rights reserved.
//
sc_require( "PhotoBooth" );
//
// SCBinding.h
// StateCode
//
// Created by Erich Ocean on 9/7/08.
// Copyright 2008 Erich Atlas Ocean. All rights reserved.
//
@interface SCBinding : NSObject
{
greeting: SC.LabelView.extend({
valueBinding: "OI.userController.login",
localize: false,
escapeHTML: true
})
/**
Call by your subclass anytime you want the view to pick up the current
value from the form and post it out.
@param partialChange (optional) YES if this is a partial change.
@returns result of validation.
*/
fieldValueDidChange: function(partialChange) {
// get the field value and set it.
require('core');
// this code just copies in the requisite SC.ButtonView behavior to enable a standard image view to function as a button
MyApp.ImageButtonView = SC.ImageView.extend({
value: null, // could also use a CSS selector here -- see SC.ImageView
isEnabled: YES,
action: null,
target: null,
/**
Returns the name of this class. If the name is not known, triggers
a search. This can be expensive the first time it is called.
*/
objectClassName: function() {
if (!this._objectClassName) this._findObjectClassNames() ;
if (this._objectClassName) return this._objectClassName ;
var ret = this ;
while(ret && !ret._objectClassName) ret = ret._type;
return (ret && ret._objectClassName) ? ret._objectClassName : 'Anonymous' ;
# Returns the URL for the named resource
def static_url(resource_name, opts = {})
opts[:language] ||= language
entry = bundle.find_resource_entry(resource_name, opts)
entry.nil? ? '' : entry.cacheable_url
end
def find_resource_entry(filename, opts={}, seen=nil)
extname = File.extname(filename)
rootname = filename.gsub(/#{extname}$/,'')
entry_extname = entry_rootname = nil
ret = entries_for(:resource, opts.merge(:hidden => :none)).reject do |entry|
entry_extname = File.extname(entry.filename)
entry_rootname = entry.filename.gsub(/#{entry_extname}$/,'')
ext_match = (extname.nil? || extname.size == 0) || (entry_extname == extname)