Adding the module.js route for each in the NodeView class.

This commit is contained in:
Ashesh Vashi
2015-07-30 16:17:13 +05:30
parent 7d9224ba8b
commit b0b964dd55
4 changed files with 77 additions and 36 deletions

View File

@@ -78,14 +78,6 @@ class ServerGroupPluginModule(BrowserPluginModule):
blueprint = ServerGroupModule( __name__, static_url_path='')
@blueprint.route('/module.js')
@login_required
def module():
return make_response(
render_template("server_groups/server_groups.js"),
200, {'Content-Type': 'application/x-javascript'})
# Initialise the module
from pgadmin.browser.utils import NodeView
@@ -234,5 +226,15 @@ class ServerGroupView(NodeView):
def dependents(self, gid):
return make_json_response(status=422)
def module_js(self, **kwargs):
"""
This property defines (if javascript) exists for this node.
Override this property for your own logic.
"""
return make_response(
render_template("server_groups/server_groups.js"),
200, {'Content-Type': 'application/x-javascript'}
)
ServerGroupView.register_node_view(blueprint)