Commit 5fe8b929 authored by Yannick Lehnhausen's avatar Yannick Lehnhausen

Added functionality to change intervalls as admin in the admin-backend

parent eed5abb2
......@@ -238,17 +238,24 @@
},
"panel-heading-experience": {
"experience": "Erfahrungspunkte (XP)"
},
"experience": "Erfahrungspunkte (XP)",
"intervall": "Einstellungen der Intervalle für den Lernzeitraum (XP)",
"preview": "Vorschau"
},
"panel-body-experience": {
"intervall1" : "Intervall 1",
"intervall2" : "Intervall 2",
"intervall3" : "Intervall 3",
"total": "Total",
"twoDaysAgo": "Vorgestern",
"today": "Heute",
"days": "Tage",
"yesterday": "Gestern",
"days":"Tage",
"twoDaysAgo":"Vorgestern",
"month": "4 Wochen",
"threemonth": "3 Monate",
"month": "Wochen",
"threemonth": "Monate",
"lastredeem": "Zuletzt für: "
},
......@@ -498,6 +505,7 @@
"cardsets": "Kartensätze",
"cards": "Karten",
"users": "Benutzer",
"intervall": "Lernintervalle einstellen",
"notifications": "Benachrichtigungen",
"see_all": "Alle ansehen",
"name": "Name",
......
......@@ -239,15 +239,18 @@
},
"panel-heading-experience": {
"experience": "Experience Points (XP)"
},
"experience": "Experience Points (XP)",
"intervall": "Set the learning period",
"preview": "Preview"
},
"panel-body-experience": {
"total": "Total",
"today": "Today",
"yesterday": "Yesterday",
"twoDaysAgo": "before yesterday",
"days": "days",
"twoDaysAgo": "Day before yesterday",
"days": "7 days",
"lastredeem": "At last for: "
},
......@@ -498,6 +501,7 @@
"cardsets": "Cardsets",
"cards": "Cards",
"users": "Users",
"intervall": "Define learning period",
"notifications": "Notifications",
"see_all": "See all",
"name": "Name",
......
......@@ -11,11 +11,21 @@ if (Meteor.isServer) {
}
Meteor.methods({
updateIntervall: function(){
updateIntervall: function (inv1, inv2, inv3) {
if (!Roles.userIsInRole(this.userId, ["admin", "editor"])) {
throw new Meteor.Error("not-authorized");
}
AdminSettings.update(
{
name: "seqSettings"
},
{
$set: {
seqOne: inv1,
seqTwo: inv2,
seqThree: inv3
}
});
}
});
\ No newline at end of file
......@@ -193,6 +193,13 @@ Router.route('/admin/notifications', {
layoutTemplate: 'admin_main'
});
Router.route('/admin/intervalls', {
name: 'admin_intervall',
template: 'admin_settings',
layoutTemplate: 'admin_main'
});
var isSignedIn = function() {
if (!(Meteor.user() || Meteor.loggingIn())) {
Router.go('home');
......
......@@ -105,6 +105,12 @@
<span>{{_ "admin.notifications"}}</span>
</a>
</li>
<li>
<a class="{{#if isActiveRoute regex='admin_intervall'}}active{{/if}}" href="{{pathFor route='admin_intervall'}}">
<i class="fa fa-cog"></i>
<span>{{_ "admin.intervall"}}</span>
</a>
</li>
</ul>
</div>
<!-- /#sidebar-wrapper -->
......
......@@ -214,3 +214,104 @@
</div>
<!-- /.modal -->
</template>
<template name="admin_settings">
<div class="col-md-12" id="profile-xp">
<div class="panel panel-default">
<div class="panel-heading panel-heading-experience">
<h3 class="panel-title">{{_ "panel-heading-experience.intervall"}}</h3>
</div>
<div class="panel-body panel-body-experience">
<div class="row" style="margin-bottom:10px; margin-left: 5px">
<form class="form-inline">
<div class="form-group" style="margin-right: 20px; margin-bottom: 5px">
<label for="intervall1">Intervall 1 </label>
<input type="number" class="form-control" id="inv1" placeholder="Standard 1 Tag">
<label for="intervall1">Tag(e) </label>
</div>
<div class="form-group" style="margin-right: 20px; margin-bottom: 5px">
<label for="intervall2">Intervall 2 </label>
<input type="number" class="form-control" id="inv2" placeholder="Standard 30 Tage">
<label for="intervall2">Tage </label>
</div>
<div class="form-group" style="margin-right: 20px; margin-bottom: 5px">
<label for="intervall3">Intervall 3 </label>
<input type="number" class="form-control" id="inv3" placeholder="Standard 90 Tage">
<label for="intervall3">Tage </label>
</div>
<button type="button" class="btn btn-success" id="saveIntervall">Speichern</button>
</form>
</div>
</div>
</div>
</div>
{{> preview}}
</template>
<template name="preview">
<div class="col-md-12" id="profile-xp">
<div class="panel panel-default">
<div class="panel-heading panel-heading-experience">
<h3 class="panel-title">{{_ "panel-heading-experience.preview"}}</h3>
</div>
<div class="panel-body panel-body-experience">
<div class="row" style="margin-bottom:15px">
<!-- Secquencer 1 -->
<div class="col-md-4">
<div class="well well-sm" style="margin:0; text-align:center">
<div class="row" style="height:50px;">
<span style="display:inline-block; font-size:20px; margin-top:22px; height:20px">
</span>
</div>
<div class="row">
<span class="text-muted" style="font-size:12px">
{{_ "panel-body-experience.days"}}
</span>
</div>
</div>
</div>
<!-- Secquencer 2 -->
<div class="col-md-4">
<div class="well well-sm" style="margin:0; text-align:center">
<div class="row" style="height:50px;">
<span style="display:inline-block; font-size:20px; margin-top:22px; height:20px">
</span>
</div>
<div class="row">
<span class="text-muted" style="font-size:12px">
{{_ "panel-body-experience.days"}}
</span>
</div>
</div>
</div>
<!-- Secquencer 3 -->
<div class="col-md-4">
<div class="well well-sm" style="margin:0; text-align:center">
<div class="row" style="height:50px;">
<span style="display:inline-block; font-size:20px; margin-top:22px; height:20px">
</span>
</div>
<div class="row">
<span class="text-muted" style="font-size:12px">
{{_ "panel-body-experience.days"}}
</span>
</div>
</div>
</div>
</div> <!-- div row experience -->
</div>
</div>
</div>
</template>
......@@ -6,9 +6,10 @@ import { Session } from 'meteor/session';
import { allUsers } from '../../../api/allusers.js';
import { Cardsets } from '../../../api/cardsets.js';
import { AdminSettings} from '../../../api/adminSettings.js';
import './admin_user.html';
Meteor.subscribe("adminSettings");
/**
* ############################################################################
* admin_user
......@@ -153,6 +154,30 @@ Template.admin_user.helpers({
}
});
Template.admin_settings.events({
'click #saveIntervall': function() {
var inv1 = document.getElementById('inv1').value;
var inv2 = document.getElementById('inv2').value;
var inv3 = document.getElementById('inv3').value;
if(inv1 == 0){
inv1 = 1;
}
if(inv2 == 0){
inv2 = 30;
}
if(inv3 == 0){
inv3 = 90;
}
Meteor.call('updateIntervall', inv1,inv2,inv3);
console.log(inv1);
console.log(inv2);
console.log(inv3);
}
});
Template.admin_user.events({
'click #userSaveAdmin': function(event, tmpl) {
var name = $('#editUserNameAdmin').val();
......@@ -252,6 +277,8 @@ Template.admin_user.events({
'click #userCancelAdmin': function() {
window.history.go(-1);
},
'click #userDeleteAdmin': function() {
$("#userDeleteAdmin").css('display', "none");
$("#userConfirmAdmin").css('display', "");
......
......@@ -94,3 +94,4 @@
</div>
</div>
</template>
......@@ -393,23 +393,19 @@ Template.profileRequests.helpers({
*/
var seqOne = 7; //7 tag
var seqTwo = 30; //30 tag
var seqTwo = 29; //30 tag
var seqThree = 90; //90 tag
Template.profileXp.helpers({
startXp: function() {
console.log("bevor seq ");
if(Meteor.adminSettings.findOne({name: "seqSettings"})){
var seq = Meteor.adminSettings.findOne({name: "seqSettings"});
console.log(seq);
var seq = AdminSettings.findOne({name: "seqSettings"});
if(seq){
seqOne = seq.seqOne; //7 tag
seqTwo = seq.seqTwo; //30 tag
seqThree = seq.seqThree; //90 tag
} else {
console.log("error could not finde adminSettings");
//console.log("error could not find adminSettings");
}
},
getDays1: function(){
......
......@@ -21,7 +21,7 @@
"BT_PRIVATE_KEY": "b508f71a0e0b01940b0fbe75940debb9"
},
"admin": {
"name": "hg13345"
"name": "ylhn15"
},
"facebook": {
"api": "162760697401847",
......
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