'Helper function to inject static JS and instantiate the
client-side widget
@param widget_id: the node ID where to instantiate the widget
@param options: dict of widget options (JSON-serializable)'

@staticmethod
def inject_js(widget_id, options):

    s3 = current.response.s3
    appname = current.request.application
    scripts = s3.scripts
    if s3.debug:
        script = ('/%s/static/scripts/S3/s3.ui.sitecheckin.js' % appname)
    else:
        script = ('/%s/static/scripts/S3/s3.ui.sitecheckin.min.js' % appname)
    scripts.append(script)
    scripts = s3.jquery_ready
    script = ("$('#%(id)s').siteCheckIn(%(options)s)" % {'id': widget_id, 'options': json.dumps(options)})
    if (script not in scripts):
        scripts.append(script)
