~rharding/juju-gui/renderBundle2

« back to all changes in this revision

Viewing changes to app/widgets/viewmode-controls.js

  • Committer: Jeff Pihach
  • Date: 2013-08-16 20:16:31 UTC
  • mto: This revision was merged to the branch mainline in revision 963.
  • Revision ID: jeff.pihach@canonical.com-20130816201631-201a4u7qfec333c9
upgraded jshint to current version

Show diffs side-by-side

added added

removed removed

Lines of Context:
189
189
    }
190
190
  });
191
191
 
192
 
  /**
193
 
   * Extension for views to provide viewmode controls.
194
 
   *
195
 
   * @class viewmodeControllingView
196
 
   */
197
 
  ns.ViewmodeControlsViewExtension = function() {};
198
 
  ns.ViewmodeControlsViewExtension.prototype = {
199
 
    /**
200
 
     * Binds the viewmode controls on the page to the viewmode change events.
201
 
     *
202
 
     * @method _bindViewmodeControls
203
 
     * @param {Y.Widget} controls The viewmode control widget.
204
 
     */
205
 
    _bindViewmodeControls: function(controls) {
206
 
      this._fullscreen = controls.on(
207
 
          controls.EVT_FULLSCREEN, this._goFullscreen, this);
208
 
      this._sidebar = controls.on(
209
 
          controls.EVT_SIDEBAR, this._goSidebar, this);
210
 
      this._minimized = controls.on(
211
 
          controls.EVT_TOGGLE_VIEWABLE, this._toggleMinimized, this);
212
 
      this._destroy = this.on('destroy', function() {
213
 
        this._fullscreen.detach();
214
 
        this._sidebar.detach();
215
 
        this._minimized.detach();
216
 
        this._destroy.detach();
217
 
      });
218
 
    },
219
 
 
220
 
    /**
221
 
      Upon clicking the browser icon make sure we re-route to the
222
 
      new form of the UX.
223
 
 
224
 
      @method _goFullscreen
225
 
      @param {Event} ev the click event handler on the button.
226
 
 
227
 
     */
228
 
    _goFullscreen: function(ev) {
229
 
      ev.halt();
230
 
      this.fire('viewNavigate', {
231
 
        change: {
232
 
          viewmode: 'fullscreen'
233
 
        }
234
 
      });
235
 
    },
236
 
 
237
 
    /**
238
 
      Upon clicking the build icon make sure we re-route to the
239
 
      new form of the UX.
240
 
 
241
 
      @method _goSidebar
242
 
      @param {Event} ev the click event handler on the button.
243
 
 
244
 
     */
245
 
    _goSidebar: function(ev) {
246
 
      ev.halt();
247
 
      this.fire('viewNavigate', {
248
 
        change: {
249
 
          viewmode: 'sidebar'
250
 
        }
251
 
      });
252
 
    },
253
 
 
254
 
    /**
255
 
     * Place holder to toggle the minimized view; in minimized this should show
256
 
     * sidebar, in sidebar this should show minimized.
257
 
     * @method _toggleMinimized
258
 
     * @param {Event} ev event to trigger the toggle.
259
 
     *
260
 
     */
261
 
    _toggleMinimized: function(ev) {}
262
 
  };
263
 
 
264
192
}, '0.1.0', {
265
193
  requires: [
266
194
    'base',