summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authornztqa <nztqa@users.noreply.github.com>2017-09-28 16:57:04 +0900
committernztqa <nztqa@users.noreply.github.com>2017-09-28 16:57:04 +0900
commitaa1876f94c71d252d427f298e9b37c87f2fe4127 (patch)
tree6540ff8c3af1875edc6e1f0d2ce7d9480b86bdb8 /client
parenteb945f26a3be316fb2ae4452d6db45a11f8b91d4 (diff)
downloadwekan-aa1876f94c71d252d427f298e9b37c87f2fe4127.tar.gz
wekan-aa1876f94c71d252d427f298e9b37c87f2fe4127.tar.bz2
wekan-aa1876f94c71d252d427f298e9b37c87f2fe4127.zip
Add message from service administrator
Diffstat (limited to 'client')
-rw-r--r--client/components/main/header.jade7
-rw-r--r--client/components/main/header.js14
-rw-r--r--client/components/main/header.styl1
-rw-r--r--client/components/settings/settingBody.jade20
-rw-r--r--client/components/settings/settingBody.js45
-rw-r--r--client/components/settings/settingBody.styl7
6 files changed, 91 insertions, 3 deletions
diff --git a/client/components/main/header.jade b/client/components/main/header.jade
index bd0af880..613dd736 100644
--- a/client/components/main/header.jade
+++ b/client/components/main/header.jade
@@ -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
diff --git a/client/components/main/header.js b/client/components/main/header.js
index 49acbfef..3b724651 100644
--- a/client/components/main/header.js
+++ b/client/components/main/header.js
@@ -10,8 +10,22 @@ Template.header.helpers({
appIsOffline() {
return !Meteor.status().connected;
},
+
+ hasAnnouncement() {
+ const notice = Notices.findOne();
+ return notice && notice.enabled;
+ },
+
+ announcement() {
+ $('.announcement').show();
+ const notice = Notices.findOne();
+ return notice && notice.body;
+ },
});
Template.header.events({
'click .js-create-board': Popup.open('headerBarCreateBoard'),
+ 'click .js-close-announcement'() {
+ $('.announcement').hide();
+ },
});
diff --git a/client/components/main/header.styl b/client/components/main/header.styl
index 0e35d38a..191e8893 100644
--- a/client/components/main/header.styl
+++ b/client/components/main/header.styl
@@ -197,6 +197,7 @@
li
height: 28px
+.announcement,
.offline-warning
width: 100%
text-align: center
diff --git a/client/components/settings/settingBody.jade b/client/components/settings/settingBody.jade
index 5864efd5..a3b534f4 100644
--- a/client/components/settings/settingBody.jade
+++ b/client/components/settings/settingBody.jade
@@ -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="notice-setting") {{_ 'admin-notice'}}
.main-body
if loading.get
+spinner
@@ -23,6 +25,8 @@ template(name="setting")
+email
else if accountSetting.get
+accountSettings
+ else if noticeSetting.get
+ +administratorNoticeSettings
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='administratorNoticeSettings')
+ ul#notice-setting.setting-detail
+ li
+ a.flex.js-toggle-activemessage
+ .materialCheckBox(class="{{#if currentSetting.enabled}}is-checked{{/if}}")
+
+ span {{_ 'admin-notice-active'}}
+ li
+ .admin-notice(class="{{#if currentSetting.enabled}}{{else}}hide{{/if}}")
+ ul
+ li
+ .title {{_ 'admin-notice-title'}}
+ textarea#admin-notice.form-control= currentSetting.body
+ li
+ button.js-notice-save.primary {{_ 'save'}}
diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js
index a2993426..38213828 100644
--- a/client/components/settings/settingBody.js
+++ b/client/components/settings/settingBody.js
@@ -1,6 +1,7 @@
Meteor.subscribe('setting');
Meteor.subscribe('mailServer');
Meteor.subscribe('accountSettings');
+Meteor.subscribe('notices');
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.noticeSetting = 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.noticeSetting.set('notice-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 Notices.findOne();
+ },
+
+ saveMessage() {
+ const message = $('#admin-notice').val().trim();
+ Notices.update(Notices.findOne()._id, {
+ $set: { 'body': message },
+ });
+ },
+
+ toggleActive(){
+ this.setLoading(true);
+ const isActive = this.currentSetting().enabled;
+ Notices.update(Notices.findOne()._id, {
+ $set:{ 'enabled': !isActive},
+ });
+ this.setLoading(false);
+ if(isActive){
+ $('.admin-notice').slideUp();
+ }else{
+ $('.admin-notice').slideDown();
+ }
+ },
+
+ events() {
+ return [{
+ 'click a.js-toggle-activemessage': this.toggleActive,
+ 'click button.js-notice-save': this.saveMessage,
+ }];
+ },
+}).register('administratorNoticeSettings');
diff --git a/client/components/settings/settingBody.styl b/client/components/settings/settingBody.styl
index 118d364c..d28ae268 100644
--- a/client/components/settings/settingBody.styl
+++ b/client/components/settings/settingBody.styl
@@ -61,10 +61,11 @@
.is-checked
border-bottom: 2px solid #2980b9;
border-right: 2px solid #2980b9;
-
- span
+
+ span
padding: 0 0.5rem
-
+
+ .admin-notice,
.invite-people
padding-left 20px;
li