Sha256: c9c70d169030e5230c8023b639b0fda6c4c09ee83e65c2926d18cdc0e46b70a4

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

// ==========================================================================
// Project:   Greenhouse.File
// Copyright: ©2009 My Company, Inc.
// ==========================================================================
/*jslint evil: true*/
/*globals Greenhouse*/

require('core');
/** @class

  file properties
  @dir
  @name
  
  @extends SC.ChildRecord
  @version 0.1
*/
Greenhouse.File = SC.ChildRecord.extend(
/** @scope Greenhouse.File.prototype */ {
  type: 'File',
  childRecordNamespace: 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);
Greenhouse.File.mixin({

});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sproutcore-1.4.0.rc.5 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.4.0.rc.4 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.4.0.rc.3 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.4.0.rc.2 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.4.0.rc lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.0.1049.pre.2 lib/frameworks/sproutcore/apps/greenhouse/models/file.js
sproutcore-1.0.1049.pre.1 frameworks/sproutcore/apps/greenhouse/models/file.js