Fix title underline error in faq.rst
[ganeti_webmgr.git] / muddle / templates / plugins.html
blob974fc6017aeb83722c49771171197ff8f77f8634
1 {% extends "base.html" %}
3 {% load maintain_extras %}
5 {% block head %}
6 {{ block.super }}
7 <link rel="stylesheet" type="text/css" href="../static/css/plugins.css" />
8 <script type="text/javascript">
9 var $errors = undefined;
10 $(document).ready(function() {
11 $('#plugins li.disabled input').live('click', function(){
12 $(this).attr('checked',false);
13 if(!lock){return;}
14 $errors.empty().hide();
15 $('#enable h2 .plugin').html(this.parentNode.id);
16 $('#enable .description').html(this.parentNode.title);
17 $.getJSON('{{ROOT}}/plugin/depends', {'name':this.parentNode.id}, process_depends);
18 });
20 $('#plugins li.enabled input').live('click', function(){
21 $(this).attr('checked',true);
22 if(!lock){return;}
23 $('#disable h2 .plugin').html(this.parentNode.id);
24 $('#disable .description').html(this.parentNode.title);
25 $errors.empty().hide();
26 $.getJSON('{{ROOT}}/plugin/dependeds', {'name':this.parentNode.id}, process_dependeds);
27 });
29 $('#enable button').click(function(){
30 if(lock){
31 name = $('#enable h2 .plugin').html();
32 $.getJSON('{{ROOT}}/plugin/enable', {'name':name}, process_enabled);
34 $('#enable').hide();
35 });
37 $('#disable button').click(function(){
38 if (lock){
39 name = $('#disable h2 .plugin').html();
40 $.getJSON('{{ROOT}}/plugin/disable', {'name':name}, process_disabled);
42 $('#disable').hide();
43 });
45 $('#disable .button_close, #enable .button_close').click(function(){
46 $('#enable, #disable').hide();
47 });
49 $('html').keypress(function(e){
50 if (e.which == 0) {
51 $('#enable, #disable').hide();
53 });
55 $errors = $('#errors');
56 refresh_lock();
57 });
59 function process_depends(data){
61 processes a list of depends for a plugin prior to displaying
62 a enable form.
64 if (data.length == 2 && data[0] == -1) {
65 // errors
66 $errors.append(data[1]).show();
67 return;
69 if (data.length == 0) {
70 $('#enable .messages').hide();
71 } else {
72 $('#enable .messages').show();
73 $list = $('#enable .messages ul')
74 $list.empty();
75 for (i in data){
76 plugin = data[i];
77 $list.append('<li>'+plugin['name']+'</li>')
80 $('#enable').show().find('button').focus();
83 function process_enabled(data){
85 processes a response from attempting to enable a plugin. This
86 will either update the interface on a success or display a list
87 of errors
89 if (data.length == 2 && data[0] == -1){
90 errors = data[1];
91 for (i in errors) {
92 $errors.append("<li>"+errors[i]+"</li>");
94 $errors.show();
95 } else {
96 for (i in data){
97 plugin = data[i];
98 $('#'+plugin)
99 .removeClass('disabled')
100 .addClass('enabled')
101 .children('input').attr('checked',true);
106 function process_dependeds(data){
108 processes a list of dependeds for a plugin prior to displaying
109 a disable form.
111 if (data.length == 0) {
112 $('#disable .messages').hide();
113 } else {
114 $('#disable .messages').show();
115 $list = $('#disable .messages ul')
116 $list.empty();
117 for (i in data){
118 plugin = data[i];
119 $list.append('<li>'+plugin['name']+'</li>')
122 $('#disable').show().find('button').focus();
125 function process_disabled(data){
127 processes a response from attempting to disable a plugin.
129 if (data != -1){
130 for (i in data){
131 plugin = data[i];
132 $('#'+plugin)
133 .removeClass('enabled')
134 .addClass('disabled')
135 .children('input').attr('checked',false);
141 {% include "../static/js/config_lock.js" %}
143 </script>
144 {% endblock %}
146 {% block content %}
147 <ul id="errors"></ul>
148 <h1>Plugins</h1>
149 <ul id="plugins">
150 {% for plugin in plugins %}
151 {% with plugin|config as config %}
152 <li id="{{config.name}}" title="{{plugin.description}}" class="{%if config.enabled%}enabled{%else%}disabled{%endif%}">
153 {{config.name}}
154 <input type="checkbox"
155 {%if config.enabled%}checked{%endif%}
156 {%if plugin.core %}disabled{%endif%}
158 {% if plugin.config_form %}
159 <a class="button_config button" href="{{ROOT}}/plugin/{{config.name}}/"></a>
160 {% endif %}
161 </li>
162 {% endwith %}
163 {% endfor %}
164 </ul>
166 <div id="enable" class="form">
167 <div class="inner">
168 <div class="button_close button"></div>
169 <h2><span class="label">Enable:</span> <span class="plugin"></span></h2>
170 <div class="description"></div>
171 <div class="messages">
172 The following dependencies will also be enabled:
173 <ul></ul>
174 </div>
175 <button class="button_enable">Enable</button>
176 </div>
177 </div>
179 <div id="disable" class="form">
180 <div class="inner">
181 <div class="button_close button"></div>
182 <h2><span class="label">Disable:</span> <span class="plugin"></span></h2>
183 <div class="description"></div>
184 <div class="messages">
185 The following plugins depend on this plugin:
186 <ul</ul>
187 </div>
188 <button class="button_disable">Disable</button>
189 </div>
190 </div>
191 {% endblock %}