1 // ==========================================================================
  2 // Project:   SproutCore - JavaScript Application Framework
  3 // Copyright: ©2006-2011 Strobe Inc. and contributors.
  4 //            Portions ©2008-2011 Apple Inc. All rights reserved.
  5 // License:   Licensed under MIT license (see license.js)
  6 // ==========================================================================
  7 // ==========================================================================
  8 // Project:   SC.designController
  9 // ==========================================================================
 10 /*globals SC */
 11 
 12 /**
 13 
 14   (Document Your Controller Here)
 15 
 16   @extends SC.Object
 17 */
 18 SC.designController = SC.ObjectController.create(
 19 /** @scope SC.designController.prototype */ {
 20 
 21   contentBinding: 'SC.designsController.selection',
 22   contentBindingDefault: SC.Binding.single(),
 23 
 24   viewSelected: function(){
 25     var c = this.get('content'), pane, designer, pageController;
 26     if(c){
 27       pane = c.get('view');
 28       if(pane.kindOf && pane.kindOf(SC.View)){
 29         pageController = SC.designsController.getPath('page.designController');
 30         designer = pane.get('designer');
 31         //make this designer the rootDesigner
 32         if(pageController && designer) {
 33           designer.set('designIsEnabled', NO);
 34           pageController.makeRootDesigner(designer);
 35         }
 36       }
 37       else if(SC._Greenhouse){
 38         SC._Greenhouse.designController.set('content', pane.get('designer'));
 39         SC._Greenhouse.sendAction('floatInspector');
 40       }
 41     }
 42   }
 43 }) ;
 44