From 438342e4269752c2b6e1cddee055ce476f11d28f Mon Sep 17 00:00:00 2001 From: Dallon Feldner Date: Wed, 21 Nov 2012 09:31:00 -0700 Subject: [PATCH] Renamed "events" array to "eventNames" --- HISTORY.md | 1 + lib/resource.js | 2 +- lib/resources/collection/index.js | 2 +- lib/resources/dashboard.js | 2 +- lib/resources/internal-resources.js | 2 +- lib/resources/user-collection.js | 1 - 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 460ae04..cd8fbd6 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -13,6 +13,7 @@ ### Breaking Changes - All configuration properties on the `Resource` class have been moved to the prototype: `external`, `events`, `label`, `defaultPath`, `basicDashboard`, and `dashboard`. +- The configuration option `Resource.events` has been renamed `Resource.eventNames`. ### Major Bugfixes \ No newline at end of file diff --git a/lib/resource.js b/lib/resource.js index acca75c..57762bd 100644 --- a/lib/resource.js +++ b/lib/resource.js @@ -110,7 +110,7 @@ Resource.prototype.parse = function (url) { Resource.prototype.load = function (fn) { var resource = this - , eventNames = this.constructor && this.constructor.events + , eventNames = this.eventNames , remaining = eventNames && eventNames.length , configPath = this.options && this.options.configPath , events = this.events = {}; diff --git a/lib/resources/collection/index.js b/lib/resources/collection/index.js index d154237..3d76315 100644 --- a/lib/resources/collection/index.js +++ b/lib/resources/collection/index.js @@ -35,7 +35,7 @@ util.inherits(Collection, Resource); Collection.prototype.external = {}; Collection.prototype.clientGeneration = true; -Collection.events = ['Get', 'Validate', 'Post', 'Put', 'Delete']; +Collection.prototype.eventNames = ['Get', 'Validate', 'Post', 'Put', 'Delete']; Collection.dashboard = { path: path.join(__dirname, 'dashboard') , pages: ['Properties', 'Data', 'Events', 'API'] diff --git a/lib/resources/dashboard.js b/lib/resources/dashboard.js index 7a5c7cb..8d37c96 100644 --- a/lib/resources/dashboard.js +++ b/lib/resources/dashboard.js @@ -134,7 +134,7 @@ Dashboard.prototype.loadPage = function(ctx, fn) { options.resourceId = resourceId; resourceType = resource.constructor; options.resourceType = resourceType.id; - options.events = resourceType.events; + options.events = resource.eventNames; options.scripts = []; var page = parts[1]; diff --git a/lib/resources/internal-resources.js b/lib/resources/internal-resources.js index e39402d..477d7d9 100644 --- a/lib/resources/internal-resources.js +++ b/lib/resources/internal-resources.js @@ -66,7 +66,7 @@ InternalResources.prototype.handle = function(ctx, next) { var c = types[key] , pages = c.dashboard && c.dashboard.pages; - if (!pages && c.events) { + if (!pages && c.eventNames) { pages = ['Config', 'Events']; } result[key] = { diff --git a/lib/resources/user-collection.js b/lib/resources/user-collection.js index e14360b..b3adac8 100644 --- a/lib/resources/user-collection.js +++ b/lib/resources/user-collection.js @@ -38,7 +38,6 @@ function UserCollection(name, options) { util.inherits(UserCollection, Collection); UserCollection.dashboard = Collection.dashboard; -UserCollection.events = Collection.events; /** * Handle an incoming http `req` and `res` and execute