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

@ -28,7 +28,7 @@ BlazeComponent.extendComponent({
actionId, actionId,
boardId, boardId,
}); });
}, },
'click .js-add-swimlane-action' (event) { 'click .js-add-swimlane-action' (event) {
const ruleName = this.data().ruleName.get(); const ruleName = this.data().ruleName.get();
@ -49,7 +49,7 @@ BlazeComponent.extendComponent({
actionId, actionId,
boardId, boardId,
}); });
}, },
'click .js-add-spec-move-action' (event) { 'click .js-add-spec-move-action' (event) {
const ruleName = this.data().ruleName.get(); const ruleName = this.data().ruleName.get();

View file

@ -25,7 +25,7 @@ BlazeComponent.extendComponent({
actionId, actionId,
boardId, boardId,
}); });
}, },
'click .js-add-checklist-action' (event) { 'click .js-add-checklist-action' (event) {
const ruleName = this.data().ruleName.get(); const ruleName = this.data().ruleName.get();

View file

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

View file

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

View file

@ -220,19 +220,19 @@ Utils = {
finalString += element.text().toLowerCase(); finalString += element.text().toLowerCase();
} else if (element.hasClass('user-details')) { } else if (element.hasClass('user-details')) {
let username = element.find('input').val(); let username = element.find('input').val();
if(username == undefined || username == ""){ if(username == undefined || username == ''){
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) { } else if (element.find('select').length > 0) {
finalString += element.find('select option:selected').text().toLowerCase(); finalString += element.find('select option:selected').text().toLowerCase();
} else if (element.find('input').length > 0) { } else if (element.find('input').length > 0) {
let inputvalue = element.find('input').val(); let inputvalue = element.find('input').val();
if(inputvalue == undefined || inputvalue == ""){ if(inputvalue == undefined || inputvalue == ''){
inputvalue = "*"; inputvalue = '*';
} }
finalString += inputvalue; finalString += inputvalue;
} }
// Add space // Add space
if (i !== length - 1) { if (i !== length - 1) {
finalString += ' '; finalString += ' ';

View file

@ -135,32 +135,32 @@ RulesHelper = {
if(action.actionType === 'addSwimlane'){ if(action.actionType === 'addSwimlane'){
Swimlanes.insert({ Swimlanes.insert({
title: action.swimlaneName, title: action.swimlaneName,
boardId boardId,
}); });
} }
if(action.actionType === 'addChecklistWithItems'){ if(action.actionType === 'addChecklistWithItems'){
const checkListId = Checklists.insert({'title':action.checklistName, 'cardId':card._id, 'sort':0}); const checkListId = Checklists.insert({'title':action.checklistName, 'cardId':card._id, 'sort':0});
const itemsArray = action.checklistItems.split(','); const itemsArray = action.checklistItems.split(',');
for(let i = 0;i <itemsArray.length;i++){ for(let i = 0; i <itemsArray.length; i++){
ChecklistItems.insert({title:itemsArray[i],checklistId:checkListId,cardId:card._id,'sort':0}); ChecklistItems.insert({title:itemsArray[i], checklistId:checkListId, cardId:card._id, 'sort':0});
} }
} }
if(action.actionType === 'createCard'){ if(action.actionType === 'createCard'){
let list = Lists.findOne({title:action.listName,boardId}); const list = Lists.findOne({title:action.listName, boardId});
let listId = ''; let listId = '';
let swimlaneId = ''; let swimlaneId = '';
let swimlane = Swimlanes.findOne({title:action.swimlaneName,boardId}); const swimlane = Swimlanes.findOne({title:action.swimlaneName, boardId});
if(list == undefined){ if(list == undefined){
listId = ''; listId = '';
}else{ }else{
listId = list._id; listId = list._id;
} }
if(swimlane == undefined){ if(swimlane == undefined){
swimlaneId = Swimlanes.findOne({title:"Default",boardId})._id; swimlaneId = Swimlanes.findOne({title:'Default', boardId})._id;
}else{ }else{
swimlaneId = swimlane._id; swimlaneId = swimlane._id;
} }
Cards.insert({title:action.cardName,listId,swimlaneId,sort:0,boardId}); Cards.insert({title:action.cardName, listId, swimlaneId, sort:0, boardId});
} }
}, },

View file

@ -1,57 +1,57 @@
TriggersDef = { TriggersDef = {
createCard:{ createCard:{
matchingFields: ['boardId', 'listName','userId','swimlaneName','cardTitle'], matchingFields: ['boardId', 'listName', 'userId', 'swimlaneName', 'cardTitle'],
}, },
moveCard:{ moveCard:{
matchingFields: ['boardId', 'listName', 'oldListName','userId','swimlaneName'], matchingFields: ['boardId', 'listName', 'oldListName', 'userId', 'swimlaneName'],
}, },
archivedCard:{ archivedCard:{
matchingFields: ['boardId','userId'], matchingFields: ['boardId', 'userId'],
}, },
restoredCard:{ restoredCard:{
matchingFields: ['boardId','userId'], matchingFields: ['boardId', 'userId'],
}, },
joinMember:{ joinMember:{
matchingFields: ['boardId', 'username','userId'], matchingFields: ['boardId', 'username', 'userId'],
}, },
unjoinMember:{ unjoinMember:{
matchingFields: ['boardId', 'username','userId'], matchingFields: ['boardId', 'username', 'userId'],
}, },
addChecklist:{ addChecklist:{
matchingFields: ['boardId', 'checklistName','userId'], matchingFields: ['boardId', 'checklistName', 'userId'],
}, },
removeChecklist:{ removeChecklist:{
matchingFields: ['boardId', 'checklistName','userId'], matchingFields: ['boardId', 'checklistName', 'userId'],
}, },
completeChecklist:{ completeChecklist:{
matchingFields: ['boardId', 'checklistName','userId'], matchingFields: ['boardId', 'checklistName', 'userId'],
}, },
uncompleteChecklist:{ uncompleteChecklist:{
matchingFields: ['boardId', 'checklistName','userId'], matchingFields: ['boardId', 'checklistName', 'userId'],
}, },
addedChecklistItem:{ addedChecklistItem:{
matchingFields: ['boardId', 'checklistItemName','userId'], matchingFields: ['boardId', 'checklistItemName', 'userId'],
}, },
removedChecklistItem:{ removedChecklistItem:{
matchingFields: ['boardId', 'checklistItemName','userId'], matchingFields: ['boardId', 'checklistItemName', 'userId'],
}, },
checkedItem:{ checkedItem:{
matchingFields: ['boardId', 'checklistItemName','userId'], matchingFields: ['boardId', 'checklistItemName', 'userId'],
}, },
uncheckedItem:{ uncheckedItem:{
matchingFields: ['boardId', 'checklistItemName','userId'], matchingFields: ['boardId', 'checklistItemName', 'userId'],
}, },
addAttachment:{ addAttachment:{
matchingFields: ['boardId','userId'], matchingFields: ['boardId', 'userId'],
}, },
deleteAttachment:{ deleteAttachment:{
matchingFields: ['boardId','userId'], matchingFields: ['boardId', 'userId'],
}, },
addedLabel:{ addedLabel:{
matchingFields: ['boardId', 'labelId','userId'], matchingFields: ['boardId', 'labelId', 'userId'],
}, },
removedLabel:{ removedLabel:{
matchingFields: ['boardId', 'labelId','userId'], matchingFields: ['boardId', 'labelId', 'userId'],
}, },
}; };