mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
UI for rules list
This commit is contained in:
parent
d5870472fb
commit
f63482b587
19 changed files with 256 additions and 2 deletions
BIN
.DS_Store
vendored
Normal file
BIN
.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -6,7 +6,7 @@
|
|||
meteor-base@1.2.0
|
||||
|
||||
# Build system
|
||||
ecmascript@0.9.0
|
||||
ecmascript
|
||||
stylus@2.513.13
|
||||
standard-minifier-css@1.3.5
|
||||
standard-minifier-js@2.2.0
|
||||
|
|
|
|||
22
RASD.txt
Normal file
22
RASD.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Rules
|
||||
|
||||
Triggers
|
||||
|
||||
Board: create card, card moved to, card moved from
|
||||
Card: [label, attachement, person ] added/removed, name starts with
|
||||
Checklists : checklist added/removed, check item checked/unchecked, checklist completed
|
||||
|
||||
Actions
|
||||
Board: move card to list, move to top/bottom, archive/unarchive
|
||||
Card: [label, attachement, person ] add/remove, set title/description
|
||||
Checklists : checklist add/remove, check/uncheck item
|
||||
Mail: send email to
|
||||
|
||||
Calendar
|
||||
|
||||
Triggers
|
||||
Recurrent day/month/year/day of the week
|
||||
|
||||
Actions
|
||||
Board: create card with [title, description, label, checklist, person, date]
|
||||
|
||||
|
|
@ -88,6 +88,10 @@ template(name="boardHeaderBar")
|
|||
a.board-header-btn-close.js-filter-reset(title="{{_ 'filter-clear'}}")
|
||||
i.fa.fa-times-thin
|
||||
|
||||
a.board-header-btn.js-open-rules-view(title="{{_ 'rules'}}")
|
||||
i.fa.fa-cutlery
|
||||
span {{_ 'rules'}}
|
||||
|
||||
a.board-header-btn.js-open-search-view(title="{{_ 'search'}}")
|
||||
i.fa.fa-search
|
||||
span {{_ 'search'}}
|
||||
|
|
@ -290,6 +294,11 @@ template(name="boardChangeTitlePopup")
|
|||
textarea.js-board-desc= description
|
||||
input.primary.wide(type="submit" value="{{_ 'rename'}}")
|
||||
|
||||
template(name="boardCreateRulePopup")
|
||||
p {{_ 'close-board-pop'}}
|
||||
button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
|
||||
|
||||
|
||||
template(name="archiveBoardPopup")
|
||||
p {{_ 'close-board-pop'}}
|
||||
button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,9 @@ BlazeComponent.extendComponent({
|
|||
'click .js-open-search-view'() {
|
||||
Sidebar.setView('search');
|
||||
},
|
||||
'click .js-open-rules-view'() {
|
||||
Modal.open('rules');
|
||||
},
|
||||
'click .js-multiselection-activate'() {
|
||||
const currentCard = Session.get('currentCard');
|
||||
MultiSelection.activate();
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ BlazeComponent.extendComponent({
|
|||
evt.preventDefault();
|
||||
Utils.goBoardId(Session.get('currentBoard'));
|
||||
}
|
||||
console.log(evt)
|
||||
|
||||
},
|
||||
|
||||
cardIsSelected() {
|
||||
|
|
|
|||
27
client/components/rules/rules.jade
Normal file
27
client/components/rules/rules.jade
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
template(name="rules")
|
||||
.rules
|
||||
h2
|
||||
i.fa.fa-cutlery
|
||||
| Project rules
|
||||
|
||||
ul.rules-lists
|
||||
each triggers
|
||||
li.rules-lists-item
|
||||
p
|
||||
= toId
|
||||
div.rules-btns-group
|
||||
button
|
||||
i.fa.fa-eye
|
||||
| View rule
|
||||
button
|
||||
i.fa.fa-trash-o
|
||||
| Delete rule
|
||||
else
|
||||
li.no-items-message No rules
|
||||
div.rules-add
|
||||
button
|
||||
i.fa.fa-plus
|
||||
| Add rule
|
||||
input(type=text)
|
||||
|
||||
|
||||
25
client/components/rules/rules.js
Normal file
25
client/components/rules/rules.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.subscribe('allTriggers');
|
||||
},
|
||||
|
||||
triggers() {
|
||||
return Triggers.find({});
|
||||
},
|
||||
events() {
|
||||
return [{'click .js-add-trigger'(event) {
|
||||
|
||||
event.preventDefault();
|
||||
const toName = this.find('#toName').value;
|
||||
const fromName = this.find('#fromName').value;
|
||||
const toId = Triggers.findOne().findList(toName)._id;
|
||||
const fromId = Triggers.findOne().findList(fromName)._id;
|
||||
console.log(toId);
|
||||
console.log(fromId);
|
||||
Triggers.insert({group: "cards", activityType: "moveCard","fromId":fromId,"toId":toId });
|
||||
|
||||
|
||||
},}];
|
||||
},
|
||||
}).register('rules');
|
||||
34
client/components/rules/rules.styl
Normal file
34
client/components/rules/rules.styl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
.rules-list
|
||||
overflow-y: scroll
|
||||
.rules-lists-item
|
||||
display: block
|
||||
position: relative
|
||||
overflow: auto
|
||||
p
|
||||
display: inline-block
|
||||
float: left
|
||||
margin: revert
|
||||
|
||||
.rules-btns-group
|
||||
position: absolute
|
||||
right: 0
|
||||
top: 50%
|
||||
transform: translateY(-50%)
|
||||
button
|
||||
margin: auto
|
||||
.rules-add
|
||||
display: block
|
||||
overflow: auto
|
||||
margin-top: 25px
|
||||
margin-bottom: 5px
|
||||
input
|
||||
display: inline-block
|
||||
float: right
|
||||
margin: auto
|
||||
margin-right: 10px
|
||||
button
|
||||
display: inline-block
|
||||
float: right
|
||||
margin: auto
|
||||
|
||||
|
||||
|
|
@ -83,6 +83,7 @@ window.Popup = new class {
|
|||
// our internal dependency, and since we just changed the top element of
|
||||
// our internal stack, the popup will be updated with the new data.
|
||||
if (!self.isOpen()) {
|
||||
console.log(self.template)
|
||||
self.current = Blaze.renderWithData(self.template, () => {
|
||||
self._dep.depend();
|
||||
return { ...self._getTopStack(), stack: self._stack };
|
||||
|
|
|
|||
|
|
@ -362,6 +362,7 @@
|
|||
"restore": "Restore",
|
||||
"save": "Save",
|
||||
"search": "Search",
|
||||
"rules": "Rules",
|
||||
"search-cards": "Search from card titles and descriptions on this board",
|
||||
"search-example": "Text to search for?",
|
||||
"select-color": "Select Color",
|
||||
|
|
|
|||
BIN
models/.DS_Store
vendored
Normal file
BIN
models/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -806,3 +806,4 @@ if (Meteor.isServer) {
|
|||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
38
models/rules.js
Normal file
38
models/rules.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
Rules = new Mongo.Collection('rules');
|
||||
|
||||
Rules.attachSchema(new SimpleSchema({
|
||||
title: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
}));
|
||||
|
||||
Rules.mutations({
|
||||
rename(description) {
|
||||
return { $set: { description } };
|
||||
},
|
||||
});
|
||||
|
||||
Rules.allow({
|
||||
update: function () {
|
||||
// add custom authentication code here
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
if (Meteor.isServer) {
|
||||
Meteor.startup(() => {
|
||||
const rules = Rules.findOne({});
|
||||
if(!rules){
|
||||
Rules.insert({title: "regola1", description: "bella"});
|
||||
Rules.insert({title: "regola2", description: "bella2"});
|
||||
}
|
||||
});
|
||||
}
|
||||
74
models/triggers.js
Normal file
74
models/triggers.js
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
Triggers = new Mongo.Collection('triggers');
|
||||
|
||||
|
||||
|
||||
Triggers.mutations({
|
||||
rename(description) {
|
||||
return { $set: { description } };
|
||||
},
|
||||
});
|
||||
|
||||
Triggers.allow({
|
||||
update: function () {
|
||||
// add custom authentication code here
|
||||
return true;
|
||||
},
|
||||
insert: function () {
|
||||
// add custom authentication code here
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Triggers.helpers({
|
||||
fromList() {
|
||||
return Lists.findOne(this.fromId);
|
||||
},
|
||||
|
||||
toList() {
|
||||
return Lists.findOne(this.toId);
|
||||
},
|
||||
|
||||
findList(title) {
|
||||
return Lists.findOne({title:title});
|
||||
},
|
||||
|
||||
labels() {
|
||||
const boardLabels = this.board().labels;
|
||||
const cardLabels = _.filter(boardLabels, (label) => {
|
||||
return _.contains(this.labelIds, label._id);
|
||||
});
|
||||
return cardLabels;
|
||||
}});
|
||||
|
||||
|
||||
|
||||
if (Meteor.isServer) {
|
||||
Meteor.startup(() => {
|
||||
const rules = Triggers.findOne({});
|
||||
if(!rules){
|
||||
Triggers.insert({group: "cards", activityType: "moveCard","fromId":-1,"toId":-1 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Activities.after.insert((userId, doc) => {
|
||||
const activity = Activities._transform(doc);
|
||||
const matchedTriggers = Triggers.find({activityType: activity.activityType,fromId:activity.oldListId,toId:activity.listId})
|
||||
if(matchedTriggers.count() > 0){
|
||||
const card = activity.card();
|
||||
const oldTitle = card.title;
|
||||
const fromListTitle = activity.oldList().title;
|
||||
Cards.direct.update({_id: card._id, listId: card.listId, boardId: card.boardId, archived: false},
|
||||
{$set: {title: "[From "+fromListTitle +"] "+ oldTitle}});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
server/.DS_Store
vendored
Normal file
BIN
server/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
server/lib/.DS_Store
vendored
Normal file
BIN
server/lib/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -14,3 +14,6 @@ allowIsBoardMemberByCard = function(userId, card) {
|
|||
const board = card.board();
|
||||
return board && board.hasMember(userId);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
14
server/publications/rules.js
Normal file
14
server/publications/rules.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Meteor.publish('rules', (ruleId) => {
|
||||
check(ruleId, String);
|
||||
return Rules.find({ _id: ruleId });
|
||||
});
|
||||
|
||||
|
||||
Meteor.publish('allRules', () => {
|
||||
return Rules.find({});
|
||||
});
|
||||
|
||||
|
||||
Meteor.publish('allTriggers', () => {
|
||||
return Triggers.find({});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue