Commit 18dc30e1 authored by Christopher Fullarton's avatar Christopher Fullarton

Fix a bunch of gulp errors

parent 3ff15cc0
......@@ -34,6 +34,10 @@
"Npm": true,
"EasySearch": true,
"CardsetsIndex": true,
"kramed": true
"kramed": true,
"getUserLanguage": true,
"moment": true,
"ServiceConfiguration": true,
"ActiveRoute": true
}
}
import {Session } from 'meteor/session';
import {Session} from 'meteor/session';
//------------------------ GET LANGUAGE FROM USER
......
import {Meteor } from 'meteor/meteor';
import {Categories } from '../../api/categories.js';
import {Cardsets } from '../../api/cardsets.js';
import {Cards } from '../../api/cards.js';
// Check if user has permission to look at a cardset
Template.registerHelper("hasPermission", function () {
if (Roles.userIsInRole(Meteor.userId(), 'lecturer')) {
return this.owner === Meteor.userId() || this.visible === true || this.request === true;
}
else {
return this.owner === Meteor.userId() || this.visible === true;
}
});
// Check if user is owner of a cardset
Template.registerHelper("isOwnerCard", function () {
var owner;
if(this._id) {
owner = Cardsets.findOne(Router.current().params._id).owner;
}
return owner === Meteor.userId();
});
Template.registerHelper("isOwner", function () {
var owner = undefined;
if (this.owner) {
owner = this.owner;
}
else if (Template.parentData(1)) {
owner = Template.parentData(1).owner;
}
return owner === Meteor.userId();
});
// Returns the number of cards in a carddeck
Template.registerHelper("countCards", function (cardset_id) {
return Cardsets.findOne({_id: cardset_id}).quantity;
});
// Returns all Cards of a Carddeck
Template.registerHelper("getCards", function () {
return Cards.find({
cardset_id: this._id
});
});
// Returns the locale date
Template.registerHelper("getDate", function () {
return moment(this.date).locale(getUserLanguage()).format('LL');
});
// Returns the locale date
Template.registerHelper("getDateUpdated", function () {
return moment(this.dateUpdated).locale(getUserLanguage()).format('LL');
});
// Returns the locale date with time
Template.registerHelper("getTimestamp", function () {
return moment(this.date).locale(getUserLanguage()).format('LLLL');
});
// Returns all Categories
Template.registerHelper("getCategories", function () {
return Categories.find({}, {
sort: {
_id: 1
}
});
});
// Return the name of a Category
Template.registerHelper("getCategory", function (value) {
if(value !== null)
{
var id = value.toString();
if (id.length === 1) {
id = "0" + id;
}
var category = Categories.findOne(id);
if (category !== undefined) {
return category.name;
}
}
});
// Returns if user is deleted or not
Template.registerHelper("userExists", function (userDeleted) {
if (userDeleted === true) {
return false;
} else {
return true;
}
});
// i18n type notifications
Template.registerHelper("getType", function (type) {
if (type === 'Gemeldeter Benutzer') {
type = TAPi18n.__('notifications.reporteduser');
} else if (type === 'Gemeldeter Kartensatz') {
type = TAPi18n.__('notifications.reportedcardset');
} else if (type === 'Adminbenachrichtigung (Beschwerde Benutzer)') {
type = TAPi18n.__('notifications.reporteduseradmin');
} else if (type === 'Adminbenachrichtigung (Beschwerde Kartensatz)') {
type = TAPi18n.__('notifications.reportedcardsetadmin');
} else if (type === 'Dozenten-Anfrage') {
type = TAPi18n.__('notifications.lecturer');
}
return type;
});
import {Meteor} from 'meteor/meteor';
import {Categories} from '../../api/categories.js';
import {Cardsets} from '../../api/cardsets.js';
import {Cards} from '../../api/cards.js';
// Check if user has permission to look at a cardset
Template.registerHelper("hasPermission", function () {
if (Roles.userIsInRole(Meteor.userId(), 'lecturer')) {
return this.owner === Meteor.userId() || this.visible === true || this.request === true;
} else {
return this.owner === Meteor.userId() || this.visible === true;
}
});
// Check if user is owner of a cardset
Template.registerHelper("isOwnerCard", function () {
var owner;
if (this._id) {
owner = Cardsets.findOne(Router.current().params._id).owner;
}
return owner === Meteor.userId();
});
Template.registerHelper("isOwner", function () {
var owner;
if (this.owner) {
owner = this.owner;
} else if (Template.parentData(1)) {
owner = Template.parentData(1).owner;
}
return owner === Meteor.userId();
});
// Returns the number of cards in a carddeck
Template.registerHelper("countCards", function (cardset_id) {
return Cardsets.findOne({_id: cardset_id}).quantity;
});
// Returns all Cards of a Carddeck
Template.registerHelper("getCards", function () {
return Cards.find({
cardset_id: this._id
});
});
// Returns the locale date
Template.registerHelper("getDate", function () {
return moment(this.date).locale(getUserLanguage()).format('LL');
});
// Returns the locale date
Template.registerHelper("getDateUpdated", function () {
return moment(this.dateUpdated).locale(getUserLanguage()).format('LL');
});
// Returns the locale date with time
Template.registerHelper("getTimestamp", function () {
return moment(this.date).locale(getUserLanguage()).format('LLLL');
});
// Returns all Categories
Template.registerHelper("getCategories", function () {
return Categories.find({}, {
sort: {
_id: 1
}
});
});
// Return the name of a Category
Template.registerHelper("getCategory", function (value) {
if (value !== null) {
var id = value.toString();
if (id.length === 1) {
id = "0" + id;
}
var category = Categories.findOne(id);
if (category !== undefined) {
return category.name;
}
}
});
// Returns if user is deleted or not
Template.registerHelper("userExists", function (userDeleted) {
return userDeleted !== true;
});
// i18n type notifications
Template.registerHelper("getType", function (type) {
if (type === 'Gemeldeter Benutzer') {
type = TAPi18n.__('notifications.reporteduser');
} else if (type === 'Gemeldeter Kartensatz') {
type = TAPi18n.__('notifications.reportedcardset');
} else if (type === 'Adminbenachrichtigung (Beschwerde Benutzer)') {
type = TAPi18n.__('notifications.reporteduseradmin');
} else if (type === 'Adminbenachrichtigung (Beschwerde Kartensatz)') {
type = TAPi18n.__('notifications.reportedcardsetadmin');
} else if (type === 'Dozenten-Anfrage') {
type = TAPi18n.__('notifications.lecturer');
}
return type;
});
import {Cardsets } from '../../api/cardsets.js';
import {Cards } from '../../api/cards.js';
import {Categories } from '../../api/categories.js';
Router.route('/', function () {
this.redirect('home');
});
Router.route('/admin', function () {
this.redirect('admin_dashboard');
});
Router.configure({
layoutTemplate: 'admin_main'
});
Router.configure({
layoutTemplate: 'main'
});
Router.route('/home', {
name: 'home',
template: 'welcome'
});
Router.route('impressum');
Router.route('agb');
Router.route('datenschutz');
Router.route('/created', {
name: 'created',
template: 'cardsets'
});
Router.route('/learned', {
name: 'learned',
template: 'cardsets'
});
Router.route('/cardset', function () {
this.redirect('created');
});
Router.route('/cardset/:_id', {
name: 'cardsetdetailsid',
template: 'cardset',
data: function () {
var currentCardset = this.params._id;
return Cardsets.findOne({_id: currentCardset});
}
});
Router.route('/cardsetlist', function () {
this.redirect('created');
});
Router.route('/cardsetlist/:_id', {
name: 'cardsetlistid',
template: 'cardset',
data: function () {
var currentCardset = this.params._id;
return Cardsets.findOne({_id: currentCardset});
}
});
Router.route('/cardset/:_id/newcard', {
name: 'newCard',
data: function () {
var currentCardset = this.params._id;
return Cardsets.findOne({_id: currentCardset});
}
});
Router.route('/cardset/:_id/editcard/:cardid', {
name: 'editCard',
data: function () {
var currentCard = this.params.cardid;
return Cards.findOne({_id: currentCard});
}
});
Router.route('pool');
Router.route('/pool/:_id', {
name: 'category',
template: 'category',
data: function () {
var currentPool = this.params._id;
return Categories.findOne({_id: currentPool});
}
});
Router.route('/box/:_id', {
name: 'box',
template: 'box',
data: function () {
var currentBox = this.params._id;
return Cardsets.findOne({_id: currentBox});
}
});
Router.route('/memo/:_id', {
name: 'memo',
template: 'memo',
data: function () {
var currentMemo = this.params._id;
return Cardsets.findOne({_id: currentMemo});
}
});
Router.route('/profile/:_id/overview', {
name: 'profileOverview',
template: 'profile'
});
Router.route('/profile/:_id/billing', {
name: 'profileBilling',
template: 'profile'
});
Router.route('/profile/:_id/membership', {
name: 'profileMembership',
template: 'profile'
});
Router.route('/profile/:_id/notifications', {
name: 'profileNotifications',
template: 'profile'
});
Router.route('/profile/:_id/settings', {
name: 'profileSettings',
template: 'profile'
});
Router.route('/profile/:_id/requests', {
name: 'profileRequests',
template: 'profile'
});
Router.route('/admin/dashboard', {
name: 'admin_dashboard',
template: 'admin_dashboard',
layoutTemplate: 'admin_main'
});
Router.route('/admin/cardsets', {
name: 'admin_cardsets',
template: 'admin_cardsets',
layoutTemplate: 'admin_main'
});
Router.route('/admin/cardset/:_id', {
name: 'admin_cardset',
template: 'admin_cardset',
layoutTemplate: 'admin_main',
data: function () {
var currentCardset = this.params._id;
return Cardsets.findOne({_id: currentCardset});
}
});
Router.route('/admin/cards', {
name: 'adminCards',
template: 'admin_cards',
layoutTemplate: 'admin_main'
});
Router.route('/admin/card/:_id', {
name: 'adminCard',
template: 'admin_card',
layoutTemplate: 'admin_main',
data: function () {
var currentCard = this.params._id;
return Cards.findOne({_id: currentCard});
}
});
Router.route('/admin/users', {
name: 'admin_users',
template: 'admin_users',
layoutTemplate: 'admin_main'
});
Router.route('/admin/user/:_id', {
name: 'admin_user',
template: 'admin_user',
layoutTemplate: 'admin_main',
data: function () {
var currentUser = this.params._id;
return Meteor.users.findOne({_id: currentUser});
}
});
Router.route('/admin/notifications', {
name: 'admin_notifications',
template: 'admin_notifications',
layoutTemplate: 'admin_main'
});
var isSignedIn = function () {
if (!(Meteor.user() || Meteor.loggingIn())) {
Router.go('home');
} else {
this.next();
}
};
var goToCreated = function () {
if (Meteor.user()) {
Router.go('created');
} else {
this.next();
}
};
Router.onBeforeAction(isSignedIn, {
except: ['home', 'impressum', 'agb', 'datenschutz']
});
Router.onBeforeAction(goToCreated, {
only: ['home']
});
import {Cardsets} from '../../api/cardsets.js';
import {Cards} from '../../api/cards.js';
import {Categories} from '../../api/categories.js';
Router.route('/', function () {
this.redirect('home');
});
Router.route('/admin', function () {
this.redirect('admin_dashboard');
});
Router.configure({
layoutTemplate: 'admin_main'
});
Router.configure({
layoutTemplate: 'main'
});
Router.route('/home', {
name: 'home',
template: 'welcome'
});
Router.route('impressum');
Router.route('agb');
Router.route('datenschutz');
Router.route('/created', {
name: 'created',
template: 'cardsets'
});
Router.route('/learned', {
name: 'learned',
template: 'cardsets'
});
Router.route('/cardset', function () {
this.redirect('created');
});
Router.route('/cardset/:_id', {
name: 'cardsetdetailsid',
template: 'cardset',
data: function () {
var currentCardset = this.params._id;
return Cardsets.findOne({_id: currentCardset});
}
});
Router.route('/cardsetlist', function () {
this.redirect('created');
});
Router.route('/cardsetlist/:_id', {
name: 'cardsetlistid',
template: 'cardset',
data: function () {
var currentCardset = this.params._id;
return Cardsets.findOne({_id: currentCardset});
}
});
Router.route('/cardset/:_id/newcard', {
name: 'newCard',
data: function () {
var currentCardset = this.params._id;
return Cardsets.findOne({_id: currentCardset});
}
});
Router.route('/cardset/:_id/editcard/:cardid', {
name: 'editCard',
data: function () {
var currentCard = this.params.cardid;
return Cards.findOne({_id: currentCard});
}
});
Router.route('pool');
Router.route('/pool/:_id', {
name: 'category',
template: 'category',
data: function () {
var currentPool = this.params._id;
return Categories.findOne({_id: currentPool});
}
});
Router.route('/box/:_id', {
name: 'box',
template: 'box',
data: function () {
var currentBox = this.params._id;
return Cardsets.findOne({_id: currentBox});
}
});
Router.route('/memo/:_id', {
name: 'memo',
template: 'memo',
data: function () {
var currentMemo = this.params._id;
return Cardsets.findOne({_id: currentMemo});
}
});
Router.route('/profile/:_id/overview', {
name: 'profileOverview',
template: 'profile'
});
Router.route('/profile/:_id/billing', {
name: 'profileBilling',
template: 'profile'
});
Router.route('/profile/:_id/membership', {
name: 'profileMembership',
template: 'profile'
});
Router.route('/profile/:_id/notifications', {
name: 'profileNotifications',
template: 'profile'
});
Router.route('/profile/:_id/settings', {
name: 'profileSettings',
template: 'profile'
});
Router.route('/profile/:_id/requests', {
name: 'profileRequests',
template: 'profile'
});
Router.route('/admin/dashboard', {
name: 'admin_dashboard',
template: 'admin_dashboard',
layoutTemplate: 'admin_main'
});
Router.route('/admin/cardsets', {
name: 'admin_cardsets',
template: 'admin_cardsets',
layoutTemplate: 'admin_main'
});
Router.route('/admin/cardset/:_id', {
name: 'admin_cardset',
template: 'admin_cardset',
layoutTemplate: 'admin_main',
data: function () {
var currentCardset = this.params._id;
return Cardsets.findOne({_id: currentCardset});
}
});
Router.route('/admin/cards', {
name: 'adminCards',
template: 'admin_cards',
layoutTemplate: 'admin_main'
});
Router.route('/admin/card/:_id', {
name: 'adminCard',
template: 'admin_card',
layoutTemplate: 'admin_main',
data: function () {
var currentCard = this.params._id;
return Cards.findOne({_id: currentCard});
}
});
Router.route('/admin/users', {
name: 'admin_users',
template: 'admin_users',
layoutTemplate: 'admin_main'
});
Router.route('/admin/user/:_id', {
name: 'admin_user',
template: 'admin_user',
layoutTemplate: 'admin_main',
data: function () {
var currentUser = this.params._id;
return Meteor.users.findOne({_id: currentUser});
}
});
Router.route('/admin/notifications', {
name: 'admin_notifications',
template: 'admin_notifications',
layoutTemplate: 'admin_main'
});
var isSignedIn = function () {
if (!(Meteor.user() || Meteor.loggingIn())) {
Router.go('home');
} else {
this.next();
}
};
var goToCreated = function () {
if (Meteor.user()) {
Router.go('created');
} else {
this.next();
}
};
Router.onBeforeAction(isSignedIn, {
except: [
'home',
'impressum',
'agb',
'datenschutz'
]
});
Router.onBeforeAction(goToCreated, {
only: ['home']
});
ServiceConfiguration.configurations.remove({
service: 'facebook'
});
ServiceConfiguration.configurations.remove({
service: 'twitter'
});
ServiceConfiguration.configurations.remove({
service: 'google'
});
ServiceConfiguration.configurations.insert({
service: 'facebook',
appId: Meteor.settings.facebook.api,
secret: Meteor.settings.facebook.secret
});
ServiceConfiguration.configurations.insert({
service: 'twitter',
consumerKey: Meteor.settings.twitter.api,
secret: Meteor.settings.twitter.secret
});
ServiceConfiguration.configurations.insert({
service: 'google',
clientId: Meteor.settings.google.api,
secret: Meteor.settings.google.secret
});
Meteor.users.after.insert(function (userId, doc) {
if(doc.services.cas)
{
if(doc.services.cas.id === Meteor.settings