Merge branch 'nztqa-improve-announcement' into devel

Site Wide Announcement. Thanks to nztqa !
reviewable/pr1270/r1
Lauri Ojansivu 8 years ago
commit ff5e88fca3
  1. 3
      .eslintrc.json
  2. 3
      CHANGELOG.md
  3. 6
      client/components/lists/listBody.js
  4. 7
      client/components/main/header.jade
  5. 14
      client/components/main/header.js
  6. 1
      client/components/main/header.styl
  7. 20
      client/components/settings/settingBody.jade
  8. 45
      client/components/settings/settingBody.js
  9. 7
      client/components/settings/settingBody.styl
  10. 3
      i18n/ar.i18n.json
  11. 3
      i18n/br.i18n.json
  12. 3
      i18n/ca.i18n.json
  13. 3
      i18n/cs.i18n.json
  14. 3
      i18n/de.i18n.json
  15. 3
      i18n/en-GB.i18n.json
  16. 3
      i18n/en.i18n.json
  17. 3
      i18n/eo.i18n.json
  18. 3
      i18n/es.i18n.json
  19. 3
      i18n/eu.i18n.json
  20. 3
      i18n/fa.i18n.json
  21. 3
      i18n/fi.i18n.json
  22. 3
      i18n/fr.i18n.json
  23. 3
      i18n/gl.i18n.json
  24. 3
      i18n/he.i18n.json
  25. 3
      i18n/hu.i18n.json
  26. 3
      i18n/id.i18n.json
  27. 3
      i18n/it.i18n.json
  28. 3
      i18n/ja.i18n.json
  29. 3
      i18n/ko.i18n.json
  30. 3
      i18n/nb.i18n.json
  31. 3
      i18n/nl.i18n.json
  32. 3
      i18n/pl.i18n.json
  33. 3
      i18n/pt-BR.i18n.json
  34. 3
      i18n/ro.i18n.json
  35. 3
      i18n/ru.i18n.json
  36. 3
      i18n/sr.i18n.json
  37. 3
      i18n/sv.i18n.json
  38. 3
      i18n/ta.i18n.json
  39. 3
      i18n/th.i18n.json
  40. 3
      i18n/tr.i18n.json
  41. 3
      i18n/uk.i18n.json
  42. 3
      i18n/vi.i18n.json
  43. 3
      i18n/zh-CN.i18n.json
  44. 3
      i18n/zh-TW.i18n.json
  45. 36
      models/announcements.js
  46. 3
      server/publications/announcements.js

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

@ -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:

@ -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);
}
},

@ -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

@ -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();
},
});

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

@ -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'}}

@ -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');

@ -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

@ -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 بطاقات",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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__ کارت دیگر",

@ -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",

@ -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",

@ -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",

@ -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__ כרטיסים אחרים",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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__ 개의 다른 카드들",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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__ другие карточки",

@ -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",

@ -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",

@ -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",

@ -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__",

@ -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",

@ -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__ інших карток",

@ -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",

@ -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__ 个卡片",

@ -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__ 個卡片",

@ -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});
}
});
}

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