Skip to content

Instantly share code, notes, and snippets.

class Profile < ActiveRecord::Base
has_many :profiles_users, :class_name => "ProfilesUsers"
has_many :users, :through => :profiles_users
has_many :admins,
:through => :profiles_users,
:source => :user,
:conditions => ["profiles_users.role = ?", "admin"]
has_many :editors,
:through => :profiles_users,
:source => :user,
/*
Password text fields
*/
NB.PasswordField = SC.TextField.extend({
template: SC.Handlebars.compile('<input type="password">')
});
/*
Text fields with variable type
NB.PasswordField = SC.TextField.extend({
template: SC.Handlebars.compile('<input type="password">')
});
NB.TextField = SC.TextField.extend({
type: 'text',
template: SC.Handlebars.compile('<input {{bindAttr type="type"}}>')
});
NB.SelectField = SC.TemplateCollectionView.extend({
itemView: SC.TemplateView.extend({
templateName: 'navigation',
submenu: SC.TemplateCollectionView.extend({
contentBinding: '.parentView.content.menuItems',
itemView: SC.TemplateView.extend({
hash: '#!/',
buttonPressed: function() {
// the view:
NB.NavigationMenuView = SC.TemplateCollectionView.extend({
layerId: 'navigation',
classNames: ['navigation', 'modules-list'],
contentBinding: 'NB.modulesController.content',
itemView: SC.TemplateView.extend({
templateName: 'navigation',
NB.NavigationMenuView = SC.TemplateCollectionView.extend({
layerId: 'navigation',
classNames: ['navigation', 'modules-list'],
contentBinding: 'NB.modulesController.content',
itemView: SC.TemplateView.extend({
templateName: 'navigation',
submenu: SC.TemplateCollectionView.extend({
classNames: ['test'],
Selectfield.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'wrapper'.w(),
wrapper: SC.View.design({
childViews: 'content'.w(),
content: SC.PanelPane.design({
layout: { width: 360, height: 160, centerX: 0, centerY: 0 },
rememberMeField: SC.View.design({
layout: { left: 17, right: 14, top: 76, height: 24 },
childViews: 'label sfield'.w(),
label: SC.LabelView.design({
layout: { left: 0, width: 107, height: 18, centerY: 0 },
value: '_RememberMe'.loc(),
textAlign: SC.ALIGN_RIGHT
}),
@elffey
elffey / controllers--menu.js
Created May 27, 2011 18:48
Simple navigation/routes/statechart
MyApp.menuController = SC.ArrayController.create({
allowsEmptySelection: NO,
allowsMultipleSelection: NO,
content: [
SC.Object.create({
name: 'Dashboard',
route: 'dashboard',