Sha256: b72384e925e929a6cf925d5df5cf3d959d1a3b507e659e97c921cc87118bb7a6

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

// ==========================================================================
// Project:   Greenhouse.File
// Copyright: ©2010 Mike Ball
// ==========================================================================
/*jslint evil: true*/
/*globals Greenhouse*/

sc_require('core');
/**

  file properties
  @property dir
  @property name

  @extends SC.ChildRecord
  @version 0.1
*/
Greenhouse.File = SC.Record.extend(
/** @scope Greenhouse.File.prototype */ {
  type: 'File',
  nestedRecordNamespace: Greenhouse,
  name: SC.Record.attr(String),
  dir: SC.Record.attr(String),
  body: SC.Record.attr(String),
  primaryKey: 'id',

  isFile: YES,

  path: function(){
    return this.get('dir') + this.get('name');
  }.property('name', 'dir').cacheable(),

  pageRegex: function(){
    var b = this.get('body'), re =/(\w+)\.(\w+)\s*=\s*SC\.Page\.(design|create)/;
    return b ? b.match(re): b;
  }.property('body').cacheable(),

  isPage: function(){
    return this.get('pageRegex') !== null;
  }.property('pageRegex').cacheable(),

  pageName: function(){
    var r = this.get('pageRegex') || [];
    return "%@.%@".fmt(r[1],r[2]);
  }.property('pageRegex').cacheable()

}) ;

Greenhouse.FILES_QUERY = SC.Query.remote(Greenhouse.File);

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.10.2 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.10.1 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.10.0 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/apps/greenhouse/models/file.js