Merge branch 'nztqa-improve-announcement' into devel

Site Wide Announcement. Thanks to nztqa !
This commit is contained in:
Lauri Ojansivu 2017-10-01 10:44:42 +03:00
commit ff5e88fca3
46 changed files with 241 additions and 9 deletions

View file

@ -130,6 +130,7 @@
"Authentication": true,
"Integrations": true,
"HTTP": true,
"AccountSettings": true
"AccountSettings": true,
"Announcements": true
}
}

View file

@ -2,7 +2,8 @@
This release adds the following new features:
* [Slider for Comments only in activity feed](https://github.com/wekan/wekan/issues/1247).
* [Slider for Comments only in activity feed](https://github.com/wekan/wekan/issues/1247);
* [Site Wide Announcement](https://github.com/wekan/wekan/pull/1260).
and fixes the following bugs:

View file

@ -83,10 +83,8 @@ BlazeComponent.extendComponent({
evt.stopImmediatePropagation();
evt.preventDefault();
Utils.goBoardId(Session.get('currentBoard'));
} else {
if (!Meteor.user().hasHiddenSystemMessages()) {
$('.toggle-switch').prop('checked', false);
}
} else if (!Meteor.user().hasHiddenSystemMessages()) {
$('.toggle-switch').prop('checked', false);
}
},

View file

@ -49,6 +49,13 @@ template(name="header")
if appIsOffline
+offlineWarning
if hasAnnouncement
.announcement
p
i.fa.fa-bullhorn
| #{announcement}
i.fa.fa-times-circle.js-close-announcement
template(name="offlineWarning")
.offline-warning
p

View file

@ -10,8 +10,22 @@ Template.header.helpers({
appIsOffline() {
return !Meteor.status().connected;
},
hasAnnouncement() {
const announcements = Announcements.findOne();
return announcements && announcements.enabled;
},
announcement() {
$('.announcement').show();
const announcements = Announcements.findOne();
return announcements && announcements.body;
},
});
Template.header.events({
'click .js-create-board': Popup.open('headerBarCreateBoard'),
'click .js-close-announcement'() {
$('.announcement').hide();
},
});

View file

@ -197,6 +197,7 @@
li
height: 28px
.announcement,
.offline-warning
width: 100%
text-align: center

View file

@ -14,6 +14,8 @@ template(name="setting")
a.js-setting-menu(data-id="email-setting") {{_ 'email'}}
li
a.js-setting-menu(data-id="account-setting") {{_ 'accounts'}}
li
a.js-setting-menu(data-id="announcement-setting") {{_ 'admin-announcement'}}
.main-body
if loading.get
+spinner
@ -23,6 +25,8 @@ template(name="setting")
+email
else if accountSetting.get
+accountSettings
else if announcementSetting.get
+announcementSettings
template(name="general")
ul#registration-setting.setting-detail
@ -96,3 +100,19 @@ template(name='accountSettings')
span {{_ 'no'}}
li
button.js-accounts-save.primary {{_ 'save'}}
template(name='announcementSettings')
ul#announcement-setting.setting-detail
li
a.flex.js-toggle-activemessage
.materialCheckBox(class="{{#if currentSetting.enabled}}is-checked{{/if}}")
span {{_ 'admin-announcement-active'}}
li
.admin-announcement(class="{{#if currentSetting.enabled}}{{else}}hide{{/if}}")
ul
li
.title {{_ 'admin-announcement-title'}}
textarea#admin-announcement.form-control= currentSetting.body
li
button.js-announcement-save.primary {{_ 'save'}}

View file

@ -1,6 +1,7 @@
Meteor.subscribe('setting');
Meteor.subscribe('mailServer');
Meteor.subscribe('accountSettings');
Meteor.subscribe('announcements');
BlazeComponent.extendComponent({
onCreated() {
@ -9,6 +10,7 @@ BlazeComponent.extendComponent({
this.generalSetting = new ReactiveVar(true);
this.emailSetting = new ReactiveVar(false);
this.accountSetting = new ReactiveVar(false);
this.announcementSetting = new ReactiveVar(false);
},
setError(error) {
@ -65,6 +67,7 @@ BlazeComponent.extendComponent({
this.generalSetting.set('registration-setting' === targetID);
this.emailSetting.set('email-setting' === targetID);
this.accountSetting.set('account-setting' === targetID);
this.announcementSetting.set('announcement-setting' === targetID);
}
},
@ -152,3 +155,45 @@ BlazeComponent.extendComponent({
}];
},
}).register('accountSettings');
BlazeComponent.extendComponent({
onCreated() {
this.loading = new ReactiveVar(false);
},
setLoading(w) {
this.loading.set(w);
},
currentSetting(){
return Announcements.findOne();
},
saveMessage() {
const message = $('#admin-announcement').val().trim();
Announcements.update(Announcements.findOne()._id, {
$set: { 'body': message },
});
},
toggleActive(){
this.setLoading(true);
const isActive = this.currentSetting().enabled;
Announcements.update(Announcements.findOne()._id, {
$set:{ 'enabled': !isActive},
});
this.setLoading(false);
if(isActive){
$('.admin-announcement').slideUp();
}else{
$('.admin-announcement').slideDown();
}
},
events() {
return [{
'click a.js-toggle-activemessage': this.toggleActive,
'click button.js-announcement-save': this.saveMessage,
}];
},
}).register('announcementSettings');

View file

@ -61,10 +61,11 @@
.is-checked
border-bottom: 2px solid #2980b9;
border-right: 2px solid #2980b9;
span
span
padding: 0 0.5rem
.admin-announcement,
.invite-people
padding-left 20px;
li

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "الأعضاء",
"admin": "المدير",
"admin-desc": "إمكانية مشاهدة و تعديل و حذف أعضاء ، و تعديل إعدادات اللوحة أيضا.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "كل اللوحات",
"and-n-other-card": "And __count__ other بطاقة",
"and-n-other-card_plural": "And __count__ other بطاقات",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Izili",
"admin": "Merour",
"admin-desc": "Can view and edit cards, remove members, and change settings for the board.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "All boards",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Membres",
"admin": "Administrador",
"admin-desc": "Pots veure i editar fitxes, eliminar membres, i canviar la configuració del tauler",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Tots els taulers",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Členové",
"admin": "Administrátor",
"admin-desc": "Může zobrazovat a upravovat karty, mazat členy a měnit nastavení tabla.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Všechna tabla",
"and-n-other-card": "A __count__ další karta(y)",
"and-n-other-card_plural": "A __count__ dalších karet",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Mitglieder",
"admin": "Admin",
"admin-desc": "Kann Karten anschauen und bearbeiten, Mitglieder entfernen und Boardeinstellungen ändern.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Alle Boards",
"and-n-other-card": "und eine andere Karte",
"and-n-other-card_plural": "und __count__ andere Karten",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Members",
"admin": "Admin",
"admin-desc": "Can view and edit cards, remove members, and change settings for the board.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "All boards",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Members",
"admin": "Admin",
"admin-desc": "Can view and edit cards, remove members, and change settings for the board.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "All boards",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Membroj",
"admin": "Admin",
"admin-desc": "Can view and edit cards, remove members, and change settings for the board.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "All boards",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Miembros",
"admin": "Administrador",
"admin-desc": "Puedes ver y editar fichas, eliminar miembros, y cambiar los ajustes del tablero",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Tableros",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Kideak",
"admin": "Kudeatzailea",
"admin-desc": "Txartelak ikusi eta editatu ditzake, kideak kendu, eta arbelaren ezarpenak aldatu.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Arbel guztiak",
"and-n-other-card": "Eta beste txartel __count__",
"and-n-other-card_plural": "Eta beste __count__ txartel",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "اعضا",
"admin": "مدیر",
"admin-desc": "امکان دیدن و ویرایش کارتها،پاک کردن کاربران و تغییر تنظیمات برای تخته",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "تمام بردها",
"and-n-other-card": "و __count__ کارت دیگر",
"and-n-other-card_plural": "و __count__ کارت دیگر",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Jäsenet",
"admin": "Ylläpitäjä",
"admin-desc": "Voi nähfä ja muokata kortteja, poistaa jäseniä, ja muuttaa taulun asetuksia.",
"admin-announcement": "Ilmoitus",
"admin-announcement-active": "Aktiivinen järjestelmänlaajuinen ilmoitus",
"admin-announcement-title": "Ilmoitus ylläpitäjältä",
"all-boards": "Kaikki taulut",
"and-n-other-card": "Ja __count__ muu kortti",
"and-n-other-card_plural": "Ja __count__ muuta korttia",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Membres",
"admin": "Admin",
"admin-desc": "Peut voir et éditer les cartes, supprimer des membres et changer les paramètres du tableau.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Tous les tableaux",
"and-n-other-card": "Et __count__ autre carte",
"and-n-other-card_plural": "Et __count__ autres cartes",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Membros",
"admin": "Admin",
"admin-desc": "Pode ver e editar tarxetas, retirar membros e cambiar a configuración do taboleiro.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Todos os taboleiros",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "חברים",
"admin": "מנהל",
"admin-desc": "יש הרשאות לצפייה ולעריכת כרטיסים, להסרת חברים ולשינוי הגדרות לוח.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "כל הלוחות",
"and-n-other-card": "וכרטיס אחר",
"and-n-other-card_plural": "ו־__count__ כרטיסים אחרים",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Tagok",
"admin": "Adminisztrátor",
"admin-desc": "Lehet szerkeszteni a lapot, tagokat távolíthat el, és és a fórumon-beállításainak módosítása.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Összes tábla",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Daftar Anggota",
"admin": "Admin",
"admin-desc": "Bisa tampilkan dan sunting kartu, menghapus partisipan, dan merubah setting panel",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Semua Panel",
"and-n-other-card": "Dan__menghitung__kartu lain",
"and-n-other-card_plural": "Dan__menghitung__kartu lain",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Membri",
"admin": "Amministratore",
"admin-desc": "Può vedere e modificare schede, rimuovere membri e modificare le impostazioni della bacheca.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Tutte le bacheche",
"and-n-other-card": "E __count__ altra scheda",
"and-n-other-card_plural": "E __count__ altre schede",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "メンバー",
"admin": "管理",
"admin-desc": "カードの閲覧と編集、メンバーの削除、ボードの設定変更が可能",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "全てのボード",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "멤버",
"admin": "관리자",
"admin-desc": "카드를 보거나 수정하고, 멤버를 삭제하고, 보드에 대한 설정을 수정할 수 있습니다.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "전체 보드",
"and-n-other-card": "__count__ 개의 다른 카드",
"and-n-other-card_plural": "__count__ 개의 다른 카드들",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Medlemmer",
"admin": "Admin",
"admin-desc": "Kan se og redigere kort, fjerne medlemmer, og endre innstillingene for tavlen.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Alle tavler",
"and-n-other-card": "Og __count__ andre kort",
"and-n-other-card_plural": "Og __count__ andre kort",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Leden",
"admin": "Administrator",
"admin-desc": "Kan kaarten bekijken en wijzigen, leden verwijderen, en instellingen voor het bord aanpassen.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Alle borden",
"and-n-other-card": "En nog __count__ ander",
"and-n-other-card_plural": "En __count__ andere kaarten",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Członkowie",
"admin": "Admin",
"admin-desc": "Może widzieć i edytować karty, usuwać członków oraz zmieniać ustawienia tablicy.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Wszystkie tablice",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Membros",
"admin": "Administrador",
"admin-desc": "Pode ver e editar cartões, remover membros e alterar configurações do quadro.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Todos os quadros",
"and-n-other-card": "E __count__ outro cartão",
"and-n-other-card_plural": "E __count__ outros cartões",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Members",
"admin": "Admin",
"admin-desc": "Can view and edit cards, remove members, and change settings for the board.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "All boards",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Участники",
"admin": "Администратор",
"admin-desc": "Может просматривать и редактировать карточки, удалять участников и управлять настройками доски.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Все доски",
"and-n-other-card": "И __count__ другая карточка",
"and-n-other-card_plural": "И __count__ другие карточки",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Članovi",
"admin": "Administrator",
"admin-desc": "Može da pregleda i menja kartice, uklanja članove i menja podešavanja table",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Sve table",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Medlemmar",
"admin": "Adminstratör",
"admin-desc": "Kan visa och redigera kort, ta bort medlemmar och ändra inställningarna för anslagstavlan.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Alla anslagstavlor",
"and-n-other-card": "Och __count__ annat kort",
"and-n-other-card_plural": "Och __count__ andra kort",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Members",
"admin": "Admin",
"admin-desc": "Can view and edit cards, remove members, and change settings for the board.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "All boards",
"and-n-other-card": "And __count__ other card",
"and-n-other-card_plural": "And __count__ other cards",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "สมาชิก",
"admin": "ผู้ดูแลระบบ",
"admin-desc": "สามารถดูและแก้ไขการ์ด ลบสมาชิก และเปลี่ยนการตั้งค่าบอร์ดได้",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "บอร์ดทั้งหมด",
"and-n-other-card": "และการ์ดอื่น __count__",
"and-n-other-card_plural": "และการ์ดอื่น ๆ __count__",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Üyeler",
"admin": "Yönetici",
"admin-desc": "Kartları görüntüleyebilir ve düzenleyebilir, üyeleri çıkarabilir ve pano ayarlarını değiştirebilir.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Tüm panolar",
"and-n-other-card": "Ve __count__ diğer kart",
"and-n-other-card_plural": "Ve __count__ diğer kart",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Користувачі",
"admin": "Адмін",
"admin-desc": "Може переглядати і редагувати картки, відаляти учасників та змінювати налаштування для дошки.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Всі дошки",
"and-n-other-card": "та __count__ інших карток",
"and-n-other-card_plural": "та __count__ інших карток",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "Thành Viên",
"admin": "Quản Trị Viên",
"admin-desc": "Có thể xem và chỉnh sửa những thẻ, xóa thành viên và thay đổi cài đặt cho bảng.",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "Tất cả các bảng",
"and-n-other-card": "Và __count__ thẻ khác",
"and-n-other-card_plural": "Và __count__ thẻ khác",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "成员",
"admin": "管理员",
"admin-desc": "可以浏览并编辑卡片,移除成员,并且更改该看板的设置",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "全部看板",
"and-n-other-card": "和其他 __count__ 个卡片",
"and-n-other-card_plural": "和其他 __count__ 个卡片",

View file

@ -54,6 +54,9 @@
"addMemberPopup-title": "成員",
"admin": "管理員",
"admin-desc": "可以瀏覽並編輯卡片,移除成員,並且更改該看板的設定",
"admin-announcement": "Announcement",
"admin-announcement-active": "Active System-Wide Announcement",
"admin-announcement-title": "Announcement from Administrator",
"all-boards": "全部看板",
"and-n-other-card": "和其他 __count__ 個卡片",
"and-n-other-card_plural": "和其他 __count__ 個卡片",

36
models/announcements.js Normal file
View file

@ -0,0 +1,36 @@
Announcements = new Mongo.Collection('announcements');
Announcements.attachSchema(new SimpleSchema({
enabled: {
type: Boolean,
defaultValue: false,
},
title: {
type: String,
optional: true,
},
body: {
type: String,
optional: true,
},
sort: {
type: Number,
decimal: true,
},
}));
Announcements.allow({
update(userId) {
const user = Users.findOne(userId);
return user && user.isAdmin;
},
});
if (Meteor.isServer) {
Meteor.startup(() => {
const announcements = Announcements.findOne({});
if(!announcements){
Announcements.insert({enabled: false, sort: 0});
}
});
}

View file

@ -0,0 +1,3 @@
Meteor.publish('announcements', function() {
return Announcements.find();
});