---------- Forwarded message ---------- From: <[email protected]> Date: 2011/2/5 Subject: Generating gadgets.views.ViewType constants from config (issue4029058) To: [email protected] Cc: [email protected]
Reviewers: , Description: This patch adds new gadgets.views.ViewType constants automatically if you add the to your JavaScript config. See https://issues.apache.org/jira/browse/SHINDIG-1501 Please review this at http://codereview.appspot.com/4029058/ Affected files: features/src/main/javascript/features/views/views.js Index: features/src/main/javascript/features/views/views.js =================================================================== --- features/src/main/javascript/features/views/views.js (Revision 1063654) +++ features/src/main/javascript/features/views/views.js (Arbeitskopie) @@ -28,6 +28,11 @@ gadgets.views = function() { /** + * all view constants + */ + var _viewType = {}; + + /** * Reference to the current view object. */ var currentView = null; @@ -95,6 +100,8 @@ // TODO: Fix this by moving view names / config into a sub property. if (s != 'rewriteLinks') { var obj = conf[s]; + var constantName = s.toUpperCase(); + _viewType[constantName] = constantName; if (!obj) { continue; } @@ -317,7 +324,9 @@ */ getParams: function() { return params; - } + }, + + ViewType: _viewType }; }(); @@ -376,9 +385,3 @@ gadgets.views.View.prototype.isOnlyVisibleGadget = function() { return this.isOnlyVisible_; }; - -gadgets.views.ViewType = gadgets.util.makeEnum([ - 'CANVAS', 'HOME', 'PREVIEW', 'PROFILE', - // TODO Deprecate the following ViewTypes. - 'FULL_PAGE', 'DASHBOARD', 'POPUP' -]);
