Looks better
This commit is contained in:
1 parent
4fae23c444
commit
99874b1323
17 files changed
+407
-82
No files matched your search
@@ -1,32 +1,41 @@
|
||||
$(document).ready(function() {
|
||||
var api_urls = {
|
||||
fwd_list: '/api/forwards/',
|
||||
fwd_delete: '/api/forward/',
|
||||
fwd_create: '/api/forward/',
|
||||
ou_list: '/api/orgunits/',
|
||||
};
|
||||
$.getJSON(api_urls.fwd_list, function(data) {
|
||||
if( !data.cpanelresult ) {
|
||||
$(".forwards-container").html("No results.");
|
||||
return;
|
||||
}
|
||||
nunjucks.configure({ autoescape: true });
|
||||
var api_urls = {
|
||||
fwd_list: '/api/forwards/',
|
||||
fwd_delete: '/api/forward/',
|
||||
fwd_create: '/api/forward/',
|
||||
ou_list: '/api/orgunits/',
|
||||
me: '/api/me/',
|
||||
};
|
||||
if( $('body.home').length ) {
|
||||
$.getJSON(api_urls.ou_list, function(data) {
|
||||
var ou_html = nunjucks.render('orgunits.html', {
|
||||
orgunits: data,
|
||||
api_urls: api_urls
|
||||
});
|
||||
|
||||
var forwards = data.cpanelresult.data;
|
||||
console.log(forwards);
|
||||
var lists =_.groupBy(forwards, function(fwd) { return fwd.dest; });
|
||||
console.log(lists);
|
||||
nunjucks.configure({ autoescape: true });
|
||||
var forward_html = nunjucks.render(
|
||||
'static/app/templates/list.html',
|
||||
{
|
||||
lists: lists,
|
||||
api_urls: api_urls
|
||||
});
|
||||
$(".orgunit-list").append(ou_html);
|
||||
});
|
||||
|
||||
$.getJSON(api_urls.fwd_list, function(data) {
|
||||
if( !data.cpanelresult ) {
|
||||
$(".forwards-container").html("No results.");
|
||||
return;
|
||||
}
|
||||
|
||||
$(".forwards-container").html(forward_html);
|
||||
var forwards = data.cpanelresult.data;
|
||||
var lists =_.groupBy(forwards, function(fwd) { return fwd.dest; });
|
||||
|
||||
$("input[name=fwd-delete]").click(function() {
|
||||
$(this).parent().parent().toggleClass('danger');
|
||||
});
|
||||
});
|
||||
var fw_html = nunjucks.render('list.html', {
|
||||
lists: lists,
|
||||
api_urls: api_urls
|
||||
});
|
||||
|
||||
$(".forwards-container").html(fw_html);
|
||||
|
||||
$("input[name=fwd-delete]").click(function() {
|
||||
$(this).parent().parent().toggleClass('danger');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1 +1,45 @@
|
||||
@import "../../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap";
|
||||
@import "../../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap";
|
||||
|
||||
.login-form {
|
||||
margin: 0 auto;
|
||||
max-width: 400px;
|
||||
float: none;
|
||||
input[type=submit] {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide for mobile, show later */
|
||||
.sidebar {
|
||||
display: none;
|
||||
@media (min-width: 768px) {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sidebar navigation */
|
||||
.nav-sidebar > .active > a,
|
||||
.nav-sidebar > .active > a:hover,
|
||||
.nav-sidebar > .active > a:focus {
|
||||
color: #fff;
|
||||
background-color: #428bca;
|
||||
}
|
||||
|
||||
/* Sticky footer styles */
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
body {
|
||||
/* Margin bottom by footer height */
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
/* Set the fixed height of the footer here */
|
||||
height: 60px;
|
||||
background-color: #f5f5f5;
|
||||
padding-top: 20px;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{% for list,members in lists %}
|
||||
<div class="fwdlist col-md-12">
|
||||
<div class="fwdlist">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">{{ list }} <span class="badge">{{members|length}}</span></div>
|
||||
<table class="table table-striped table-condensed">
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{% for ou in orgunits %}
|
||||
<li><a href="/?q={{ou.prefix }}">{{ ou.name }}</a></li>
|
||||
{% endfor %}
|
||||
+36
-27
@@ -1,32 +1,41 @@
|
||||
$(document).ready(function() {
|
||||
var api_urls = {
|
||||
fwd_list: '/api/forwards/',
|
||||
fwd_delete: '/api/forward/',
|
||||
fwd_create: '/api/forward/',
|
||||
ou_list: '/api/orgunits/',
|
||||
};
|
||||
$.getJSON(api_urls.fwd_list, function(data) {
|
||||
if( !data.cpanelresult ) {
|
||||
$(".forwards-container").html("No results.");
|
||||
return;
|
||||
}
|
||||
nunjucks.configure({ autoescape: true });
|
||||
var api_urls = {
|
||||
fwd_list: '/api/forwards/',
|
||||
fwd_delete: '/api/forward/',
|
||||
fwd_create: '/api/forward/',
|
||||
ou_list: '/api/orgunits/',
|
||||
me: '/api/me/',
|
||||
};
|
||||
if( $('body.home').length ) {
|
||||
$.getJSON(api_urls.ou_list, function(data) {
|
||||
var ou_html = nunjucks.render('orgunits.html', {
|
||||
orgunits: data,
|
||||
api_urls: api_urls
|
||||
});
|
||||
|
||||
var forwards = data.cpanelresult.data;
|
||||
console.log(forwards);
|
||||
var lists =_.groupBy(forwards, function(fwd) { return fwd.dest; });
|
||||
console.log(lists);
|
||||
nunjucks.configure({ autoescape: true });
|
||||
var forward_html = nunjucks.render(
|
||||
'static/app/templates/list.html',
|
||||
{
|
||||
lists: lists,
|
||||
api_urls: api_urls
|
||||
});
|
||||
$(".orgunit-list").append(ou_html);
|
||||
});
|
||||
|
||||
$.getJSON(api_urls.fwd_list, function(data) {
|
||||
if( !data.cpanelresult ) {
|
||||
$(".forwards-container").html("No results.");
|
||||
return;
|
||||
}
|
||||
|
||||
$(".forwards-container").html(forward_html);
|
||||
var forwards = data.cpanelresult.data;
|
||||
var lists =_.groupBy(forwards, function(fwd) { return fwd.dest; });
|
||||
|
||||
$("input[name=fwd-delete]").click(function() {
|
||||
$(this).parent().parent().toggleClass('danger');
|
||||
});
|
||||
});
|
||||
var fw_html = nunjucks.render('list.html', {
|
||||
lists: lists,
|
||||
api_urls: api_urls
|
||||
});
|
||||
|
||||
$(".forwards-container").html(fw_html);
|
||||
|
||||
$("input[name=fwd-delete]").click(function() {
|
||||
$(this).parent().parent().toggleClass('danger');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
(function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["list.html"] = (function() {function root(env, context, frame, runtime, cb) {
|
||||
var lineno = null;
|
||||
var colno = null;
|
||||
var output = "";
|
||||
try {
|
||||
frame = frame.push();
|
||||
var t_3 = runtime.contextOrFrameLookup(context, frame, "lists");
|
||||
if(t_3) {var t_1;
|
||||
if(runtime.isArray(t_3)) {
|
||||
var t_2 = t_3.length;
|
||||
for(t_1=0; t_1 < t_3.length; t_1++) {
|
||||
var t_4 = t_3[t_1][0]
|
||||
frame.set("list", t_3[t_1][0]);
|
||||
var t_5 = t_3[t_1][1]
|
||||
frame.set("members", t_3[t_1][1]);
|
||||
frame.set("loop.index", t_1 + 1);
|
||||
frame.set("loop.index0", t_1);
|
||||
frame.set("loop.revindex", t_2 - t_1);
|
||||
frame.set("loop.revindex0", t_2 - t_1 - 1);
|
||||
frame.set("loop.first", t_1 === 0);
|
||||
frame.set("loop.last", t_1 === t_2 - 1);
|
||||
frame.set("loop.length", t_2);
|
||||
output += "\n<div class=\"fwdlist\">\n\t<div class=\"panel panel-default\">\n\t <div class=\"panel-heading\">";
|
||||
output += runtime.suppressValue(t_4, env.autoesc);
|
||||
output += " <span class=\"badge\">";
|
||||
output += runtime.suppressValue(env.getFilter("length").call(context, t_5), env.autoesc);
|
||||
output += "</span></div>\n\t\t<table class=\"table table-striped table-condensed\">\n\t\t\t<thead>\n\t\t <tr>\n\t\t\t <th>Medlem</th>\n\t\t\t <th class=\"text-center\">Slett</th>\n\t\t </tr>\n\t </thead>\n\t <tbody>\n\t\t\t";
|
||||
frame = frame.push();
|
||||
var t_8 = t_5;
|
||||
if(t_8) {var t_7 = t_8.length;
|
||||
for(var t_6=0; t_6 < t_8.length; t_6++) {
|
||||
var t_9 = t_8[t_6];
|
||||
frame.set("member", t_9);
|
||||
frame.set("loop.index", t_6 + 1);
|
||||
frame.set("loop.index0", t_6);
|
||||
frame.set("loop.revindex", t_7 - t_6);
|
||||
frame.set("loop.revindex0", t_7 - t_6 - 1);
|
||||
frame.set("loop.first", t_6 === 0);
|
||||
frame.set("loop.last", t_6 === t_7 - 1);
|
||||
frame.set("loop.length", t_7);
|
||||
output += "\n\t\t\t\t<tr><td>";
|
||||
output += runtime.suppressValue(runtime.memberLookup((t_9),"forward", env.autoesc), env.autoesc);
|
||||
output += "</td><td class=\"text-center\"><input type=\"checkbox\" name='fwd-delete' value=\"";
|
||||
output += runtime.suppressValue(runtime.memberLookup((t_9),"uri_dest", env.autoesc), env.autoesc);
|
||||
output += "=";
|
||||
output += runtime.suppressValue(runtime.memberLookup((t_9),"uri_forward", env.autoesc), env.autoesc);
|
||||
output += "\"></td></tr>\n\t\t\t";
|
||||
;
|
||||
}
|
||||
}
|
||||
frame = frame.pop();
|
||||
output += "\n\t\t\t\t<tr><td colspan=\"2\">\n\t\t\t\t<div class=\"input-group\"><input type=\"email\" name=\"\" class=\"form-control\"><span class=\"input-group-btn\"><button class=\"btn btn-default\" type=\"button\">Legg til</button></span></div>\n\t\t\t\t</td></tr>\n\t\t\t</tbody>\n\t\t</table>\n\t</div>\n</div>\n";
|
||||
;
|
||||
}
|
||||
} else {
|
||||
t_1 = -1;
|
||||
var t_2 = runtime.keys(t_3).length;
|
||||
for(var t_10 in t_3) {
|
||||
t_1++;
|
||||
var t_11 = t_3[t_10];
|
||||
frame.set("list", t_10);
|
||||
frame.set("members", t_11);
|
||||
frame.set("loop.index", t_1 + 1);
|
||||
frame.set("loop.index0", t_1);
|
||||
frame.set("loop.revindex", t_2 - t_1);
|
||||
frame.set("loop.revindex0", t_2 - t_1 - 1);
|
||||
frame.set("loop.first", t_1 === 0);
|
||||
frame.set("loop.last", t_1 === t_2 - 1);
|
||||
frame.set("loop.length", t_2);
|
||||
output += "\n<div class=\"fwdlist\">\n\t<div class=\"panel panel-default\">\n\t <div class=\"panel-heading\">";
|
||||
output += runtime.suppressValue(t_10, env.autoesc);
|
||||
output += " <span class=\"badge\">";
|
||||
output += runtime.suppressValue(env.getFilter("length").call(context, t_11), env.autoesc);
|
||||
output += "</span></div>\n\t\t<table class=\"table table-striped table-condensed\">\n\t\t\t<thead>\n\t\t <tr>\n\t\t\t <th>Medlem</th>\n\t\t\t <th class=\"text-center\">Slett</th>\n\t\t </tr>\n\t </thead>\n\t <tbody>\n\t\t\t";
|
||||
frame = frame.push();
|
||||
var t_14 = t_11;
|
||||
if(t_14) {var t_13 = t_14.length;
|
||||
for(var t_12=0; t_12 < t_14.length; t_12++) {
|
||||
var t_15 = t_14[t_12];
|
||||
frame.set("member", t_15);
|
||||
frame.set("loop.index", t_12 + 1);
|
||||
frame.set("loop.index0", t_12);
|
||||
frame.set("loop.revindex", t_13 - t_12);
|
||||
frame.set("loop.revindex0", t_13 - t_12 - 1);
|
||||
frame.set("loop.first", t_12 === 0);
|
||||
frame.set("loop.last", t_12 === t_13 - 1);
|
||||
frame.set("loop.length", t_13);
|
||||
output += "\n\t\t\t\t<tr><td>";
|
||||
output += runtime.suppressValue(runtime.memberLookup((t_15),"forward", env.autoesc), env.autoesc);
|
||||
output += "</td><td class=\"text-center\"><input type=\"checkbox\" name='fwd-delete' value=\"";
|
||||
output += runtime.suppressValue(runtime.memberLookup((t_15),"uri_dest", env.autoesc), env.autoesc);
|
||||
output += "=";
|
||||
output += runtime.suppressValue(runtime.memberLookup((t_15),"uri_forward", env.autoesc), env.autoesc);
|
||||
output += "\"></td></tr>\n\t\t\t";
|
||||
;
|
||||
}
|
||||
}
|
||||
frame = frame.pop();
|
||||
output += "\n\t\t\t\t<tr><td colspan=\"2\">\n\t\t\t\t<div class=\"input-group\"><input type=\"email\" name=\"\" class=\"form-control\"><span class=\"input-group-btn\"><button class=\"btn btn-default\" type=\"button\">Legg til</button></span></div>\n\t\t\t\t</td></tr>\n\t\t\t</tbody>\n\t\t</table>\n\t</div>\n</div>\n";
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
frame = frame.pop();
|
||||
cb(null, output);
|
||||
;
|
||||
} catch (e) {
|
||||
cb(runtime.handleError(e, lineno, colno));
|
||||
}
|
||||
}
|
||||
return {
|
||||
root: root
|
||||
};
|
||||
})();
|
||||
})();
|
||||
|
||||
(function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["orgunits.html"] = (function() {function root(env, context, frame, runtime, cb) {
|
||||
var lineno = null;
|
||||
var colno = null;
|
||||
var output = "";
|
||||
try {
|
||||
frame = frame.push();
|
||||
var t_3 = runtime.contextOrFrameLookup(context, frame, "orgunits");
|
||||
if(t_3) {var t_2 = t_3.length;
|
||||
for(var t_1=0; t_1 < t_3.length; t_1++) {
|
||||
var t_4 = t_3[t_1];
|
||||
frame.set("ou", t_4);
|
||||
frame.set("loop.index", t_1 + 1);
|
||||
frame.set("loop.index0", t_1);
|
||||
frame.set("loop.revindex", t_2 - t_1);
|
||||
frame.set("loop.revindex0", t_2 - t_1 - 1);
|
||||
frame.set("loop.first", t_1 === 0);
|
||||
frame.set("loop.last", t_1 === t_2 - 1);
|
||||
frame.set("loop.length", t_2);
|
||||
output += "\n<li><a href=\"/?q=";
|
||||
output += runtime.suppressValue(runtime.memberLookup((t_4),"prefix", env.autoesc), env.autoesc);
|
||||
output += "\">";
|
||||
output += runtime.suppressValue(runtime.memberLookup((t_4),"name", env.autoesc), env.autoesc);
|
||||
output += "</a></li>\n";
|
||||
;
|
||||
}
|
||||
}
|
||||
frame = frame.pop();
|
||||
cb(null, output);
|
||||
;
|
||||
} catch (e) {
|
||||
cb(runtime.handleError(e, lineno, colno));
|
||||
}
|
||||
}
|
||||
return {
|
||||
root: root
|
||||
};
|
||||
})();
|
||||
})();
|
||||
+47
@@ -6515,3 +6515,50 @@ button.close {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
.login-form {
|
||||
margin: 0 auto;
|
||||
max-width: 400px;
|
||||
float: none;
|
||||
}
|
||||
.login-form input[type=submit] {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* Hide for mobile, show later */
|
||||
.sidebar {
|
||||
display: none;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.sidebar {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sidebar navigation */
|
||||
.nav-sidebar > .active > a,
|
||||
.nav-sidebar > .active > a:hover,
|
||||
.nav-sidebar > .active > a:focus {
|
||||
color: #fff;
|
||||
background-color: #428bca;
|
||||
}
|
||||
|
||||
/* Sticky footer styles */
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
/* Margin bottom by footer height */
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
/* Set the fixed height of the footer here */
|
||||
height: 60px;
|
||||
background-color: #f5f5f5;
|
||||
padding-top: 20px;
|
||||
}
|
||||
+2
-2
@@ -20,7 +20,7 @@ frame.set("loop.revindex0", t_2 - t_1 - 1);
|
||||
frame.set("loop.first", t_1 === 0);
|
||||
frame.set("loop.last", t_1 === t_2 - 1);
|
||||
frame.set("loop.length", t_2);
|
||||
output += "\n<div class=\"fwdlist col-md-12\">\n\t<div class=\"panel panel-default\">\n\t <div class=\"panel-heading\">";
|
||||
output += "\n<div class=\"fwdlist\">\n\t<div class=\"panel panel-default\">\n\t <div class=\"panel-heading\">";
|
||||
output += runtime.suppressValue(t_4, env.autoesc);
|
||||
output += " <span class=\"badge\">";
|
||||
output += runtime.suppressValue(env.getFilter("length").call(context, t_5), env.autoesc);
|
||||
@@ -67,7 +67,7 @@ frame.set("loop.revindex0", t_2 - t_1 - 1);
|
||||
frame.set("loop.first", t_1 === 0);
|
||||
frame.set("loop.last", t_1 === t_2 - 1);
|
||||
frame.set("loop.length", t_2);
|
||||
output += "\n<div class=\"fwdlist col-md-12\">\n\t<div class=\"panel panel-default\">\n\t <div class=\"panel-heading\">";
|
||||
output += "\n<div class=\"fwdlist\">\n\t<div class=\"panel panel-default\">\n\t <div class=\"panel-heading\">";
|
||||
output += runtime.suppressValue(t_10, env.autoesc);
|
||||
output += " <span class=\"badge\">";
|
||||
output += runtime.suppressValue(env.getFilter("length").call(context, t_11), env.autoesc);
|
||||
|
||||
@@ -46,9 +46,10 @@ gulp.task('fonts', function () {
|
||||
.pipe($.size());
|
||||
});
|
||||
gulp.task('templates', function () {
|
||||
return gulp.src('app/templates/list.html')
|
||||
return gulp.src('app/templates/*.html')
|
||||
.pipe($.nunjucks())
|
||||
.pipe(gulp.dest('dist/templates'))
|
||||
.pipe($.concat('templates.js'))
|
||||
.pipe(gulp.dest('dist/scripts'))
|
||||
.pipe($.size());
|
||||
});
|
||||
|
||||
@@ -90,4 +91,5 @@ gulp.task('watch', ['serve'], function () {
|
||||
gulp.watch('app/styles/**/*.scss', ['styles']);
|
||||
gulp.watch('app/scripts/**/*.js', ['scripts']);
|
||||
gulp.watch('app/images/**/*', ['images']);
|
||||
gulp.watch('app/templates/**/*.html', ['templates']);
|
||||
});
|
||||
@@ -10,6 +10,7 @@
|
||||
"gulp-bower-files": "^0.2.1",
|
||||
"gulp-cache": "^0.1.11",
|
||||
"gulp-clean": "^0.2.4",
|
||||
"gulp-concat": "^2.4.1",
|
||||
"gulp-csso": "^0.2.6",
|
||||
"gulp-filter": "^0.4.1",
|
||||
"gulp-flatten": "^0.0.2",
|
||||
|
||||
@@ -7,10 +7,16 @@
|
||||
<link rel="stylesheet" href="{% static 'dist/styles/main.css' %}" type="text/css">
|
||||
<script type="text/javascript" src="{% static 'bower_components/jquery/dist/jquery.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'bower_components/underscore/underscore.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'bower_components/nunjucks/browser/nunjucks.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'bower_components/nunjucks/browser/nunjucks-slim.js' %}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body class="{% block "body-css-classes" %}{% endblock %}">
|
||||
{% include "nav.html" %}
|
||||
{% block "navigation" %}{% endblock %}
|
||||
|
||||
{% block "body" %}{% endblock %}
|
||||
<script type="text/javascript" src="{% static 'bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/alert.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap/dropdown.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'dist/scripts/templates.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'dist/scripts/main.js' %}"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,22 +1,29 @@
|
||||
{% extends "base.html" %}
|
||||
{% load bootstrap %}
|
||||
{% block "body-css-classes" %}{% if user.is_authenticated %}home{% else %}login{% endif %}{% endblock %}
|
||||
{% block "body" %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% if not user.is_authenticated %}
|
||||
<form method="post">
|
||||
{{ form|bootstrap }}
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Logg inn">
|
||||
</form>
|
||||
{% else %}
|
||||
<div class="greeting">Hei, {{ user.username }}</div>
|
||||
<a href="{% url 'logout' %}">Logg ut</a>.
|
||||
{% endif %}
|
||||
{% if not user.is_authenticated %}
|
||||
{% include "login_form.html" %}
|
||||
{% else %}
|
||||
<div class="row">
|
||||
<div class="col-sm-4 sidebar">
|
||||
<ul class="nav nav-sidebar orgunit-list">
|
||||
<li class="active"><a href="/">Alle</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="forwards-container"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="forwards-container"></div>
|
||||
</div>
|
||||
<a href="/api/">API</a><br>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<a href="https://edb.neuf.no">EDB-gjengen</a>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,9 @@
|
||||
{% load bootstrap %}
|
||||
<div class="login-form">
|
||||
<form method="post">
|
||||
{{ form|bootstrap }}
|
||||
{% csrf_token %}
|
||||
<a href="https://brukerinfo.neuf.no/">Glemt brukernavn eller passord?</a><br>
|
||||
<input type="submit" value="Logg inn" class="btn btn-primary btn-lg">
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
<nav class="navbar navbar-default" role="navigation">
|
||||
<div class="container">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-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="#">lister.neuf.no</a>
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a href="{% url 'home' %}">Hjem</a></li>
|
||||
</ul>
|
||||
{% if user.is_authenticated %}
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="#">{{ user.first_name }} {{ user.last_name }}</a></li>
|
||||
<li><a href="{% url 'logout' %}">Logg ut</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div><!-- /.navbar-collapse -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</nav>
|
||||
+3
-2
@@ -1,12 +1,13 @@
|
||||
from django.conf.urls import patterns, url
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
from mailadmin.views import ForwardsViewSet, MyUserViewSet, OrgUnitViewSet, ForwardCreateView, ForwardDeleteView
|
||||
from mailadmin.views import ForwardsViewSet, MyUserViewSet, MyOrgUnitViewSet, OrgUnitViewSet, ForwardCreateView, ForwardDeleteView
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register(r'forwards', ForwardsViewSet, base_name='all')
|
||||
router.register(r'me', MyUserViewSet, base_name='me')
|
||||
router.register(r'orgunits', OrgUnitViewSet, base_name='ous')
|
||||
router.register(r'orgunits', MyOrgUnitViewSet, base_name='ous')
|
||||
router.register(r'orgunits/all', OrgUnitViewSet, base_name='allous')
|
||||
urlpatterns = router.urls
|
||||
|
||||
urlpatterns += patterns(
|
||||
|
||||
+10
-1
@@ -114,7 +114,16 @@ class MyUserViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
return User.objects.filter(pk=self.request.user.pk)
|
||||
|
||||
|
||||
class MyOrgUnitViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = OrgUnit.objects.none()
|
||||
serializer_class = OrgUnitSerializer
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
def get_queryset(self):
|
||||
return OrgUnit.objects.filter(admin_groups__in=self.request.user.groups.values('id'))
|
||||
|
||||
|
||||
class OrgUnitViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = OrgUnit.objects.all()
|
||||
serializer_class = OrgUnitSerializer
|
||||
permission_classes = [IsAuthenticated]
|
||||
permission_classes = [IsAuthenticated]
|
||||
@@ -8,7 +8,7 @@ urlpatterns = patterns(
|
||||
url(r'^api/', include('mailadmin.urls')),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||
url(r'^/logout/$', 'django.contrib.auth.views.logout', name='logout')
|
||||
url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout')
|
||||
)
|
||||
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
Reference in new issue
Block a user