summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-02-11 17:36:37 +0100
committerSimo Sorce <simo@redhat.com>2014-02-17 11:53:15 -0500
commitd64cd70ae413f5a936806a182e4377a887d4d782 (patch)
tree4dc8161092c470ec30a4a8d5d053e5bb62c3f5c1
parent6e7edfd368105341aa852620c2d2b1c7e842ad25 (diff)
downloadipsilon-d64cd70ae413f5a936806a182e4377a887d4d782.tar.gz
ipsilon-d64cd70ae413f5a936806a182e4377a887d4d782.tar.xz
ipsilon-d64cd70ae413f5a936806a182e4377a887d4d782.zip
Apply patternfly to administration pages
Signed-off-by: Petr Vobornik <pvoborni@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
-rwxr-xr-xipsilon/admin/common.py4
-rw-r--r--templates/admin/index.html58
-rw-r--r--templates/admin/login_plugin.html64
-rw-r--r--templates/master-admin.html62
4 files changed, 110 insertions, 78 deletions
diff --git a/ipsilon/admin/common.py b/ipsilon/admin/common.py
index 7620d3f..6e36669 100755
--- a/ipsilon/admin/common.py
+++ b/ipsilon/admin/common.py
@@ -63,6 +63,7 @@ class LoginPluginPage(Page):
def POST(self, *args, **kwargs):
message = "Nothing was modified."
+ message_type = "info"
new_values = dict()
for key, value in kwargs.iteritems():
@@ -79,8 +80,10 @@ class LoginPluginPage(Page):
store.save_plugin_config(LOGIN_FACILITY,
self._obj.name, new_values)
message = "New configuration saved."
+ message_type = "success"
except Exception: # pylint: disable=broad-except
message = "Failed to save data!"
+ message_type = "error"
# And only if it succeeds we change the live object
for name, value in new_values.items():
@@ -89,6 +92,7 @@ class LoginPluginPage(Page):
return self._template('admin/login_plugin.html',
message=message,
+ message_type=message_type,
title='%s plugin' % self._obj.name,
name='admin_login_%s_form' % self._obj.name,
action=self.url,
diff --git a/templates/admin/index.html b/templates/admin/index.html
index 5af8497..c22d249 100644
--- a/templates/admin/index.html
+++ b/templates/admin/index.html
@@ -1,41 +1,23 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="UTF-8"></meta>
- <title>{{ title }}</title>
- <link href="{{ basepath }}/ui/ipsilon.css" type="text/css" rel="stylesheet"></link>
- <link href="{{ basepath }}/ui/favicon.ico" type="image/ico" rel="icon"></link>
-</head>
-<body>
- <div id="container">
- <div id="logo">
- <p><a href="{{ basepath }}">Ipsilon</a></p>
- </div>
- <div id="logout">
- <p><a href="{{ basepath }}/logout">Log Out</a></p>
- </div>
- <div id="options">
- {% if user.is_admin %}
- <p>Login plugins:</p>
- <ul>
- {% for p in available %}
- <li> {{ p }} -
- {% if p in enabled %}
- <a href="{{ basepath }}/admin/login/{{ p }}/disable">Disable</a> -
- <a href="{{ basepath }}/admin/login/{{ p }}">Configure</a>
- {% else %}
- <a href="{{ basepath }}/admin/login/{{ p }}/enable">Enable</a>
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- <p>Plugins order: [list here and form button to change?]</p>
- {% endif %}
+{% extends "master-admin.html" %}
+{% block main %}
+{% if user.is_admin %}
+ <h2>Login plugins</h2>
+
+ {% for p in available %}
+ <div class="row">
+ <div class="col-md-3 col-sm-3 col-xs-6">{{ p }}</div>
+ <div class="col-md-3 col-sm-3 col-xs-6">
+ {% if p in enabled %}
+ <a class="btn btn-default" href="{{ basepath }}/admin/login/{{ p }}/disable">Disable</a>
+ <a class="btn btn-default" href="{{ basepath }}/admin/login/{{ p }}">Configure</a>
+ {% else %}
+ <a class="btn btn-default" href="{{ basepath }}/admin/login/{{ p }}/enable">Enable</a>
+ {% endif %}
</div>
- <div id="home">
- <p><a href="{{ basepath }}/">Home</a></p>
</div>
- </div>
-</body>
-</html>
+ {% endfor %}
+ <h3>Plugins order</h3>
+ <p>[list here and form button to change?]</p>
+{% endif %}
+{% endblock %} \ No newline at end of file
diff --git a/templates/admin/login_plugin.html b/templates/admin/login_plugin.html
index 43adac6..b45b3a4 100644
--- a/templates/admin/login_plugin.html
+++ b/templates/admin/login_plugin.html
@@ -1,42 +1,26 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="UTF-8"></meta>
- <title>{{ title }}</title>
- <link href="{{ basepath }}/ui/ipsilon.css" type="text/css" rel="stylesheet"></link>
- <link href="{{ basepath }}/ui/favicon.ico" type="image/ico" rel="icon"></link>
-</head>
-<body>
- <div id="container">
- <div id="logo">
- <p><a href="{{ basepath }}">Ipsilon</a></p>
- </div>
- <div id="logout">
- <p><a href="{{ basepath }}/logout">Log Out</a></p>
- </div>
- <div id="message">
- <p>{{ message }}</p>
- </div>
- <div id="options">
- <form id="{{ name }}" action="{{ action }}" method="post" enctype="application/x-www-form-urlencoded">
- <ul>
- {% for o in options %}
- <li>{{ o }}:
- <p>{{ options[o][0] }}</p>
- <input type="text" name="{{ o }}" value="{{ options[o][2] }}">
- </li>
- {% endfor %}
- </ul>
- <input id="submit" name="submit" type="submit" value="Submit">
- </form>
- </div>
- <div id="home">
- <p>
- <a href="{{ basepath }}/admin">Admin</a> -
- <a href="{{ basepath }}/">Home</a>
- </p>
- </div>
+{% extends "master-admin.html" %}
+{% block main %}
+ <h2>{{ title }}</h2>
+ {% if message %}
+ <div class="alert alert-{{message_type}}">
+ <p>{{ message }}</p>
</div>
-</body>
-</html>
+ {% endif %}
+ <div id="options">
+ <form role="form" id="{{ name }}" action="{{ action }}" method="post" enctype="application/x-www-form-urlencoded">
+ {% for o in options %}
+ <div class="form-group">
+ <label for="{{ o }}">{{ o }}:</label>
+ <input type="text" class="form-control" name="{{ o }}" value="{{ options[o][2] }}">
+ </div>
+ <span class="help-block">{{ options[o][0] }}</span>
+ {% endfor %}
+
+ <button id="submit" class="btn btn-primary" name="submit" type="submit" value="Submit">
+ Save
+ </button>
+ <a href="{{ basepath }}/admin" class="btn btn-default" title="Back">Back</a>
+ </form>
+ </div>
+{% endblock %} \ No newline at end of file
diff --git a/templates/master-admin.html b/templates/master-admin.html
new file mode 100644
index 0000000..e57c031
--- /dev/null
+++ b/templates/master-admin.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<!--[if IE 8]><html class="ie8"><![endif]-->
+<!--[if gt IE 8]><!--><html><!--<![endif]-->
+ <head>
+ <title>{{ title }}</title>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link href="{{ basepath }}/ui/css/admin.css" rel="stylesheet" media="screen, print">
+ <script src="{{ basepath }}/ui/js/jquery.js"></script>
+ <script src="{{ basepath }}/ui/js/bootstrap.js"></script>
+ <script src="{{ basepath }}/ui/js/patternfly.js"></script>
+ </head>
+ <body>
+ <nav class="navbar navbar-default navbar-pf" role="navigation">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse-1">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="/">
+ <img src="{{ basepath }}/ui/img/brand.png" alt="Ipsilon" />
+ </a>
+ </div>
+ <div class="collapse navbar-collapse navbar-collapse-1">
+ <ul class="nav navbar-nav navbar-utility">
+ <!-- <li>
+ <a href="#">Status</a>
+ </li> -->
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="pficon pficon-user"></span>
+ {{ user.fullname }} <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <li>
+ <a href="{{ basepath }}/logout" id="logout">Log Out</a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ <ul class="nav navbar-nav navbar-primary">
+ <li>
+ <a href="{{ basepath }}/admin">Login plugins</a>
+ </li>
+ <li>
+ <a href="{{ basepath }}/admin">Providers</a>
+ </li>
+ <li>
+ <a href="{{ basepath }}/admin">Sites</a>
+ </li>
+ </ul>
+ </div>
+ </nav>
+
+ <div class="container">
+ {% block main %}
+ {% endblock %}
+ </div>
+ </body>
+</html>