Hi Ayush, Can you confirm that the page is loading callback.js?
Can you make sure you don't have DEBUG = True set in your sitedir/conf/settings_local.py file? It will need to be False unless you're running a development server. Also, can you tell me more about your extension package setup? Are you building an egg or wheel package and then installing it, or using 'setup.py develop'? If building a package, can you inspect the contents (it's a zip file, effectively) and make sure callback.js is in there? Christian On Thu, Jun 22, 2017 at 00:14 Ayush Singhal <[email protected]> wrote: > 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. > -- -- Christian Hammond President/CEO of Beanbag Makers of Review Board -- 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.
