Hi,

I have added a button to action bar but call back is not happening, i have 
followed the example, it throws an error saying RBCallback is not defined:

extension.py:-

from reviewboard.extensions.base import Extension, JSExtension
from reviewboard.extensions.hooks import (HeaderDropdownActionHook,
                                          ReviewRequestActionHook)
class actionJsExtention(JSExtension):
    model_class = 'RBCallback.Extension'

class navigationHook(Extension):

        # Single entry on review requests, consumed from JavaScript.
    def initialize(self):
        ReviewRequestActionHook(self, actions=[
            {
                'id': 'reject-id',
                'label': 'Reject',
                'url': '#',
            },
        ])


    js_extensions = [actionJsExtention]
    js_bundles = {
        'default': {
            'source_filenames': (
                'js/callback.js',
            )
        },
    }

callback.js:-

window.RBCallback = {};

(function() {
    console.log('In callback.js');
    RBCallback.Extension = RB.Extension.extend({

        initialize: function () {
            console.log('Initializing the extension');
            var _onRejectActionClicked;
            RB.Extension.initialize.call(this);

            _onRejectActionClicked = function(){
                if (confirm(gettext('Are you sure?'))) {
                    console.log('Click confirmed');
                }
                else {
                    console.log('Not confirmed');
                }
        };

            new RB.ReviewRequestActionHook({
                extension: this,
                callbacks: {
                    '#reject-id': _onRejectActionClicked,
                }
            });
        }
    });
})();

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to