summaryrefslogtreecommitdiff
path: root/src/templates/admin/plugins.html
diff options
context:
space:
mode:
authorEgil Moeller <egil.moller@freecode.no>2012-04-11 18:07:19 +0200
committerEgil Moeller <egil.moller@freecode.no>2012-04-17 22:40:46 +0200
commit6f774bc6a567211a8a7157458c249d89a145c3ab (patch)
treee873bc0e0c81bc5e2c38143d9d2e80a58c8bdf1c /src/templates/admin/plugins.html
parentf80f9fc59fa25406067756066e8a629ce060c025 (diff)
downloadetherpad-lite-6f774bc6a567211a8a7157458c249d89a145c3ab.zip
Separated out the code for the plugin manager
Diffstat (limited to 'src/templates/admin/plugins.html')
-rw-r--r--src/templates/admin/plugins.html90
1 files changed, 1 insertions, 89 deletions
diff --git a/src/templates/admin/plugins.html b/src/templates/admin/plugins.html
index 6f38d048..82bad555 100644
--- a/src/templates/admin/plugins.html
+++ b/src/templates/admin/plugins.html
@@ -4,95 +4,7 @@
<link href="../../static/css/admin.css" rel="stylesheet" type="text/css" />
<script src="../../static/js/jquery.js"></script>
<script src="../../socket.io/socket.io.js"></script>
- <script>
- $(document).ready(function () {
- var socket = io.connect().of("/pluginfw/installer");
-
- var doUpdate = false;
-
- function updateHandlers() {
- $("#progress.dialog .close").unbind('click').click(function () {
- $("#progress.dialog").hide();
- });
-
- $("#do-search").unbind('click').click(function () {
- if ($("#search-query")[0].value != "")
- socket.emit("search", $("#search-query")[0].value);
- });
-
- $(".do-install").unbind('click').click(function (e) {
- var row = $(e.target).closest("tr");
- doUpdate = true;
- socket.emit("install", row.find(".name").html());
- });
-
- $(".do-uninstall").unbind('click').click(function (e) {
- var row = $(e.target).closest("tr");
- doUpdate = true;
- socket.emit("uninstall", row.find(".name").html());
- });
- }
-
- updateHandlers();
-
- socket.on('progress', function (data) {
- $("#progress.dialog .close").hide();
- $("#progress.dialog").show();
- var message = "Unknown status";
- if (data.message) {
- message = "<span class='status'>" + data.message.toString() + "</span>";
- }
- if (data.error) {
- message = "<span class='error'>" + data.error.toString() + "<span>";
- }
- $("#progress.dialog .message").html(message);
- $("#progress.dialog .history").append("<div>" + message + "</div>");
-
- if (data.progress >= 1) {
- if (data.error) {
- $("#progress.dialog .close").show();
- } else {
- if (doUpdate) {
- doUpdate = false;
- socket.emit("load");
- }
- $("#progress.dialog").hide();
- }
- }
- });
-
- socket.on('search-result', function (data) {
- $("#search-results *").remove();
- for (plugin_name in data.results) {
- var plugin = data.results[plugin_name];
- var row = $("#search-result-template").clone();
-
- for (attr in plugin) {
- row.find("." + attr).html(plugin[attr]);
- }
- $("#search-results").append(row);
- }
- updateHandlers();
- });
-
- socket.on('installed-results', function (data) {
- $("#installed-plugins *").remove();
- for (plugin_name in data.results) {
- var plugin = data.results[plugin_name];
- var row = $("#installed-plugin-template").clone();
-
- for (attr in plugin.package) {
- row.find("." + attr).html(plugin.package[attr]);
- }
- $("#installed-plugins").append(row);
- }
- updateHandlers();
- });
-
- socket.emit("load");
-
- });
- </script>
+ <script src="../../static/js/admin/plugins.js"></script>
</head>
<body>
<div id="wrapper">