Permalink
Browse files

Fixing services.html page

  • Loading branch information...
1 parent 143560a commit 54e2592fca0b1e46270b449a2305a854d5bed448 @mmaker committed Aug 7, 2012
Showing with 23 additions and 13 deletions.
  1. +4 −3 apaf/panel/controllers.py
  2. +8 −0 apaf/panel/handlers.py
  3. +1 −2 apaf/panel/panel.py
  4. +10 −8 datadir/services/panel/templates/services.html
@@ -56,7 +56,7 @@ def set(self, args):
class ServicesCtl(object):
- keys = ['name', 'desc', 'url']
+ keys = ['name', 'desc', 'url', 'active']
@property
def services(self):
@@ -73,10 +73,11 @@ def _get_service(self, name):
else:
return self.services[name]
- def get(self, service):
+ def get(self, service, _base=True):
if not service:
- return self.services.keys()
+ return [self.get(service) for service in self.services.keys()]
else:
+ service = self._get_service(service)
return dict((name, getattr(service, name, None)) for name in self.keys)
def set(self, service, state):
View
@@ -301,3 +301,11 @@ def get(self):
key, value in self.controller.get().iteritems())
)
+class ServicesHtmlHandler(web.RequestHandler):
+ controller = controllers.ServicesCtl()
+
+ def get(self):
+ service = self.get_argument('service', None)
+ print self.controller.get(service)
+ return self.render('services.html' if not service else 'serviceinfo.html',
+ services=self.controller.get(service))
View
@@ -47,8 +47,7 @@ class PanelService(Service):
# Legacy html
(r'/index.html', handlers.render('index.html')),
- (r'/services.html',
- handlers.render('services.html', services=apaf.hiddenservices)),
+ (r'/services.html', handlers.ServicesHtmlHandler),
(r'/tor.html', handlers.render('tor.html')),
(r'/config.html', handlers.ConfigHtmlHandler),
(r'/about.html', handlers.render('about.html')),
@@ -1,10 +1,11 @@
{% extends "base.html" %}
{% block title %}
-APAF - Services Page
+Services Page
{% end %}
{% block body %}
+
<div class="container">
<h1>Services Page</h1>
<hr />
@@ -20,20 +21,21 @@
</tr>
{% for i, service in enumerate(services) %}
<tr>
- <td> {{ i }} </td>
- <td> {{ service.name }} </td>
- <td> {{ service.desc }} </td>
- <td> {{ service.url }} </td>
- <td> {{ service.active }} </td>
- </tr>
+ <td> {{ i }} </td>
+ <td><a href="/services.html?service={{ escape(service['name']) }}">
+ {{ escape(service['name']) }}
+ </a> </td>
+ <td> {{ escape(service['desc']) }} </td>
+ <td> {{ escape(service['url']) }} </td>
+ <td> {{ str(service['active']) }} </td>
+ </tr> </a>
{% end %}
</table>
<hr>
</div> <!-- /container -->
{% end %}
-
<!--
<script>
$(document).ready(function() {

0 comments on commit 54e2592

Please sign in to comment.