ReviewDialogHook¶
RB.ReviewDialogHook() is used to add additional fields or
information to the top of the review dialog (aroud the Ship It!
area). The hook is instantiated with a viewType option that expects a
custom Backbone.js view class, which is your custom view for modifying the
comment dialog.
The view should inherit from Backbone.View (or a subclass of this), and
its model will be set to the RB.Review() model being modified. The
view’s element will be added in-between the Ship It! checkbox and
the review body field.
The view should not modify other fields for the comment.
Example¶
var MyReviewDialogHookView = Backbone.View.extend({
    events: {
        'change input': '_onCheckboxToggled'
    },
    render: function() {
        this.extraData = this.model.get('extraData')['my-extension-id'];
        this.$input = $('<input type="checkbox"/>')
            .prop('checked', extraData.myBool)
            .appendTo(this.$el);
        return this;
    },
    _onCheckboxToggled: function() {
        this.extraData.myBool = this.$input.prop('checked');
    }
});
MyProject.Extension = RB.Extension.extend({
    initialize: function() {
        RB.Extension.initialize.call(this);
        new RB.ReviewDialogHook({
            extension: this,
            viewType: MyReviewDialogHookView
        });
    }
});
