Commit 3aaefb38 authored by Matthias Zimny's avatar Matthias Zimny

fix bugs in admin design, refactor code in admin, add notification route

parent 3d2325f5
......@@ -6,6 +6,5 @@
@import '../imports/ui/profile/profile.scss';
@import '../imports/ui/learn/box.scss';
@import '../imports/ui/learn/memo.scss';
@import '../imports/ui/admin_main/admin_main.scss';
@import '../imports/ui/admin_dashboard/admin_dashboard.scss';
@import '../imports/ui/pool/pool.scss';
@import '../imports/ui/admin/admin.scss';
......@@ -374,6 +374,7 @@
"cardsets": "Kartensätze",
"cards": "Karten",
"users": "Benutzer",
"notifications": "Benachrichtigungen",
"see_all": "Alle ansehen",
"name": "Name",
"front": "Vorderseite",
......
......@@ -374,7 +374,8 @@
"dashboard": "Dashboard",
"cardsets": "Cardsets",
"cards": "Cards",
"users": "User",
"users": "Users",
"notifications": "Notifications",
"see_all": "See all",
"name": "Name",
"front": "Front",
......
......@@ -143,22 +143,6 @@ Router.route('/admin/dashboard', {
}
});
Router.route('/admin/users', {
name: 'admin_users',
template: 'admin_users',
layoutTemplate: 'admin_main',
onBeforeAction: function() {
if (!Roles.userIsInRole(Meteor.userId(), ['admin-user']))
{
Router.go('home');
}
else
{
this.next();
}
}
});
Router.route('/admin/cardsets', {
name: 'admin_cardsets',
template: 'admin_cardsets',
......@@ -196,7 +180,7 @@ Router.route('/admin/cardset/:_id', {
});
Router.route('/admin/cards', {
name: 'admin_cards',
name: 'adminCards',
template: 'admin_cards',
layoutTemplate: 'admin_main',
onBeforeAction: function() {
......@@ -212,7 +196,7 @@ Router.route('/admin/cards', {
});
Router.route('/admin/card/:_id', {
name: 'admin_card',
name: 'adminCard',
template: 'admin_card',
layoutTemplate: 'admin_main',
data: function() {
......@@ -231,6 +215,38 @@ Router.route('/admin/card/:_id', {
}
});
Router.route('/admin/users', {
name: 'admin_users',
template: 'admin_users',
layoutTemplate: 'admin_main',
onBeforeAction: function() {
if (!Roles.userIsInRole(Meteor.userId(), ['admin-user']))
{
Router.go('home');
}
else
{
this.next();
}
}
});
Router.route('/admin/notifications', {
name: 'admin_notifications',
template: 'admin_notifications',
layoutTemplate: 'admin_main',
onBeforeAction: function() {
if (!Roles.userIsInRole(Meteor.userId(), ['admin-user']))
{
Router.go('home');
}
else
{
this.next();
}
}
});
var isSignedIn = function() {
if (!(Meteor.user() || Meteor.loggingIn())) {
Router.go('home');
......
......@@ -34,27 +34,41 @@
<ul class="sidebar-nav">
<li>
<a href="{{pathFor route='admin_dashboard'}}">{{_ "admin.dashboard"}}</a>
<a class="{{#if isActiveRoute regex='admin_dashboard'}}active{{/if}}" href="{{pathFor route='admin_dashboard'}}">
<i class="fa fa-dashboard"></i>
<span>{{_ "admin.dashboard"}}</span>
</a>
</li>
<li>
<a href="{{pathFor route='admin_cardsets'}}">{{_ "admin.cardsets"}}</a>
<a class="{{#if isActiveRoute regex='admin_cardsets|admin_cardset'}}active{{/if}}" href="{{pathFor route='admin_cardsets'}}">
<i class="fa fa-folder-open"></i>
<span>{{_ "admin.cardsets"}}</span>
</a>
</li>
<li>
<a class="{{#if isActiveRoute regex='adminCards|adminCard'}}active{{/if}}" href="{{pathFor route='adminCards'}}">
<i class="fa fa-file"></i>
<span>{{_ "admin.cards"}}</span>
</a>
</li>
<li>
<a href="{{pathFor route='admin_cards'}}">{{_ "admin.cards"}}</a>
<a class="{{#if isActiveRoute regex='admin_users'}}active{{/if}}" href="{{pathFor route='admin_users'}}">
<i class="fa fa-users"></i>
<span>{{_ "admin.users"}}</span>
</a>
</li>
<li>
<a href="{{pathFor route='admin_users'}}">{{_ "admin.users"}}</a>
<a class="{{#if isActiveRoute regex='admin_notifications'}}active{{/if}}" href="{{pathFor route='admin_notifications'}}">
<i class="fa fa-bell"></i>
<span>{{_ "admin.notifications"}}</span>
</a>
</li>
</ul>
</div>
<!-- /#sidebar-wrapper -->
<div id='admin-content-wrapper'>
<div class="container-fluid">
<div class="col-md-9 col-sm-8 col-xs-12">
{{> yield}}
</div>
</div>
{{> yield}}
</div>
</div>
</template>
......@@ -7,13 +7,19 @@ import { Session } from 'meteor/session';
import { Cardsets } from '../../api/cardsets.js';
import { Categories } from '../../api/categories.js';
import './admin_main.html';
import './admin.html';
import '../admin_dashboard/admin_dashboard.js';
import '../admin_cardsets/admin_cardsets.js';
import '../admin_cards/admin_cards.js';
import '../admin_users/admin_users.js';
import './admin_dashboard/admin_dashboard.js';
import './admin_cardsets/admin_cardsets.js';
import './admin_cards/admin_cards.js';
import './admin_users/admin_users.js';
import './admin_notifications/admin_notifications.js';
/**
* ############################################################################
* admin_main
* ############################################################################
*/
Template.admin_main.events({
'click #logout_admin': function(event) {
......
body {
> .container-fluid {
padding: 51px 15px 0;
}
#wrapper {
padding-top: 51px;
#admin-sidebar-wrapper {
background: #000;
float: left;
width: 100%;
.sidebar-nav {
padding: 0;
list-style: none;
float: left;
margin: 0;
li {
line-height: 45px;
float: left;
a {
display: block;
text-decoration: none;
padding-left: 15px;
padding-right: 15px;
color: #999999;
&:hover, &.active {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
}
i {
display: inline;
padding-right: 5px;
}
}
}
}
}
#admin-content-wrapper {
padding: 20px;
float: left;
width: 100%;
.content-header {
position: relative;
padding-bottom: 20px;
h1 {
font-size: 28px;
margin: 0;
}
small {
font-size: 16px;
}
}
.content {
min-height: 250px;
.admin_table {
background-color: #f9f9f9;
padding-top: 20px;
border-radius: 3px;
border-top: 4px solid white;
border-bottom: 4px solid white;
.clearfix {
border-bottom: 1px solid #ddd;
.reactive-table-options {
float: left !important;
.reactive-table-filter {
float: left !important;
margin-bottom: 20px;
}
}
}
table {
border-bottom: 1px solid #ddd;
}
.reactive-table-navigation {
.page-number {
margin-right: 20px;
}
}
}
.dashboard-box {
a:hover {
text-decoration: none;
}
.small-box {
border-radius: 3px;
border: 1px solid #ddd;
position: relative;
display: block;
margin-bottom: 20px;
background-color: white;
.inner {
padding: 10px;
h3 {
font-size: 38px;
font-weight: bold;
margin: 0 0 10px 0;
white-space: nowrap;
padding: 0;
}
p {
font-size: 15px;
}
}
.small-box-footer {
position: relative;
text-align: center;
padding: 3px 0;
display: block;
z-index: 10px;
background-color: #f5f5f5;
text-decoration: none;
}
}
}
}
.content.box-admin {
border-top: 4px solid white;
border-radius: 3px;
border-bottom: 4px solid white;
background-color: #f9f9f9;
.box-body-admin {
padding: 10px;
.box-button-admin {
border-top: 1px solid #ddd;
padding-top: 20px;
}
}
}
.reactive-table-navigation {
.page-number {
label:last-child {
margin-right: 21px;
}
}
}
}
}
}
@media(min-width:768px) {
body {
#wrapper {
#admin-sidebar-wrapper {
width: 230px;
position: fixed;
height: 100%;
overflow-y: auto;
.sidebar-nav {
float: none;
li {
float: none;
text-indent: 20px;
a {
padding: 0;
border-left: 3px solid transparent;
&:hover, &.active {
border-left-color: #3d9c19;
}
}
}
}
}
#admin-content-wrapper {
margin-left: 230px;
float: none;
width: auto;
}
}
}
}
......@@ -4,12 +4,12 @@ import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { Cards } from '../../api/cards.js';
import { Cardsets } from '../../api/cardsets.js';
import { Cards } from '../../../api/cards.js';
import { Cardsets } from '../../../api/cardsets.js';
import './admin_cards.html';
import '../admin_cards/admin_card.js';
import './admin_card.js';
/**
* ############################################################################
......@@ -57,7 +57,7 @@ Template.admin_cards.events({
},
'click #linkToAdminCard': function(event) {
var cardid = $(event.currentTarget).data("cardid");
Router.go('admin_card', { _id: cardid });
Router.go('adminCard', { _id: cardid });
}
});
......
......@@ -2,11 +2,10 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { Cardsets } from '../../api/cardsets.js';
import { Cards } from '../../api/cards.js';
import { Categories } from '../../api/categories.js';
import { Cardsets } from '../../../api/cardsets.js';
import { Cards } from '../../../api/cards.js';
import { Categories } from '../../../api/categories.js';
import './admin_cardset.html';
......
......@@ -4,11 +4,11 @@ import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { Cardsets } from '../../api/cardsets.js';
import { Cardsets } from '../../../api/cardsets.js';
import './admin_cardsets.html';
import '../admin_cardsets/admin_cardset.js';
import './admin_cardset.js';
/**
* ############################################################################
......
......@@ -5,7 +5,7 @@
</h1>
</div>
<div class="content">
<div class="dashboard-box col-lg-4 col-sm-6 col-xs-6">
<div class="dashboard-box col-lg-3 col-xs-6">
<a href="{{pathFor route='admin_cardsets'}}">
<div class="small-box">
<div class="inner">
......@@ -20,8 +20,8 @@
</a>
</div>
<div class="dashboard-box col-lg-4 col-sm-6 col-xs-6">
<a href="{{pathFor route='admin_cards'}}">
<div class="dashboard-box col-lg-3 col-xs-6">
<a href="{{pathFor route='adminCards'}}">
<div class="small-box">
<div class="inner">
<h3>{{totalCards}}</h3>
......@@ -35,7 +35,7 @@
</a>
</div>
<div class="dashboard-box col-lg-4 col-sm-6 col-xs-6">
<div class="dashboard-box col-lg-3 col-xs-6">
<a href="{{pathFor route='admin_users'}}">
<div class="small-box">
<div class="inner">
......
......@@ -2,14 +2,18 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { Cardsets } from '../../api/cardsets.js';
import { Cards } from '../../api/cards.js';
import { allUsers } from '../../api/allusers.js';
import { Cardsets } from '../../../api/cardsets.js';
import { Cards } from '../../../api/cards.js';
import { allUsers } from '../../../api/allusers.js';
import './admin_dashboard.html';
/**
* ############################################################################
* admin_dashboard
* ############################################################################
*/
Template.admin_dashboard.helpers({
totalCardsets: function() {
......
<template name="admin_notifications">
Notifications View
</template>
//------------------------ IMPORTS
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import './admin_notifications.html';
......@@ -6,7 +6,7 @@ import { Session } from 'meteor/session';
import './admin_users.html';
import { allUsers } from '../../api/allusers.js';
import { allUsers } from '../../../api/allusers.js';
Meteor.subscribe('allUsers');
......@@ -23,7 +23,7 @@ Template.admin_users.helpers({
{ key: 'roles', label: TAPi18n.__('admin.roles') },
{ key: 'profile.name', label: TAPi18n.__('admin.users') },
{ key: 'mailto', label: TAPi18n.__('admin.mail'), sortable: false, fn: function() {
return new Spacebars.SafeString("<a class='mailtoUserAdmin btn btn-xs btn-default' title='" + TAPi18n.__('admin.notifyuser') + "'><i class='glyphicon glyphicon-envelope'></i></a>");
return new Spacebars.SafeString("<a class='mailtoUserAdmin btn btn-xs btn-default' title='" + TAPi18n.__('admin.notifyuser') + "'><i class='fa fa-envelope'></i></a>");
}},
{ key: 'createdAt', label: TAPi18n.__('admin.joined') },
{ key: 'edit', label: TAPi18n.__('admin.edit'), sortable: false, fn: function() {
......
.dashboard-box {
a:hover {
text-decoration: none;
}
.small-box {
border-radius: 3px;
border: 1px solid #ddd;
position: relative;
display: block;
margin-bottom: 20px;
background-color: white;
.inner {
padding: 10px;
h3 {
font-size: 38px;
font-weight: bold;
margin: 0 0 10px 0;
white-space: nowrap;
padding: 0;
}
p {
font-size: 15px;
}
}
.small-box-footer {
position: relative;
text-align: center;
padding: 3px 0;
display: block;
z-index: 10px;
background-color: #f5f5f5;
text-decoration: none;
}
}
}
body {
> .container-fluid {
padding: 51px 15px 0;
}
}
#wrapper {
padding-top: 51px;
}
#admin-sidebar-wrapper {
background: #000;
float: left;
width: 100%;
}
#admin-sidebar-wrapper .sidebar-nav {
padding: 0;
list-style: none;
float: left;
margin: 0;
}
#admin-sidebar-wrapper .sidebar-nav li {
line-height: 45px;
float: left;
}
#admin-sidebar-wrapper .sidebar-nav li a {
display: block;
text-decoration: none;
padding-left: 15px;
padding-right: 15px;
color: #999999;
}
#admin-sidebar-wrapper .sidebar-nav li a:hover {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
}
#admin-sidebar-wrapper .sidebar-nav li a:active,
#admin-sidebar-wrapper .sidebar-nav li a:focus {
text-decoration: none;
}
#admin-content-wrapper {
width: 100%;
padding: 20px;
float: left;
}
@media(min-width:768px) {
#admin-sidebar-wrapper {
width: 250px;
position: fixed;
height: 100%;
overflow-y: auto;
}
#admin-content-wrapper {
margin-left: 250px;
}
#admin-sidebar-wrapper .sidebar-nav {
float: none;
}
#admin-sidebar-wrapper .sidebar-nav li {
float: none;
text-indent: 20px;
line-height: 40px;
}
#admin-sidebar-wrapper .sidebar-nav li a {
padding: 0;
}
}
.content-header {
position: relative;
padding-bottom: 20px;
small {
font-size: 18px;
}
}
.admin_table {
background-color: #f9f9f9;
padding-top: 20px;
border-radius: 3px;
border-top: 4px solid white;
border-bottom: 4px solid white;
.clearfix {
border-bottom: 1px solid #ddd;
.reactive-table-options {
float: left !important;
.reactive-table-filter {
float: left !important;
margin-bottom: 20px;
}
}
}
table {
border-bottom: 1px solid #ddd;
}
.reactive-table-navigation {
.page-number {
margin-right: 20px;
}
}
}
.content.box-admin {
border-top: 4px solid white;
border-radius: 3px;
border-bottom: 4px solid white;
background-color: #f9f9f9;
.box-body-admin {
padding: 10px;
.box-button-admin {
border-top: 1px solid #ddd;
padding-top: 20px;
}
}
}
.reactive-table-navigation {
.page-number {
label:last-child {
margin-right: 21px;
}
}
}
......@@ -13,7 +13,7 @@ import '../impressum/impressum.js';
import '../cardsets/cardsets.js';
import '../pool/pool.js';
import '../profile/profile.js'
import '../admin_main/admin_main.js';
import '../admin/admin.js';
Meteor.subscribe("Users");
Meteor.subscribe("notifications");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment