oauth.js 823 B

12345678910111213141516171819202122232425262728293031323334
  1. define( [ 'models/oauthModel' ], function( OAuthModel ) {
  2. var view = Marionette.View.extend( {
  3. model: new OAuthModel(),
  4. template: '#tmpl-nf-notices-oauth',
  5. className: 'nf-notices--oauth',
  6. ui: {
  7. disconnect: '.js--disconnect',
  8. },
  9. /*
  10. * Update when the OAuth controller is synced.
  11. */
  12. initialize: function( oauthModel ) {
  13. this.listenTo( nfRadio.channel( 'dashboard' ), 'fetch:oauth', this.updateModel );
  14. },
  15. updateModel: function() {
  16. this.model = nfRadio.channel( 'dashboard' ).request( 'get:oauth' );
  17. this.render();
  18. },
  19. events: {
  20. 'click @ui.disconnect': function() {
  21. nfRadio.channel( 'dashboard' ).request( 'disconnect:oauth' );
  22. },
  23. }
  24. } );
  25. return view;
  26. } );