Fixed errors

This commit is contained in:
Angelo Gallarello 2019-01-02 22:51:00 +01:00
parent 8ad0da2109
commit 4d8b2029d2
7 changed files with 60 additions and 64 deletions

View file

@ -1,4 +1,4 @@
let rulesMainComponent = BlazeComponent.extendComponent({
const rulesMainComponent = BlazeComponent.extendComponent({
onCreated() {
this.rulesCurrentTab = new ReactiveVar('rulesList');
this.ruleName = new ReactiveVar('');
@ -10,9 +10,9 @@ let rulesMainComponent = BlazeComponent.extendComponent({
this.rulesCurrentTab.set('trigger');
},
sanitizeObject(obj){
Object.keys(obj).forEach(key =>{
if(obj[key] == "" || obj[key] == undefined){
obj[key] = "*";
Object.keys(obj).forEach((key) => {
if(obj[key] == '' || obj[key] == undefined){
obj[key] = '*';
}}
);
},
@ -49,25 +49,25 @@ let rulesMainComponent = BlazeComponent.extendComponent({
'click .js-goto-action' (event) {
event.preventDefault();
// Add user to the trigger
const username = $(event.currentTarget.offsetParent).find(".user-name").val();
const username = $(event.currentTarget.offsetParent).find('.user-name').val();
let trigger = this.triggerVar.get();
trigger["userId"] = "*";
trigger.userId = '*';
if(username != undefined ){
const userFound = Users.findOne({"username":username});
const userFound = Users.findOne({username});
if(userFound != undefined){
trigger["userId"] = userFound._id;
trigger.userId = userFound._id;
this.triggerVar.set(trigger);
}
}
// Sanitize trigger
trigger = this.triggerVar.get();
this.sanitizeObject(trigger)
this.sanitizeObject(trigger);
this.triggerVar.set(trigger);
this.setAction();
},
'click .js-show-user-field' (event) {
event.preventDefault();
$(event.currentTarget.offsetParent).find(".user-details").removeClass("hide-element");
$(event.currentTarget.offsetParent).find('.user-details').removeClass('hide-element');
},
'click .js-goto-rules' (event) {
event.preventDefault();
@ -95,4 +95,3 @@ let rulesMainComponent = BlazeComponent.extendComponent({
}).register('rulesMain');

View file

@ -1,7 +1,7 @@
BlazeComponent.extendComponent({
onCreated() {
this.provaVar = new ReactiveVar('');
this.currentPopupTriggerId = "def";
this.currentPopupTriggerId = 'def';
this.cardTitleFilters = {};
},
setNameFilter(name){
@ -11,9 +11,9 @@ BlazeComponent.extendComponent({
events() {
return [{
'click .js-open-card-title-popup'(event){
var funct = Popup.open('boardCardTitle');
let divId = $(event.currentTarget.parentNode.parentNode).attr("id");
console.log("current popup");
const funct = Popup.open('boardCardTitle');
const divId = $(event.currentTarget.parentNode.parentNode).attr('id');
console.log('current popup');
console.log(this.currentPopupTriggerId);
this.currentPopupTriggerId = divId;
funct.call(this, event);
@ -24,7 +24,7 @@ BlazeComponent.extendComponent({
const listName = this.find('#create-list-name').value;
const swimlaneName = this.find('#create-swimlane-name').value;
const boardId = Session.get('currentBoard');
const divId = $(event.currentTarget.parentNode).attr("id");
const divId = $(event.currentTarget.parentNode).attr('id');
const cardTitle = this.cardTitleFilters[divId];
// move to generic funciont
datas.triggerVar.set({
@ -105,9 +105,6 @@ BlazeComponent.extendComponent({
}).register('boardTriggers');
Template.boardCardTitlePopup.events({
submit(evt, tpl) {
const title = tpl.$('.js-card-filter-name').val().trim();

View file

@ -220,16 +220,16 @@ Utils = {
finalString += element.text().toLowerCase();
} else if (element.hasClass('user-details')) {
let username = element.find('input').val();
if(username == undefined || username == ""){
username = "*";
if(username == undefined || username == ''){
username = '*';
}
finalString += element.find('.trigger-text').text().toLowerCase()+ " " + username ;
finalString += `${element.find('.trigger-text').text().toLowerCase() } ${ username}`;
} else if (element.find('select').length > 0) {
finalString += element.find('select option:selected').text().toLowerCase();
} else if (element.find('input').length > 0) {
let inputvalue = element.find('input').val();
if(inputvalue == undefined || inputvalue == ""){
inputvalue = "*";
if(inputvalue == undefined || inputvalue == ''){
inputvalue = '*';
}
finalString += inputvalue;
}

View file

@ -135,7 +135,7 @@ RulesHelper = {
if(action.actionType === 'addSwimlane'){
Swimlanes.insert({
title: action.swimlaneName,
boardId
boardId,
});
}
if(action.actionType === 'addChecklistWithItems'){
@ -146,17 +146,17 @@ RulesHelper = {
}
}
if(action.actionType === 'createCard'){
let list = Lists.findOne({title:action.listName,boardId});
const list = Lists.findOne({title:action.listName, boardId});
let listId = '';
let swimlaneId = '';
let swimlane = Swimlanes.findOne({title:action.swimlaneName,boardId});
const swimlane = Swimlanes.findOne({title:action.swimlaneName, boardId});
if(list == undefined){
listId = '';
}else{
listId = list._id;
}
if(swimlane == undefined){
swimlaneId = Swimlanes.findOne({title:"Default",boardId})._id;
swimlaneId = Swimlanes.findOne({title:'Default', boardId})._id;
}else{
swimlaneId = swimlane._id;
}