Merge remote-tracking branch 'remotes/origin/master' into feature-meteor-files

This commit is contained in:
Lauri Ojansivu 2022-03-01 21:09:55 +02:00
commit b378bb55ac
96 changed files with 559 additions and 25 deletions

View file

@ -53,6 +53,19 @@ Template.userFormsLayout.onCreated(function() {
$('.at-pwd-form').hide();
}
});
Meteor.call('isDisableRegistration', (_, result) => {
if (result) {
$('.at-signup-link').hide();
}
});
Meteor.call('isDisableForgotPassword', (_, result) => {
if (result) {
$('.at-pwd-link').hide();
}
});
});
Template.userFormsLayout.onRendered(() => {

View file

@ -63,6 +63,11 @@ template(name="webhookSettings")
template(name="general")
ul#registration-setting.setting-detail
li
a.flex.js-toggle-forgot-password
.materialCheckBox(class="{{#if currentSetting.disableForgotPassword}}is-checked{{/if}}")
span {{_ 'disable-forgot-password'}}
li
a.flex.js-toggle-registration
.materialCheckBox(class="{{#if currentSetting.disableRegistration}}is-checked{{/if}}")

View file

@ -4,6 +4,7 @@ BlazeComponent.extendComponent({
onCreated() {
this.error = new ReactiveVar('');
this.loading = new ReactiveVar(false);
this.forgotPasswordSetting = new ReactiveVar(true);
this.generalSetting = new ReactiveVar(true);
this.emailSetting = new ReactiveVar(false);
this.accountSetting = new ReactiveVar(false);
@ -56,6 +57,14 @@ BlazeComponent.extendComponent({
},
);
},
toggleForgotPassword() {
this.setLoading(true);
const forgotPasswordClosed = this.currentSetting().disableForgotPassword;
Settings.update(Settings.findOne()._id, {
$set: { disableForgotPassword: !forgotPasswordClosed },
});
this.setLoading(false);
},
toggleRegistration() {
this.setLoading(true);
const registrationClosed = this.currentSetting().disableRegistration;
@ -84,6 +93,7 @@ BlazeComponent.extendComponent({
$('.side-menu li.active').removeClass('active');
target.parent().addClass('active');
const targetID = target.data('id');
this.forgotPasswordSetting.set('forgot-password-setting' === targetID);
this.generalSetting.set('registration-setting' === targetID);
this.emailSetting.set('email-setting' === targetID);
this.accountSetting.set('account-setting' === targetID);
@ -267,6 +277,7 @@ BlazeComponent.extendComponent({
events() {
return [
{
'click a.js-toggle-forgot-password': this.toggleForgotPassword,
'click a.js-toggle-registration': this.toggleRegistration,
'click a.js-toggle-tls': this.toggleTLS,
'click a.js-setting-menu': this.switchMenu,

View file

@ -8,7 +8,7 @@ function getHoveredCardId() {
}
function getSelectedCardId() {
return Session.get('selectedCard') || getHoveredCardId();
return Session.get('currentCard') || Session.get('selectedCard') || getHoveredCardId();
}
Mousetrap.bind('?', () => {
@ -68,6 +68,67 @@ Mousetrap.bind(['down', 'up'], (evt, key) => {
}
});
numbArray = _.range(1,10).map(x => 'shift+'+String(x))
Mousetrap.bind(numbArray, (evt, key) => {
num = parseInt(key.substr(6, key.length));
const currentUserId = Meteor.userId();
if (currentUserId === null) {
return;
}
const currentBoardId = Session.get('currentBoard');
board = Boards.findOne(currentBoardId);
labels = board.labels;
if(MultiSelection.isActive())
{
const cardIds = MultiSelection.getSelectedCardIds();
for (const cardId of cardIds)
{
card = Cards.findOne(cardId);
if(num <= board.labels.length)
{
card.removeLabel(labels[num-1]["_id"]);
}
}
}
});
numArray = _.range(1,10).map(x => String(x))
Mousetrap.bind(numArray, (evt, key) => {
num = parseInt(key);
const currentUserId = Meteor.userId();
const currentBoardId = Session.get('currentBoard');
if (currentUserId === null) {
return;
}
board = Boards.findOne(currentBoardId);
labels = board.labels;
if(MultiSelection.isActive() && Meteor.user().isBoardMember())
{
const cardIds = MultiSelection.getSelectedCardIds();
for (const cardId of cardIds)
{
card = Cards.findOne(cardId);
if(num <= board.labels.length)
{
card.addLabel(labels[num-1]["_id"]);
}
}
return;
}
const cardId = getSelectedCardId();
if (!cardId) {
return;
}
if (Meteor.user().isBoardMember()) {
const card = Cards.findOne(cardId);
if(num <= board.labels.length)
{
card.toggleLabel(labels[num-1]["_id"]);
}
}
});
Mousetrap.bind('space', evt => {
const cardId = getSelectedCardId();
if (!cardId) {
@ -154,5 +215,13 @@ Template.keyboardShortcuts.helpers({
keys: ['c'],
action: 'archive-card',
},
{
keys: ['number keys 1-9'],
action: 'toggle-labels'
},
{
keys: ['shift + number keys 1-9'],
action: 'remove-labels-multiselect'
},
],
});

View file

@ -83,6 +83,9 @@ MultiSelection = {
isEmpty() {
return this.count() === 0;
},
getSelectedCardIds(){
return this._selectedCards.curValue;
},
activate() {
if (!this.isActive()) {